Last active
February 11, 2020 08:57
-
-
Save Eun/65a916fc71e7bee48c87a2e443e11b12 to your computer and use it in GitHub Desktop.
kubesh
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/bash | |
if [ ${#@} -lt 1 ]; then | |
echo "usage: kubesh <pod> [shell]" | |
exit 1 | |
fi | |
SHELL="sh" | |
if [ ${#@} -gt 1 ]; then | |
SHELL=${@:2} | |
fi | |
kubectl exec -ti ${1} ${SHELL} |
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
# completion for kubesh | |
# (put in ~/.config/fish/completions) | |
function __kubesh_completion | |
if test -n "$__kubesh_completion_cache_valid_until"; and test $__kubesh_completion_cache_valid_until -gt (date --utc +"%s") | |
string join \n $__kubesh_completion_cache_content | |
return | |
end | |
set -g __kubesh_completion_cache_valid_until (math (date --utc +"%s") + 10) | |
set -g __kubesh_completion_cache_content (kubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}') | |
string join \n $__kubesh_completion_cache_content | |
end | |
complete -f -c kubesh -a '(__kubesh_completion)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment