Add kubectl wrapper for convenience and safety
This commit is contained in:
parent
fff0b0016f
commit
1765917dba
2 changed files with 10 additions and 0 deletions
1
.zshrc
1
.zshrc
|
@ -259,6 +259,7 @@ alias ag='ag --pager less'
|
|||
alias cdiff='colordiff -u'
|
||||
alias dotgit='git --work-tree $HOME --git-dir $HOME/.dot_git'
|
||||
alias hs='history -a; history -n'
|
||||
alias kubectl='kubectl-wrapper'
|
||||
alias lower="tr '[:upper:]' '[:lower:]'"
|
||||
alias pstree="pstree -Auh | less"
|
||||
alias tail='tail -n $LINES'
|
||||
|
|
9
bin/kubectl-wrapper
Executable file
9
bin/kubectl-wrapper
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
cfg=.kubeconfig
|
||||
|
||||
path=$(pwd)
|
||||
while [[ "$path" != "" && ! -e "$path/$cfg" ]]; do
|
||||
path=${path%/*}
|
||||
done
|
||||
|
||||
exec env KUBECONFIG="$path/$cfg:$KUBECONFIG:$HOME/.kube/config" kubectl "$@"
|
Loading…
Reference in a new issue