Bug 1389208 - Lost suggestion to use describe to obtain container names in several commands
Summary: Lost suggestion to use describe to obtain container names in several commands
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 3.4.0
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: 4.1.0
Assignee: Maciej Szulik
QA Contact: XiaochuanWang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-27 07:59 UTC by XiaochuanWang
Modified: 2019-06-04 10:40 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-06-04 10:40:18 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:0758 None None None 2019-06-04 10:40:28 UTC

Description XiaochuanWang 2016-10-27 07:59:59 UTC
Description of problem:
Required by PR#10360
Some commands using one of containers need to suggest user `oc describe` to check multiple containers.

Version-Release number of selected component (if applicable):
oc v3.4.0.16+cc70b72

How reproducible:
Always

Steps to Reproduce:
1. oc create -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/deployment/dc-with-two-containers.yaml

2. (to compare:) oc exec dctest-1-n9unp -- date
Defaulting container name to dctest-1.
Use 'oc describe pod/dctest-1-n9unp' to see all of the containers in this pod.
Thu Oct 27 06:57:43 UTC 2016

3. Try following commands:
oc rsh dctest-1-n9unp date
oc rsync  /home/xiaocwan/tmp/tmp dctest-2-28d8s:/tmp (need to update image for 1st container: aosqe/scratch:tarrsync)
oc logs -f pod/dctest-1-n9unp
oc debug dctest-1-n9unp
oc attach dctest-1-n9unp


Actual results:
3. # oc rsh dctest-1-n9unp date
Defaulting container name to dctest-1.
Thu Oct 27 06:55:16 UTC 2016

# oc rsync /home/xiaocwan/tmp/tmp dctest-2-28d8s:/tmp   (need to update image for 1st container: aosqe/scratch:tarrsync)
sending incremental file list
tmp/
tmp/test
sent 93 bytes  received 35 bytes  19.69 bytes/sec
total size is 0  speedup is 0.00
Defaulting container name to dctest-1.

# oc logs -f pod/dctest-1-n9unp
Error from server: a container name must be specified for pod dctest-1-n9unp, choose one of: [dctest-1 dctest-2]

# oc debug dctest-1-n9unp
Debugging with pod/dctest-1-n9unp-debug, original command: <image entrypoint>
Waiting for pod to start ...
Pod IP: 10.1.2.54
If you don't see a command prompt, try pressing enter.
sh-4.2$

# oc attach dctest-1-n9unp 
If you don't see a command prompt, try pressing enter.

Expected results:
3. Should suggest user to use 'oc describe <pod>' to obtain container names


Additional info:

Comment 1 XiaochuanWang 2017-12-12 07:58:03 UTC
This is still reproduced on OCP 3.7.14 now:

Pod with multiple containers is failed to sync file from container, but single container pod could.

Created /tmp/test.txt in pod "dctest-1-lh0mf", container 1 "dctest-1" and then do:
[xiaocwan@dhcp-141-172 aaa]$ oc rsync -c dctest-1 dctest-1-lh0mf:/tmp/test.txt /home/xiaocwan/tmp/aaa/
WARNING: cannot use rsync: rsync not available in container
WARNING: cannot use tar: tar not available in container
error: No available strategies to copy.


So as to oc attach <multi-container-pod>, it doesn't show which container it uses:
$ oc attach dctest-1-lh0mf
If you don't see a command prompt, try pressing enter.
Started, serving at 8080

Comment 2 XiaochuanWang 2017-12-21 05:25:18 UTC
oc debug also reproduces on OCP 3.7, there should be a "oc describe" indication and a current running container

$ oc debug dctest-1-btzvk
Debugging with pod/dctest-1-btzvk-debug, original command: /hello-openshift
Waiting for pod to start ...
Pod IP: 10.128.0.65
If you don't see a command prompt, try pressing enter.
sh-4.2$

Comment 3 Juan Vallejo 2018-01-18 23:37:14 UTC
Origin PR: https://github.com/openshift/origin/pull/18178

Comment 4 XiaochuanWang 2018-02-08 06:19:43 UTC
Tested on v3.9.0-0.41.0

pod with multiple containers does suggest the way to get a container by `oc rsh` 

$ oc rsh dctest-1-jqv8b
Defaulting container name to dctest-1.
Use 'oc describe pod/dctest-1-jqv8b -n xiaocwan-t' to see all of the containers in this pod.

However, not all command in step 3(Try following commands) also needs the clear suggestion message such as:
$ oc rsync /home/xiaocwan/tmp/tmp dctest-1-jqv8b:/tmp
WARNING: cannot use rsync: rsync not available in container
rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: container_linux.go:247: starting container process caused \"exec: \\\"tar\\\": executable file not found in $PATH\"\n"
WARNING: cannot use tar: tar not available in container
error: No available strategies to copy.

Could you please help to update them as well, thanks!

Comment 5 Xingxing Xia 2018-06-01 08:29:27 UTC
Looks like the code in comment 3 doesn't check pod container number=1 or >1.
Test result of oc v3.10.0-0.54.0 for pod that only has 1 container:
$ oc debug pod/ruby-ex-1-4gxnf -t
Defaulting container name to ruby-ex.
Use 'oc describe pod/ruby-ex-1-4gxnf-debug -n xxia-proj' to see all of the containers in this pod.
...

It should not give the suggestion when there is only 1 container

Comment 7 Maciej Szulik 2019-02-26 11:28:04 UTC
This was fixed in https://github.com/openshift/origin/pull/21997 moving to qa.

Comment 8 XiaochuanWang 2019-02-27 02:57:32 UTC
Most commands are fixed on oc v4.0.2 as below but miss one:

$ oc exec dctest-1-xd462 -- date
Defaulting container name to dctest-1.
Use 'oc describe pod/dctest-1-xd462 -n xiaocwan-t' to see all of the containers in this pod.
Wed Feb 27 02:42:07 UTC 2019

$  oc rsh dctest-1-xd462 date
Defaulting container name to dctest-1.
Use 'oc describe pod/dctest-1-xd462 -n xiaocwan-t' to see all of the containers in this pod.
Wed Feb 27 02:44:41 UTC 2019


$ oc rsync /home/xiaocwan/tmp/tmp dctest-2-6kv5t:/tmp/
sending incremental file list
tmp/

sent 45 bytes  received 19 bytes  18.29 bytes/sec
total size is 0  speedup is 0.00
Defaulting container name to dctest-1.
Use 'oc describe pod/dctest-2-6kv5t -n xiaocwan-t' to see all of the containers in this pod.


$ oc debug dctest-2-6kv5t
Defaulting container name to dctest-1.
Use 'oc describe pod/dctest-2-6kv5t-debug -n xiaocwan-t' to see all of the containers in this pod.

$ oc attach dctest-2-6kv5t
Defaulting container name to dctest-1.
Use 'oc describe pod/ -n xiaocwan-t' to see all of the containers in this pod.
If you don't see a command prompt, try pressing enter.
running ....



Only left one command:
$  oc logs -f dctest-2-6kv5t
Error from server (BadRequest): a container name must be specified for pod dctest-2-6kv5t, choose one of: [dctest-1 dctest-2]

So is this one by design?

Comment 10 Maciej Szulik 2019-04-24 13:54:42 UTC
> So is this one by design?

Yes, the remaining commands have a different logic underneath it, also with recent in kubectl (might not be in oc, yet) changes we'll nicely allow logs from multiple containers. 

Moving back to qa.

Comment 11 XiaochuanWang 2019-05-06 06:48:22 UTC
Comment 8 is well explained and could be accepted by user, it could be Verified by 4.1 
Thank you all!

Comment 13 errata-xmlrpc 2019-06-04 10:40:18 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:0758


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