Completion not working for `kubectl config set-context --current <namespace>`
What happened:
When using zsh-Autocompletion the autocompletion defaults to directories for
kubectl config set-context --current --namespace
What you expected to happen: The command should autocomplete with namespaces
How to reproduce it (as minimally and precisely as possible):
kubectl config set-context --current --namespace
Anything else we need to know?:
Environment:
- Kubernetes client and server versions (use
kubectl version): Client Version: v1.29.2 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.29.2 - Cloud provider or hardware configuration:
- OS (e.g:
cat /etc/os-release):
I confirm this missing functionality. This is because the kubectl config set-context command redefines its own namespace flag and we didn't add shell completion for it.
Until this is fixed, a workaround (slightly annoying) is to instead use the global --namespace flag by putting it before the set-context command:
$ kubectl config --namespace <TAB>
ns1 ns2 ns3
$ kubectl config --namespace ns2 set-context --current <ENTER>
Context "my-context" modified.
# This also works
$ kubectl config --namespace <TAB> set-context --current
ns1 ns2 ns3
/assign
/triage accepted
/retitle Completion not working for kubectl config set-context --current <namespace>
@sreeram-venkitesh would it bother you if I work on this?
@TessaIO please feel free to take this up!
/assign