Bug 2052034

Summary: Can't start correct debug pod using pod definition yaml in OCP 4.8
Product: OpenShift Container Platform Reporter: Divyam Pateriya <dpateriy>
Component: ocAssignee: Maciej Szulik <maszulik>
oc sub component: oc QA Contact: zhou ying <yinzhou>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: aos-bugs, mfojtik
Version: 4.8   
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:47:58 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:
Bug Depends On:    
Bug Blocks: 2068763    

Description Divyam Pateriya 2022-02-08 14:35:19 UTC
Description of problem:

OC Client for Version 4.8 can't start correct debug pod using the pod definition yaml

Version-Release number of selected component (if applicable):
 
# oc version
Client Version: 4.8.13
Server Version: 4.8.13
Kubernetes Version: v1.21.1+a620f50

How reproducible:
100%

Steps to Reproduce:

1. Create a simple pod definition file

~~~
# cat test-pod.yaml

apiVersion: v1
kind: Pod
metadata:
  name: test-pod
  labels:
    app: test-pod
spec:
  containers:
  - command: ["/bin/sh", "-ec", "sleep 300"]
    image: registry.redhat.io/openshift4/ose-cli@sha256:725f4165c9a3327bea15daf342adc6542f308be829e66d3b4d43abd9ad2f9bef
    imagePullPolicy: IfNotPresent
    name: test-container
    resources:
      limits:
        cpu: 500m
        memory: 128Mi
      requests:
        cpu: 250m
        memory: 64Mi
~~~

2. Try to create a debug pod using the below command:

# oc debug -f test-pod.yaml

Starting pod/image-debug ...
Pod IP: 10.131.0.146
If you don't see a command prompt, try pressing enter.
sh-4.4# 


Actual results:

The option "-f" is being ignored and instead a image-debug container is being started

Expected results:

The debug pod should be created using the pod definition yaml file.

Additional info:

Comment 4 zhou ying 2022-02-14 03:58:16 UTC
Checked with latest oc client, the issue has fixed:

[root@localhost roottest]# oc version --client
Client Version: 4.11.0-202202111945.p0.gd7b5d2b.assembly.stream-d7b5d2b

[root@localhost roottest]# oc debug -f /tmp/test-pod.yaml 
Starting pod/test-pod-debug, command was: /bin/sh -ec sleep 300
Pod IP: 10.128.2.31
If you don't see a command prompt, try pressing enter.
sh-4.4#


[root@localhost ~]# oc get events
LAST SEEN   TYPE     REASON           OBJECT               MESSAGE
64s         Normal   Scheduled        pod/test-pod-debug   Successfully assigned zhouyt/test-pod-debug to ip-10-0-58-4.us-east-2.compute.internal
63s         Normal   AddedInterface   pod/test-pod-debug   Add eth0 [10.128.2.31/23] from openshift-sdn
63s         Normal   Pulling          pod/test-pod-debug   Pulling image "registry.redhat.io/openshift4/ose-cli@sha256:725f4165c9a3327bea15daf342adc6542f308be829e66d3b4d43abd9ad2f9bef"
55s         Normal   Pulled           pod/test-pod-debug   Successfully pulled image "registry.redhat.io/openshift4/ose-cli@sha256:725f4165c9a3327bea15daf342adc6542f308be829e66d3b4d43abd9ad2f9bef" in 7.60403777s
55s         Normal   Created          pod/test-pod-debug   Created container test-container
55s         Normal   Started          pod/test-pod-debug   Started container test-container
[root@localhost ~]# oc get po
NAME             READY   STATUS    RESTARTS   AGE
test-pod-debug   1/1     Running   0          74s

Comment 8 errata-xmlrpc 2022-08-10 10:47:58 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