Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion not working for kubectl config set-context --current <namespace> #1564

Open
jheyduk opened this issue Feb 21, 2024 · 7 comments · May be fixed by kubernetes/kubernetes#124994
Open
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@jheyduk
Copy link

jheyduk commented Feb 21, 2024

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):
@jheyduk jheyduk added the kind/bug Categorizes issue or PR as related to a bug. label Feb 21, 2024
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Feb 21, 2024
@marckhouzam
Copy link
Member

marckhouzam commented Feb 22, 2024

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

@sreeram-venkitesh
Copy link
Member

/assign

@mpuckett159
Copy link
Contributor

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 29, 2024
@sftim
Copy link
Contributor

sftim commented Apr 23, 2024

/retitle Completion not working for kubectl config set-context --current <namespace>

@k8s-ci-robot k8s-ci-robot changed the title Completion not working for kubectl config set-context --current namespace Completion not working for kubectl config set-context --current <namespace> Apr 23, 2024
@TessaIO
Copy link
Contributor

TessaIO commented May 18, 2024

@sreeram-venkitesh would it bother you if I work on this?

@sreeram-venkitesh
Copy link
Member

@TessaIO please feel free to take this up!

@TessaIO
Copy link
Contributor

TessaIO commented May 20, 2024

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants