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

Question regarding kubie ns #208

Closed
Fobhep opened this issue Jan 30, 2024 · 2 comments
Closed

Question regarding kubie ns #208

Fobhep opened this issue Jan 30, 2024 · 2 comments

Comments

@Fobhep
Copy link

Fobhep commented Jan 30, 2024

Hey - I have a question regarding the functionality of kubie ns and the validity check parameter.

I have a user that is allowed to read NS - however due to speed reasons I set validate_namespaces: false in hope that it would be faster then.

No when I type kubie ns I get the list of all namespaces offered and I wonder how kubie is doing that really.
Or rather - what exactly is kubie ns doing - if not get all namespaces and list them for me.

The odd thing is - the disabling seems to speed up the process definitely. Is an enabled validating ADDITIONALLY to getting the list of namespaces?

@Fobhep
Copy link
Author

Fobhep commented Jul 17, 2024

I think we can close this after the the great contribution from @gsstuart :)

@Fobhep Fobhep closed this as completed Jul 17, 2024
@Fobhep
Copy link
Author

Fobhep commented Jul 17, 2024

Just for reference - I mitigated the problem for myself in between by writing two functions for my zshrc:

function kns-update-cache() {
  mkdir -p "$HOME/.kube/kubectx-cache"
  kubectl get ns -o json | jq -r ' .items[] | .metadata.name' > "$HOME/.kube/kubectx-cache/$(yq -r '.current-context' $KUBECONFIG | cut -d'/' -f2)"
}

function kns() {
  cat "$HOME/.kube/kubectx-cache/$(yq -r '.current-context' $KUBECONFIG |  cut -d'/' -f2)" | fzf |  xargs -L1 -I% yq e -i '.contexts[].context.namespace = "%"' $KUBECONFIG
}

That allow me to cache Namespaces and thus speed up the call as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant