Bug 1731394

Summary: oc adm-must gather does not work if arbitrary command is passed as parameter
Product: OpenShift Container Platform Reporter: Ricardo Carrillo Cruz <ricarril>
Component: ocAssignee: Mike Dame <mdame>
Status: CLOSED ERRATA QA Contact: zhou ying <yinzhou>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.2.0CC: aos-bugs, erich, gblomqui, jokerman, mfojtik, tnozicka
Target Milestone: ---   
Target Release: 4.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-16 06:30:08 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:

Description Ricardo Carrillo Cruz 2019-07-19 10:14:46 UTC
Description of problem:

oc adm must-gather doesn work if you pass arbitrary commands

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. oc adm must-gather -- /usr/bin/gather_audit_logs


Actual results:

Fails with message:

clusterrolebinding.rbac.authorization.k8s.io/must-gather-mj2lp created
WARNING: cannot use rsync: rsync not available in container
WARNING: cannot use tar: tar not available in container
clusterrolebinding.rbac.authorization.k8s.io/must-gather-mj2lp deleted
namespace/openshift-must-gather-9d785 deleted
error: No available strategies to copy.


Expected results:

Runs without error and must-gather is created on client with logs collected by gather_audit_logs

Additional info:

Comment 1 Ricardo Carrillo Cruz 2019-07-19 10:23:31 UTC
I used gather_audit_logs in description, but other commands do not work.
We recently added gather_network_logs which is not part of 'gather' script,
thus operators are expected to pass it as parameter to 'oc adm must-gather', but
it doesn't work either:

<snip>
[ricky@ricky-laptop bz]$ oc adm must-gather --keep -- /usr/bin/gather_network_logs
namespace/openshift-must-gather-qp9cx created
clusterrolebinding.rbac.authorization.k8s.io/must-gather-xmvm5 created
WARNING: cannot use rsync: rsync not available in container
WARNING: cannot use tar: tar not available in container
error: No available strategies to copy.
[ricky@ricky-laptop bz]$ ls
[ricky@ricky-laptop bz]$ 
</snip>

Comment 3 Mike Dame 2019-08-05 19:42:41 UTC
Just checking, is this still a bug? When I run these commands on a new cluster with master build of openshift/oc I don't see those errors:

$ oc adm must-gather -- /usr/bin/gather_audit_logs
Using image: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:7a6eb094956a8d15b59600c3e6aa6745324667d1609f48c562942bb1fae7a227
namespace/openshift-must-gather-jphwr created
clusterrolebinding.rbac.authorization.k8s.io/must-gather-s9jcp created
WARNING: Collecting one or more audit logs on ALL masters in your cluster. This could take a large amount of time.
INFO: Audit logs for kube-apiserver collected.
receiving incremental file list
created directory must-gather.local.2570935630716029429
<snip>
sent 1,039 bytes  received 236,534,856 bytes  337,667.23 bytes/sec
total size is 236,473,088  speedup is 1.00
clusterrolebinding.rbac.authorization.k8s.io/must-gather-s9jcp deleted
namespace/openshift-must-gather-jphwr deleted


$ oc adm must-gather --keep -- /usr/bin/gather_network_logs
Using image: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:7a6eb094956a8d15b59600c3e6aa6745324667d1609f48c562942bb1fae7a227
namespace/openshift-must-gather-hs9hb created
clusterrolebinding.rbac.authorization.k8s.io/must-gather-pg4pd created
WARNING: Collecting network logs on ALL nodes in your cluster. This could take a large amount of time.
INFO: Waiting for node network log collection to complete ...
INFO: Node network log collection to complete.
receiving incremental file list
created directory must-gather.local.953961152312486651
<snip>
sent 491 bytes  received 574,543 bytes  127,785.33 bytes/sec
total size is 572,540  speedup is 1.00

$ ls
drwxrwxrwx.  3 mdame mdame 4.0K Aug  5 15:25 must-gather.local.2570935630716029429
drwxrwxrwx.  3 mdame mdame 4.0K Aug  5 15:38 must-gather.local.953961152312486651

Also running with a different command:
$ oc adm must-gather -- echo "foo"
Using image: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:7a6eb094956a8d15b59600c3e6aa6745324667d1609f48c562942bb1fae7a227
namespace/openshift-must-gather-crdqn created
clusterrolebinding.rbac.authorization.k8s.io/must-gather-68t7t created
foo
receiving incremental file list
./

sent 27 bytes  received 41 bytes  27.20 bytes/sec
total size is 0  speedup is 0.00
clusterrolebinding.rbac.authorization.k8s.io/must-gather-68t7t deleted
namespace/openshift-must-gather-crdqn deleted


(some repeating output snipped)

Comment 4 zhou ying 2019-08-06 06:56:31 UTC
Confirmed with payload: 4.2.0-0.nightly-2019-08-05-223032, the issue has fixed:

[root@dhcp-140-138 ~]# oc adm must-gather -- /usr/bin/gather_audit_logs
Using image: quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:26cc4ea53fc3acc6f1fd3a058d078aecca5f812bcd29e205b81422a017ed9b72
namespace/openshift-must-gather-xwg2d created
clusterrolebinding.rbac.authorization.k8s.io/must-gather-t5bl5 created
...
INFO: Audit logs for kube-apiserver collected.
receiving incremental file list
created directory must-gather.local.5425454186883091619
./
....

sent 275 bytes  received 804,953 bytes  70,019.83 bytes/sec
total size is 803,514  speedup is 1.00
clusterrolebinding.rbac.authorization.k8s.io/must-gather-t5bl5 deleted
namespace/openshift-must-gather-xwg2d deleted

Comment 5 errata-xmlrpc 2019-10-16 06:30:08 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:2922