Skip to content

Instantly share code, notes, and snippets.

@tobru
Created November 20, 2019 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobru/ba1cf769ba83d39245aa84865cfb4f2f to your computer and use it in GitHub Desktop.
Save tobru/ba1cf769ba83d39245aa84865cfb4f2f to your computer and use it in GitHub Desktop.
Kubernetes Config Handling in ZSH
# Kubernetes
kubec() {
export KUBECONFIG=${HOME}/.kube/config_${1}
}
_kubec() {
local configs_avail
configs_avail=(~/.kube/config_*)
for c in $configs_avail; do compadd ${$(basename $c)#"config_"}; done
}
compdef _kubec kubec
# When using oc I don't want to have a KUBECONFIG set.
# It should use the default ~/.kube/config
alias oc='unset KUBECONFIG; command oc'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment