Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2042027

Summary: Incorrect feedback for "oc label pods --all"
Product: OpenShift Container Platform Reporter: Anna Savina <asavina>
Component: ocAssignee: Maciej Szulik <maszulik>
oc sub component: oc QA Contact: zhou ying <yinzhou>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: mfojtik
Version: 4.10   
Target Milestone: ---   
Target Release: 4.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-10 10:43:03 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:
Attachments:
Description Flags
OCP4_10 none

Description Anna Savina 2022-01-18 17:27:20 UTC
Created attachment 1851669 [details]
OCP4_10

Description of problem:
Incorrect feedback for "oc label pods --all <label> --overwrite=true" 

---------------------------

Version-Release number of selected component (if applicable):
4.10.0-0.nightly-2022-01-17-091922

---------------------------

How reproducible:
100%

---------------------------

Steps to Reproduce:
1. oc apply -f - << EOF
> apiVersion: v1
> kind: Pod
> metadata:
>   name: hello-openshift
> spec:
>   nodeName: worker-0-0
>   containers:
>    - name: hello-openshift
>      image: quay.io/openshifttest/hello-openshift@sha256:aaea76ff622d2f8bcb32e538e7b3cd0ef6d291953f3e7c9f556c1ba5baf47e2e
>   imagePullPolicy: IfNotPresent
> EOF

2. oc apply -f - << EOF
apiVersion: v1
kind: Pod
metadata:
  name: hello-openshift2
spec:
  nodeName: worker-0-0
  containers:
   - name: hello-openshift2
     image: quay.io/openshifttest/hello-openshift@sha256:aaea76ff622d2f8bcb32e538e7b3cd0ef6d291953f3e7c9f556c1ba5baf47e2e
  imagePullPolicy: IfNotPresent
EOF

3. oc label pods hello-openshift status=unhealthy

4. oc label pods --all status=healthy --overwrite=true

---------------------------

Actual results:
pod/hello-openshift unlabeled

---------------------------

Expected results:
pod/hello-openshift labeled

---------------------------

Additional info:
For OCP 4.9 test passed
For OCP 4.10 result of command is right, just wrong feedback

Comment 2 Maciej Szulik 2022-01-19 13:11:13 UTC
I've commented on the PR which introduced this problem https://github.com/kubernetes/kubernetes/pull/104372/files#r787728591

Comment 3 Maciej Szulik 2022-01-21 11:51:53 UTC
This will be fixed in k8s 1.24, see https://github.com/kubernetes/kubernetes/pull/107657

Comment 5 Maciej Szulik 2022-05-31 11:29:19 UTC
1.24 landed in  https://github.com/openshift/oc/pull/1092

Comment 7 zhou ying 2022-06-01 04:05:06 UTC
[root@localhost ~]# oc get pods
NAME               READY   STATUS    RESTARTS   AGE
hello-openshift    1/1     Running   0          3s
hello-openshift2   1/1     Running   0          2m56s
[root@localhost ~]# oc label pods hello-openshift status=unhealthy
pod/hello-openshift labeled
[root@localhost ~]# oc label pods --all status=healthy --overwrite=true
pod/hello-openshift labeled
pod/hello-openshift2 labeled
[root@localhost ~]# oc get pod --show-labels
NAME               READY   STATUS    RESTARTS   AGE     LABELS
hello-openshift    1/1     Running   0          50s     status=healthy
hello-openshift2   1/1     Running   0          3m43s   status=healthy
[root@localhost ~]# oc version --client
Client Version: 4.11.0-0.nightly-2022-05-26-013101
Kustomize Version: v4.5.4

Comment 9 errata-xmlrpc 2022-08-10 10:43:03 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 (Important: OpenShift Container Platform 4.11.0 bug fix and security update), 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/RHSA-2022:5069