Bug 1920024 - oc debug should allow starting only with --image=X
Summary: oc debug should allow starting only with --image=X
Keywords:
Status: VERIFIED
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.7
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Arda Guclu
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-01-25 15:13 UTC by Clayton Coleman
Modified: 2022-10-25 05:45 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
5m CPU profile during e2e execution (148.87 KB, application/gzip)
2021-02-22 18:41 UTC, Clayton Coleman
no flags Details
5m CPU profile during e2e execution (later) (131.68 KB, application/gzip)
2021-02-22 18:42 UTC, Clayton Coleman
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github openshift oc pull 399 0 None closed Bug 1920024: Allow debug to start with a single `--image` argument 2021-02-15 05:37:08 UTC
Github openshift oc pull 613 0 None closed Bug 1920024: debug: Allow pods to keep labels during debugging 2021-02-15 05:37:08 UTC

Description Clayton Coleman 2021-01-25 15:13:39 UTC
oc debug acts to create a pod that represents a testable scenario on the cluster with a shell for debugging. The most primitive scenario is oc debug with no arguments, or with --image=X, which allows a user to debug the simplest possible scenario.

The default images (the tools image) should be usable.

Comment 1 Maciej Szulik 2021-02-08 12:18:47 UTC
This is still in the queue so bumping it to 4.8, we'll reconsider backport.

Comment 3 RamaKasturi 2021-02-16 10:31:17 UTC
Verified the bug on 4.8 ci payload and i see that oc debug works fine where as i see that keeplabels not working, will test these on nightly builds before moving the bug to verified state.

Comment 4 RamaKasturi 2021-02-22 13:35:14 UTC
Verified with the payload below and i see that ./oc debug with out any image works fine, but running ./oc debug dc/postgresql --keep-labels=true gives error as below.

[knarra@knarra openshift-client-linux-4.8.0-0.nightly-2021-02-21-102854]$ ./oc debug dc/postgresql --keep-labels=true
Starting pod/postgresql-debug, command was: container-entrypoint run-postgresql

Removing debug pod ...
error: unable to create the debug pod "postgresql-debug"

Below are the steps performed to test the --keep-labels command:
===============================================================
1) ./oc new-project knarra
2) ./oc new-app rails-postgresql-example
3) ./oc debug dc/postgresql works fine
4) But running ./oc debug dc/postgresql --keep-labels=true fails with error as below
[knarra@knarra openshift-client-linux-4.8.0-0.nightly-2021-02-21-102854]$ ./oc debug dc/postgresql --keep-labels=true
Starting pod/postgresql-debug, command was: container-entrypoint run-postgresql

Removing debug pod ...
error: unable to create the debug pod "postgresql-debug"

Based on the above moving bug to assigned state.

[knarra@knarra openshift-client-linux-4.8.0-0.nightly-2021-02-21-102854]$ ./oc version -o yaml
clientVersion:
  buildDate: "2021-02-20T04:51:51Z"
  compiler: gc
  gitCommit: 13f3e4b73df9b0853979e4130adf756784afe96f
  gitTreeState: clean
  gitVersion: 4.8.0-202102200123.p0-13f3e4b
  goVersion: go1.15.5
  major: ""
  minor: ""
  platform: linux/amd64
openshiftVersion: 4.8.0-0.nightly-2021-02-21-102854
releaseClientVersion: 4.8.0-0.nightly-2021-02-21-102854
serverVersion:
  buildDate: "2021-02-19T22:50:50Z"
  compiler: gc
  gitCommit: 01ab7fd5278756572d4a1dd3101f0a6d5c969824
  gitTreeState: clean
  gitVersion: v1.20.0+01ab7fd
  goVersion: go1.15.5
  major: "1"
  minor: "20"
  platform: linux/amd64

Below is the output running with -v=9:
=========================================
http://pastebin.test.redhat.com/941668

Comment 5 Clayton Coleman 2021-02-22 18:41:52 UTC
Created attachment 1758662 [details]
5m CPU profile during e2e execution

Comment 6 Clayton Coleman 2021-02-22 18:42:19 UTC
Created attachment 1758663 [details]
5m CPU profile during e2e execution (later)

Comment 7 Clayton Coleman 2021-02-22 18:42:53 UTC
Oops, attachments are for the wrong bug

Comment 8 Maciej Szulik 2021-06-09 13:22:07 UTC
(In reply to RamaKasturi from comment #4)
> [knarra@knarra openshift-client-linux-4.8.0-0.nightly-2021-02-21-102854]$
> ./oc debug dc/postgresql --keep-labels=true
> Starting pod/postgresql-debug, command was: container-entrypoint
> run-postgresql
> 
> Removing debug pod ...
> error: unable to create the debug pod "postgresql-debug"

This will be expected situation, because when you copy pod's labels into the exact
same namespace that pod will be automatically considered by owning controller,
here replication controller as one of the pods and since the replicas is set to 1
and it sees more than 1 pod, it removes the youngest one immediately.

Given that, I'm moving this back to qa.

Comment 10 RamaKasturi 2021-06-11 10:03:31 UTC
Tried to verify the bug by following the steps below but hit issue below, so moving the bug back to assigned state

The Pod "postgresql-debug" is invalid: spec.containers[0].image: Invalid value: " ": must not have leading or trailing whitespace

Steps performed:
================
1) Install 4.8 cluster
2) ./oc new-project test
3) ./oc new-app rails-postgresql-example
[knarra@knarra openshift-client-linux-4.8.0-0.nightly-2021-06-11-024306]$ ./oc debug dc/postgresql
The Pod "postgresql-debug" is invalid: spec.containers[0].image: Invalid value: " ": must not have leading or trailing whitespace

Comment 12 Arda Guclu 2022-09-28 07:29:48 UTC
I think, image debugging has already been verified;
$ oc debug
should create a debug pod with the image openshift/tools
$ oc debug --image=nginx
should create a debug pod with the image nginx

This bug is still open because of errors `oc debug dc/postgresql`. I tried to reproduce this issue and the problem seems to be fixed in newer versions;

Steps performed:
================
1) Install 4.12 cluster
2) ./oc new-project test
3) ./oc new-app rails-postgresql-example
4) privilige test namespace with correct labels
5) ./oc debug dc/postgresql
If you don't see a command prompt, try pressing enter.
sh-4.4$

I'm moving this bug to ON_QA.

Comment 14 zhou ying 2022-10-25 05:45:05 UTC
according https://bugzilla.redhat.com/show_bug.cgi?id=1920024#c8, will move to verified status .


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