25 lines
1.1 KiB
Plaintext
25 lines
1.1 KiB
Plaintext
# cka-sim shell setup. Sourced automatically by the terminal in ./exam web,
|
|
# and safe to source yourself: source ./examrc
|
|
[ -f ~/.bashrc ] && . ~/.bashrc
|
|
|
|
# kubectl at the Kubernetes version of the cluster your latest session ran on, ahead of your own:
|
|
# ./exam keeps .state/kubectl/current pointing at it (CKA/CKS v1.35, CKAD v1.37), as the real exams
|
|
# give you a kubectl that matches the cluster. Without ./setup.sh's download it is your own kubectl.
|
|
_cka_kubectl="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.state/kubectl/current"
|
|
case ":$PATH:" in *":$_cka_kubectl:"*) ;; *) export PATH="$_cka_kubectl:$PATH" ;; esac
|
|
unset _cka_kubectl
|
|
|
|
alias k=kubectl
|
|
export do='--dry-run=client -o yaml' # k create deploy x --image=nginx $do > x.yaml
|
|
export now='--force --grace-period 0' # k delete pod x $now
|
|
export KUBE_EDITOR="${KUBE_EDITOR:-vi}"
|
|
|
|
# completion, including for the alias
|
|
source <(kubectl completion bash) 2>/dev/null
|
|
complete -o default -F __start_kubectl k 2>/dev/null
|
|
|
|
# vim defaults that make pasted YAML behave
|
|
if [ ! -f ~/.vimrc ]; then
|
|
printf 'set tabstop=2\nset expandtab\nset shiftwidth=2\n' > ~/.vimrc
|
|
fi
|