Bug 1486210

Summary: oc get all returns inconsistent spelling of resource type
Product: OpenShift Container Platform Reporter: XiaochuanWang <xiaocwan>
Component: ocAssignee: Maciej Szulik <maszulik>
Status: CLOSED ERRATA QA Contact: Xingxing Xia <xxia>
Severity: low Docs Contact:
Priority: medium    
Version: 3.7.0CC: akostadi, aos-bugs, deads, jokerman, mmccomas, wmeng, yapei
Target Milestone: ---   
Target Release: 3.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-04-11 05:38:22 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:
Embargoed:

Description XiaochuanWang 2017-08-29 08:39:29 UTC
Description of problem:
Create different types of resources, check oc get all, the output returns incosistently.


Version-Release number of selected component (if applicable):
openshift/oc v3.7.0-0.117.0

How reproducible:
Always

Steps to Reproduce:
1. oc new-app -f https://raw.githubusercontent.com/openshift/origin/master/examples/sample-app/application-template-stibuild.json
2. oc get all


Actual results:
2. Some resource use full spelling (eg:buildconfigs etc.) but some use brief spelling (eg:rc,po,svc etc.)

NAME                             TYPE      FROM      LATEST
buildconfigs/ruby-sample-build   Source    Git       1

NAME                         TYPE      FROM      STATUS    STARTED   DURATION
builds/ruby-sample-build-1   Source    Git       Pending             

NAME                              DOCKER REPO                                                      TAGS      UPDATED
imagestreams/origin-ruby-sample   docker-registry.default.svc:5000/xiaocwan-t/origin-ruby-sample             
imagestreams/ruby-22-centos7      centos/ruby-22-centos7                                           latest    3 seconds ago

NAME                         REVISION   DESIRED   CURRENT   TRIGGERED BY
deploymentconfigs/database   1          1         0         config
deploymentconfigs/frontend   0          2         0         config,image(origin-ruby-sample:latest)

NAME                HOST/PORT         PATH      SERVICES   PORT      TERMINATION   WILDCARD
routes/route-edge   www.example.com             frontend   <all>     edge          None

NAME                           READY     STATUS              RESTARTS   AGE
po/database-1-deploy           0/1       ContainerCreating   0          4s
po/doublecontainers            2/2       Running             0          1h
po/ruby-sample-build-1-build   0/1       Init:0/2            0          3s

NAME            DESIRED   CURRENT   READY     AGE
rc/database-1   0         0         0         4s

NAME           CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
svc/database   172.30.229.196   <none>        5434/TCP   4s
svc/frontend   172.30.193.31    <none>        5432/TCP   4s


Expected results:
Resource type should be consistent 

Additional info:
It's not reproduced on OCP 3.6

Comment 1 Juan Vallejo 2017-08-30 17:22:36 UTC
Origin PR: https://github.com/openshift/origin/pull/16059

Comment 2 Xingxing Xia 2018-01-29 07:53:38 UTC
Juan Vallejo, will this issue be fixed? Saw the PR not updated long time and having conflict. Thx

Comment 3 Xingxing Xia 2018-04-16 09:01:29 UTC
FYI, in 3.10 oc, `oc get all` shows lengthier type names like:
NAME                                       REVISION   DESIRED   CURRENT   TRIGGERED BY
deploymentconfig.apps.openshift.io/myapp   1          1         0         config,image(myapp:hello-openshift)

NAME                                     TYPE      FROM      LATEST
buildconfig.build.openshift.io/ruby-ex   Source    Git       1

NAME                                 TYPE      FROM          STATUS     STARTED         DURATION
build.build.openshift.io/ruby-ex-1   Source    Git@bbb6701   Complete   3 minutes ago   1m3s

NAME                                             DOCKER REPO                                                  TAGS              UPDATED
imagestream.image.openshift.io/myapp             docker-registry.default.svc:5000/xxia-proj/myapp             hello-openshift   3 days ago
imagestream.image.openshift.io/ruby-22-centos7   docker-registry.default.svc:5000/xxia-proj/ruby-22-centos7   latest            3 minutes ago
imagestream.image.openshift.io/ruby-ex           docker-registry.default.svc:5000/xxia-proj/ruby-ex           latest            2 minutes ago

It is better to not print type names so lengthy

Comment 4 Weihua Meng 2018-04-18 07:33:35 UTC
hi, is this "deploymentconfig.apps.openshift.io" string helpful and intended for user.


NAME                                                  REVISION   DESIRED   CURRENT   TRIGGERED BY
deploymentconfig.apps.openshift.io/docker-registry    2          3         3         config
deploymentconfig.apps.openshift.io/registry-console   2          1         1         config
deploymentconfig.apps.openshift.io/router             2          3         3         config

I prefer deploymentconfigs/xxx style

Thanks

Comment 5 Juan Vallejo 2018-04-19 23:48:27 UTC
Yes, the format "Kind.group/name" is intended in order to allow the printed information to be consumed by other client commands.

Comment 6 Juan Vallejo 2018-04-19 23:52:36 UTC
Adding David for his feedback on this.

Comment 7 David Eads 2018-04-20 11:40:17 UTC
I wouldn't worry about it.  They're all clear and they change again in 3.10. Human readable output isn't stable and the pipes roundtrip properly.

Comment 8 Aleksandar Kostadinov 2018-04-24 22:30:33 UTC
I think there is a contradiction here. On the one hand I see:

> allow the printed information to be consumed by other client commands

and on the other:

> Human readable output isn't stable and the pipes roundtrip properly.


My opinion is with the latter. I always though of plain `oc get` as human readable output that shouldn't be used for scripting. Thus should aim at better readability instead of producing very long and ugly output lines.

I realize that David's comment was not negative towards the change. But my suggestion is moving output back to the shorthand strings.

For scripts, the -o yaml or template options can be used.

Comment 10 Maciej Szulik 2019-02-26 15:54:18 UTC
This was fixed when we moved to the new printing stack in 3.11.

Comment 11 XiaochuanWang 2019-02-27 03:10:31 UTC
Tested on $ ./oc version
oc v3.11.82

Outputs are correct, the build and imagestream are displayed with api resource group, which is expected.
This issue could be Verified.

$ ./oc get all
NAME                            READY     STATUS      RESTARTS   AGE
pod/database-1-deploy           0/1       Completed   0          9m1s
pod/database-1-hook-mid         0/1       Completed   0          8m24s
pod/database-1-hook-post        0/1       Completed   0          7m45s
pod/database-1-hook-pre         0/1       Completed   0          8m52s
pod/database-1-wqcr5            1/1       Running     0          7m54s
pod/dctest-1-deploy             0/1       Completed   0          26m
pod/dctest-2-6kv5t              2/2       Running     0          19m
pod/dctest-2-deploy             0/1       Completed   0          19m
pod/frontend-1-deploy           0/1       Completed   0          7m3s
pod/frontend-1-dffz5            1/1       Running     0          6m14s
pod/frontend-1-hook-post        0/1       Completed   0          5m31s
pod/frontend-1-hook-pre         0/1       Completed   0          6m54s
pod/frontend-1-q68fp            1/1       Running     0          6m14s
pod/ruby-sample-build-1-build   0/1       Completed   0          9m1s

NAME                               DESIRED   CURRENT   READY     AGE
replicationcontroller/database-1   1         1         1         9m1s
replicationcontroller/dctest-1     0         0         0         26m
replicationcontroller/dctest-2     1         1         1         19m
replicationcontroller/frontend-1   2         2         2         7m3s

NAME               TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
service/database   ClusterIP   172.30.223.228   <none>        5434/TCP   9m2s
service/frontend   ClusterIP   172.30.250.191   <none>        5432/TCP   9m4s

NAME                                          REVISION   DESIRED   CURRENT   TRIGGERED BY
deploymentconfig.apps.openshift.io/database   1          1         1         config
deploymentconfig.apps.openshift.io/dctest     2          1         1         config
deploymentconfig.apps.openshift.io/frontend   1          2         2         config,image(origin-ruby-sample:latest)

NAME                                               TYPE      FROM      LATEST
buildconfig.build.openshift.io/ruby-sample-build   Source    Git       1

NAME                                           TYPE      FROM          STATUS     STARTED         DURATION
build.build.openshift.io/ruby-sample-build-1   Source    Git@787f1be   Complete   9 minutes ago   1m59s

NAME                                                IMAGE REPOSITORY                                                                 TAGS         UPDATED
imagestream.image.openshift.io/origin-ruby-sample   image-registry.openshift-image-registry.svc:5000/xiaocwan-t/origin-ruby-sample   latest       7 minutes ago
imagestream.image.openshift.io/ruby-22-centos7      centos/ruby-22-centos7                                                           2.2,latest   9 minutes ago

NAME                                  HOST/PORT         PATH      SERVICES   PORT      TERMINATION   WILDCARD
route.route.openshift.io/route-edge   www.example.com             frontend   <all>     edge          None

Comment 13 errata-xmlrpc 2019-04-11 05:38:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:0636