Bug 1707833

Summary: Support -f flag for oc rsh
Product: OpenShift Container Platform Reporter: Maciej Szulik <maszulik>
Component: ocAssignee: Sally <somalley>
Status: CLOSED DUPLICATE QA Contact: Xingxing Xia <xxia>
Severity: low Docs Contact:
Priority: medium    
Version: 4.1.zCC: aos-bugs, erich, gblomqui, jokerman, mfojtik, mmccomas
Target Milestone: ---   
Target Release: 4.4.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: 2020-02-26 19:38:17 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:

Description Maciej Szulik 2019-05-08 14:03:07 UTC
Currently you need to explicitly pass pod name to connect to when invoking oc rsh. Upstream updated kubectl exec [1] to work with resource/name format. We want to go one step further and support -f which reads a resource from a file and work against it. For that we need to update ExecOptions (core of kubectl exec) which is then used inside oc rsh.

[1] https://github.com/kubernetes/kubernetes/pull/73664

Comment 2 Maciej Szulik 2019-09-25 08:24:31 UTC
This will be fixed with k8s 1.16 bump from https://github.com/openshift/oc/pull/102

Comment 3 Michal Fojtik 2019-09-30 08:58:33 UTC
The 1.16 landed in oc, moving to QA

Comment 5 Xingxing Xia 2019-10-14 10:05:05 UTC
Unpack oc from latest http://download-node-02.eng.bos.redhat.com/rcm-guest/puddles/RHAOS/AtomicOpenShift/4.3/v4.3.0-201910140317_2019-10-14.2/x86_64/os/Packages/ openshift-clients-4.3.0-201910101400.git.1.fe72907.el7.x86_64.rpm and check, no -f flag:
$ ./oc version -o yaml
clientVersion:
  buildDate: "2019-10-10T18:03:00Z"
  compiler: gc
  gitCommit: b6f4792b69cc6cb9d07f8ba88e73831c8a8fc470
  gitTreeState: clean
  gitVersion: v4.3.0
  goVersion: go1.12.8
  major: ""
  minor: ""
  platform: linux/amd64
$ ./oc rsh -f ~/my/pod.yaml
Error: unknown shorthand flag: 'f' in -f
...

Comment 6 Xingxing Xia 2019-10-14 10:12:02 UTC
PS: above oc of commit b6f4792 included the fix PR oc/pull/102:
$ cd /data/src/github.com/openshift/oc
$ git pull
$ git log --date=local b6f4792 --pretty="%h %an %cd - %s" | grep "#102"
5266406df OpenShift Merge Robot Thu Sep 26 18:19:06 2019 - Merge pull request #102 from soltysh/oc-4.3-kubernetes-1.16.0-rc.2

Comment 7 Sally 2019-11-26 21:10:01 UTC
The upstream change of `Upstream updated kubectl exec to work with resource/name format` is what was picked up with k8s 1.16 bump.  The additional desired change of allowing to pass a '-f filename' will be an additional upstream PR, I'm moving this bug to 4.4, since the upstream PR will be required.

Comment 9 Maciej Szulik 2020-02-26 19:38:17 UTC

*** This bug has been marked as a duplicate of bug 1801292 ***