Bug 1268877 - [RFE] oc label doesn't have an option to show labels
Summary: [RFE] oc label doesn't have an option to show labels
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 3.0.0
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: 3.11.z
Assignee: Maciej Szulik
QA Contact: Xingxing Xia
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-10-05 13:52 UTC by Erik M Jacobs
Modified: 2019-04-11 05:38 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Feature: Be able to list labels on a resource. Reason: Understand labels present on a resource. Result: oc label --list resource/name shows all the labels.
Clone Of:
Environment:
Last Closed: 2019-04-11 05:38:22 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:0636 0 None None None 2019-04-11 05:38:28 UTC

Description Erik M Jacobs 2015-10-05 13:52:24 UTC
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 20:16:56 UTC
Upstream PR: https://github.com/kubernetes/kubernetes/pull/51971

Comment 3 Juan Vallejo 2017-10-25 20:32:17 UTC
Upstream PR has merged, marking this as UpcomingRelease, Rebase

Comment 4 Xingxing Xia 2018-01-16 03:32:18 UTC
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 19:12:35 UTC
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

Comment 7 Maciej Szulik 2019-02-21 15:56:15 UTC
oc label --list pod/name is a thing for quite a while already, moving to QA.

Comment 8 Xingxing Xia 2019-02-27 13:58:50 UTC
(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.

Comment 10 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


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