There doesn't appear to be an option to show labels like there is with "oc env". There is no --list As a user of OpenShift When using the command line I want to be able to see all the labels on an object with the "oc label" command Right now I think the only way to do this is with "oc describe".
Upstream PR: https://github.com/kubernetes/kubernetes/pull/51971
Upstream PR has merged, marking this as UpcomingRelease, Rebase
Checked oc v3.9.0-0.19.0 `oc label -h` now has `--list`, and generally it works: $ oc label dc/ruby-ex --list app=ruby-ex $ oc label po ruby-ex-2-649cc --list app=ruby-ex deployment=ruby-ex-2 deploymentconfig=ruby-ex However, it is not perfect for multiple resources: $ oc label dc ruby-ex aosqe-ho --list app=ruby-ex app=aosqe-ho It should add preceding resource names like `oc set env --list` for multiple resources: $ oc set env dc ruby-ex aosqe-ho --list # deploymentconfigs ruby-ex, container ruby-ex NEW_ENV2=new_value2 # deploymentconfigs aosqe-ho, container aosqe-ho NEW_ENV1=new_value1 Please check
Opened upstream PR for this. Marking as upcoming release. https://github.com/kubernetes/kubernetes/pull/58353 New output for `oc labels --list` will include the resource kind/name before each set of labels belonging to that specific resource: $ oc label ... dc dc_one dc_two --list Listing labels for dc/dc_one: label1=one Listing labels for dc/dc_two: label2=two
oc label --list pod/name is a thing for quite a while already, moving to QA.
(In reply to Xingxing Xia from comment #4) > However, it is not perfect for multiple resources: > $ oc label dc ruby-ex aosqe-ho --list > app=ruby-ex > app=aosqe-ho This still exists in latest 3.9 oc 3.9.71 and 3.10 oc 3.10.118. Fixed in 3.11 oc 3.11.86: 3.11/oc label dc registry-console router --list Listing labels for DeploymentConfig.apps.openshift.io/registry-console: createdBy=registry-console-template name=registry-console Listing labels for DeploymentConfig.apps.openshift.io/router: router=router Since bug is low AND no versioned advisory attached, IMO target field can be changed.
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