Updated kube alises
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
parent
5d4a7758c0
commit
48ad89385b
@ -1,28 +1,11 @@
|
|||||||
export ZSH="$HOME/.oh-my-zsh"
|
export ZSH="$HOME/.oh-my-zsh"
|
||||||
|
|
||||||
export ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
|
|
||||||
|
|
||||||
plugins=(
|
plugins=(
|
||||||
aws
|
aws
|
||||||
zsh-syntax-highlighting
|
zsh-syntax-highlighting
|
||||||
zsh-autosuggestions
|
|
||||||
)
|
)
|
||||||
autoload -U compinit && compinit
|
autoload -U compinit && compinit
|
||||||
|
|
||||||
# This speeds up pasting w/ autosuggest
|
|
||||||
# https://github.com/zsh-users/zsh-autosuggestions/issues/238
|
|
||||||
pasteinit() {
|
|
||||||
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
|
|
||||||
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
|
|
||||||
}
|
|
||||||
pastefinish() {
|
|
||||||
zle -N self-insert $OLD_SELF_INSERT
|
|
||||||
}
|
|
||||||
zstyle :bracketed-paste-magic paste-init pasteinit
|
|
||||||
zstyle :bracketed-paste-magic paste-finish pastefinish
|
|
||||||
# https://github.com/zsh-users/zsh-autosuggestions/issues/351
|
|
||||||
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(bracketed-paste accept-line)
|
|
||||||
|
|
||||||
DISABLE_UNTRACKED_FILES_DIRTY="true"
|
DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||||
SHOW_AWS_PROMPT=false
|
SHOW_AWS_PROMPT=false
|
||||||
|
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
alias k='kubectl '
|
alias k='kubectl '
|
||||||
alias kgs='kubectl-gs '
|
|
||||||
alias kshell='kubectl run -it shell --image bash --restart Never --rm -- sh'
|
alias kshell='kubectl run -it shell --image bash --restart Never --rm -- sh'
|
||||||
|
|
||||||
kiam () {
|
|
||||||
kubectl run -it shell --image docker-tiocoreeng-apps-virtual.bts.artifactory.tio.systems/aws-cli:latest --env=AWS_DEFAULT_REGION=eu-west-1 --overrides="{ \"metadata\": { \"annotations\": { \"iam.amazonaws.com/role\": \"$1\" } } }" --command bash --restart Never --rm
|
|
||||||
}
|
|
||||||
|
|
||||||
kube-ssh() {
|
kube-ssh() {
|
||||||
sh -c "$(curl -sSL https://raw.githubusercontent.com/AverageMarcus/kube-ssh/master/ssh.sh)"
|
sh -c "$(curl -sSL https://raw.githubusercontent.com/AverageMarcus/kube-ssh/master/ssh.sh)"
|
||||||
}
|
}
|
||||||
@ -91,7 +86,55 @@ kl () {
|
|||||||
|
|
||||||
## Display everything
|
## Display everything
|
||||||
kall() {
|
kall() {
|
||||||
kubectl get all --all-namespaces
|
NAMESPACE=""
|
||||||
|
LABEL=""
|
||||||
|
ALL_NAMESPACES=false
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case "$1" in
|
||||||
|
-n|--namespace)
|
||||||
|
shift
|
||||||
|
NAMESPACE=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-l|--selector)
|
||||||
|
shift
|
||||||
|
LABEL=$1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-A|--all-namespaces)
|
||||||
|
ALL_NAMESPACES=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
echo "kall - get all Kubernetes resources matching a given label selector"
|
||||||
|
echo " "
|
||||||
|
echo "kall [options]"
|
||||||
|
echo " "
|
||||||
|
echo "Options:"
|
||||||
|
echo "-h, --help show this help text"
|
||||||
|
echo "-n, --namespace the namespace to check against"
|
||||||
|
echo "-l, --selector the label selector to match on"
|
||||||
|
echo "-A, --all-namespaces search all namespaces"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${LABEL}" == "" ]]; then
|
||||||
|
echo "Please provide a label selector to match on"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
NAMES="$(kubectl api-resources --namespaced --verbs list -o name | tr '\n' ,)"
|
||||||
|
|
||||||
|
if [ $ALL_NAMESPACES ]; then
|
||||||
|
kubectl get "${NAMES:0:-1}" --show-kind --ignore-not-found -l ${LABEL} -A
|
||||||
|
else
|
||||||
|
kubectl get "${NAMES:0:-1}" --show-kind --ignore-not-found -l ${LABEL} -n ${NAMESPACE}
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
k-version-test() {
|
k-version-test() {
|
||||||
|
Loading…
Reference in New Issue
Block a user