FZF stores the argument number that is passed to it and I’m unable to reuse $1. The idea is to create a nested fzf so that we do not have to run kubectx
followed by kubens
to switch to correct namespace. In zsh
it sets the cluster and namespace to the same value of $1 which is the cluster.
kubectl config get-contexts -o=name | fzf --bind "enter:become((/opt/homebrew/bin/kubectl config use-context {1}) ; (/opt/homebrew/bin/kubectl get namespaces -o=name | fzf --bind 'enter:become((/opt/homebrew/bin/kubectl config set-context --current --namespace={1}))'))"