mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-29 04:53:17 +02:00
Some checks failed
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
This reverts commit 475b18f39a.
208 lines
5.9 KiB
Bash
208 lines
5.9 KiB
Bash
if (( ! $+commands[kubectl] )); then
|
||
return
|
||
fi
|
||
|
||
# If the completion file doesn't exist yet, we need to autoload it and
|
||
# bind it to `kubectl`. Otherwise, compinit will have already done that.
|
||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_kubectl" ]]; then
|
||
typeset -g -A _comps
|
||
autoload -Uz _kubectl
|
||
_comps[kubectl]=_kubectl
|
||
fi
|
||
|
||
kubectl completion zsh 2> /dev/null >| "$ZSH_CACHE_DIR/completions/_kubectl" &|
|
||
|
||
# This command is used a LOT both below and in daily life
|
||
alias k=kubectl
|
||
|
||
# Execute a kubectl command against all namespaces
|
||
alias kca='_kca(){ kubectl "$@" --all-namespaces; unset -f _kca; }; _kca'
|
||
|
||
# Apply a YML file
|
||
alias kaf='kubectl apply -f'
|
||
|
||
# Apply a kustomization directory
|
||
alias kapk='kubectl apply -k'
|
||
|
||
# Drop into an interactive terminal on a container
|
||
alias keti='kubectl exec -t -i'
|
||
|
||
# Manage configuration quickly to switch contexts between local, dev ad staging.
|
||
alias kcuc='kubectl config use-context'
|
||
alias kcsc='kubectl config set-context'
|
||
alias kcdc='kubectl config delete-context'
|
||
alias kccc='kubectl config current-context'
|
||
|
||
# List all contexts
|
||
alias kcgc='kubectl config get-contexts'
|
||
|
||