Created
November 20, 2019 09:41
-
-
Save tobru/ba1cf769ba83d39245aa84865cfb4f2f to your computer and use it in GitHub Desktop.
Kubernetes Config Handling in ZSH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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