-
-
Save larte/acc874f62ac78c0962c840798ec00216 to your computer and use it in GitHub Desktop.
Kubernetes execute shell wrapper
This file contains 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
#compdef ksh | |
# command completion for zsh | |
typeset -A opt_args | |
_arguments -C \ | |
'1:pod:->pods' \ | |
'*:: :->args' \ | |
&& ret=0 | |
case "$state" in | |
(pods) | |
local pods; pods=( | |
`kubectl get po --no-headers -o=custom-columns=Name:.metadata.name` | |
) | |
_describe -t pods 'pod' pods && ret=0 | |
;; | |
(args) | |
local options; options=( | |
'--namespace=' | |
'--container=' | |
) | |
_describe -t options 'options' options && ret=0 | |
;; | |
esac; | |
return 1 |
This file contains 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
#!/bin/sh | |
COLUMNS=`tput cols` | |
LINES=`tput lines` | |
TERM=xterm | |
KUBE_SHELL=${KUBE_SHELL:-bash} | |
POD=$1 | |
shift | |
kubectl exec -it $POD "$@" -- env COLUMNS=$COLUMNS LINES=$LINES TERM=$TERM "$KUBE_SHELL" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment