Description of problem: - oc completion zsh doesn't auto complete Version-Release number of selected component (if applicable): - Appears to on all 4.9.z versions, tested on both macos and linux. How reproducible: - Always The issue: - Because of the first couple lines of the completion shell script appear to be incorrect: --- [root@node-0]~# oc completion zsh | head #compdef kubectl compdef _kubectl kubectl #compdef _oc oc # zsh completion for oc -*- shell-script -*- __oc_debug() { local file="$BASH_COMP_DEBUG_FILE" --- The first two lines should probably be these instead: --- #compdef oc compdef _oc oc --- This is likely because the possible inheritance of the previous versions (<4.9) of oc completion which include kubectl definition.
This bug hasn't had any activity in the last 30 days. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're marking this bug as "LifecycleStale" and decreasing the severity/priority. If you have further information on the current state of the bug, please update it, otherwise this bug can be closed in about 7 days. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. Additionally, you can add LifecycleFrozen into Whiteboard if you think this bug should never be marked as stale. Please consult with bug assignee before you do that.
Hey there, this should be fixed upstream now in the following PR and issue: https://github.com/kubernetes/kubernetes/issues/106968 https://github.com/kubernetes/kubernetes/pull/106969 The issue is still open in the oc repo as it looks to be going into v1.24: https://github.com/openshift/oc/issues/968 Info on the v1.24 milestone can be found at https://github.com/kubernetes/kubernetes/milestone/57 At one point I opened a PR to unwrap "oc completion" but did not think it would be necessary as there is a pretty simple workaround people can use in the meantime using sed to replace kubectl with oc: # Load the oc completion code for zsh[1] into the current shell source <(oc completion zsh | sed -e 's/kubectl/oc/g') # Set the oc completion code for zsh[1] to autoload on startup oc completion zsh | sed -e 's/kubectl/oc/g' > "${fpath[1]}/_oc"
This should be fixed as soon as we pull in 1.24 into oc.
In the mean time I opened 1.23 cherry-pick which will allow us to get that in updated oc in 4.10 https://github.com/kubernetes/kubernetes/pull/109235
1.24 landed in https://github.com/openshift/oc/pull/1092
[root@localhost ~]# oc version Client Version: 4.11.0-0.nightly-2022-05-26-013101 Kustomize Version: v4.5.4 [root@localhost ~]# oc completion zsh |head #compdef oc compdef _oc oc #compdef _oc oc # zsh completion for oc -*- shell-script -*- __oc_debug() { local file="$BASH_COMP_DEBUG_FILE"
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