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
$ oc label po ruby-ex-2-649cc --list
However, it is not perfect for multiple resources:
$ oc label dc ruby-ex aosqe-ho --list
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
# deploymentconfigs aosqe-ho, container aosqe-ho
Opened upstream PR for this. Marking as upcoming release.
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:
Listing labels for dc/dc_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
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:
Listing labels for DeploymentConfig.apps.openshift.io/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.