Bug 1332499

Summary: Should hide the labels for route by oc get route, and show it correctly when using option --show-labels
Product: OKD Reporter: Meng Bo <bmeng>
Component: RoutingAssignee: Phil Cameron <pcameron>
Status: CLOSED CURRENTRELEASE QA Contact: zhaozhanqi <zzhao>
Severity: low Docs Contact:
Priority: medium    
Version: 3.xCC: aos-bugs, bmeng, sukulkar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-09 21:52:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Meng Bo 2016-05-03 10:53:40 UTC
Description of problem:
Create route and add some labels to it. Try to get the route via oc get route.

It will have a column called LABELS by default, and when using oc get route --show-labels, it will show two columns named LABELS and the latter one does not have value.

As the description in `oc get --help`
      --show-labels=false: When printing, show all labels as the last column (default hide labels column)

We should also hide the labels for route by default and show them when appending the option.

Version-Release number of selected component (if applicable):
oc v1.3.0-alpha.0-267-gcd62e58

How reproducible:
always

Steps to Reproduce:
1. Create edge route via normal user
$ oc create -f route.json
2. Add a label to the route
$ oc label route route1 team=red
3. Try to get the route
4. Try to get the route with --show-labels option

Actual results:
3.
[user1@master ~]$ oc get route
NAME                 HOST/PORT      PATH      SERVICE            TERMINATION   LABELS
secured-edge-route   www.edge.com             service-unsecure   edge          team=red

4.
NAME                 HOST/PORT      PATH      SERVICE            TERMINATION   LABELS    LABELS
secured-edge-route   www.edge.com             service-unsecure   edge          team=red


Expected results:
Should hide the labels by default and show it correctly when using --show-labels. Just like other resources.

Additional info:

Comment 1 Phil Cameron 2016-09-14 14:51:07 UTC
Bo,
I tried this on a dev build and I am getting something different. The heading is correct but no labels are displayed. Could you verify what you are seeing on a recent build? 

# oc get routes hello-route -o yaml
apiVersion: v1
kind: Route
metadata:
  creationTimestamp: 2016-09-14T13:56:15Z
  labels:
    goodroute: great
    team: red
  name: hello-route
  namespace: default
    resourceVersion: "20609258"
    selfLink: /oapi/v1/namespaces/default/routes/hello-route
    uid: 00d4eafb-7a83-11e6-b37b-ecf4bbd7ae44
  spec:
    host: hello-openshift-v3.mycloud.com
    to:
      kind: Service
      name: hello-svc
      weight: 100
  status:
    ingress: null
kind: List
metadata: {}

# oc get route --show-labels
NAME          HOST/PORT                        PATH      SERVICES    PORT      TERMINATION   LABELS
hello-route   hello-openshift-v3.mycloud.com             hello-svc   <all> 

# oc get route 
NAME          HOST/PORT                        PATH      SERVICES    PORT      TERMINATION
hello-route   hello-openshift-v3.mycloud.com             hello-svc   <all>

Comment 2 Phil Cameron 2016-09-14 18:42:13 UTC
Fixed in openshift/origin PR 10913
Out for review.

Comment 3 openshift-github-bot 2016-09-22 08:32:15 UTC
Commit pushed to master at https://github.com/openshift/origin

https://github.com/openshift/origin/commit/8b6f0321a9afc881ac751958404e31abcadffed2
Should hide the labels for route by oc get route

oc get route --show-labels does not display the labels.

Here is the output from the fixed code:
oc get route --show-labels
NAME          HOST/PORT                        PATH      SERVICES
PORT      TERMINATION   LABELS
hello-route   hello-openshift-v3.mycloud.com             hello-svc
<all>                   goodroute=great,team=red

oc get route
NAME          HOST/PORT                        PATH      SERVICES
PORT      TERMINATION
hello-route   hello-openshift-v3.mycloud.com             hello-svc
<all>

oc get route -o yaml
apiVersion: v1
items:
- apiVersion: v1
  kind: Route
  metadata:
    creationTimestamp: 2016-09-14T13:56:15Z
    labels:
      goodroute: great
      team: red
    name: hello-route
    namespace: default
    resourceVersion: "20609258"
    selfLink: /oapi/v1/namespaces/default/routes/hello-route
    uid: 00d4eafb-7a83-11e6-b37b-ecf4bbd7ae44
  spec:
    host: hello-openshift-v3.mycloud.com
    to:
      kind: Service
      name: hello-svc
      weight: 100
  status:
    ingress: null
kind: List
metadata: {}

Fixes bug 1332499

Comment 4 Meng Bo 2016-10-12 08:24:49 UTC
[user1@master ~]$ oc get route
NAME      HOST/PORT              PATH      SERVICES           PORT      TERMINATION
route     unsecure.example.com             service-unsecure   <all>     
[user1@master ~]$ oc get route --show-labels 
NAME      HOST/PORT              PATH      SERVICES           PORT      TERMINATION   LABELS
route     unsecure.example.com             service-unsecure   <all>                   test=test1

[user1@master ~]$ oc version
oc v1.4.0-alpha.0+b3ec794
kubernetes v1.4.0-beta.3+d19513f
features: Basic-Auth

The issue has been fixed in origin. Since it is not an OCP bug, we do not need to leave it in MODIFIED status.