Bug 1268877 - [RFE] oc label doesn't have an option to show labels
[RFE] oc label doesn't have an option to show labels
Status: ASSIGNED
Product: OpenShift Container Platform
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
3.0.0
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Juan Vallejo
Xingxing Xia
: Rebase, UpcomingRelease
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-05 09:52 EDT by Erik M Jacobs
Modified: 2018-01-25 16:30 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Erik M Jacobs 2015-10-05 09:52:24 EDT
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".
Comment 2 Juan Vallejo 2017-09-05 16:16:56 EDT
Upstream PR: https://github.com/kubernetes/kubernetes/pull/51971
Comment 3 Juan Vallejo 2017-10-25 16:32:17 EDT
Upstream PR has merged, marking this as UpcomingRelease, Rebase
Comment 4 Xingxing Xia 2018-01-15 22:32:18 EST
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
Comment 5 Juan Vallejo 2018-01-16 14:12:35 EST
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

Note You need to log in before you can comment on or make changes to this bug.