Created
August 3, 2016 17:46
-
-
Save scholzie/5261e391b4219dffc7bda13877bab686 to your computer and use it in GitHub Desktop.
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
function kdump() { | |
if [[ $# -ne 0 ]]; then | |
ACTION="$1" | |
else | |
ACTION="get" | |
fi | |
echo "==== DUMPING KLUSTER INFO VIA ACTION: ${ACTION} ====" | |
if [[ "$ACTION" == "get" ]]; then | |
for cmd in $(kubectl get 2>&1 | awk '/\*/ {print $2}'); do | |
echo " === get ${cmd} (all-namespaces) ===" | |
kubectl get ${cmd} --all-namespaces 2> /dev/null | |
if [[ $? -ne 0 ]]; then | |
echo " === get ${cmd} (not-namespaced) ===" | |
kubectl get ${cmd} | |
fi | |
done | |
elif [[ "$ACTION" == "describe" ]]; then | |
for cmd in $(kubectl describe 2>&1 | awk '/\*/ {print $2}'); do | |
echo " === describe ${cmd}: ===" | |
kubectl describe ${cmd} | |
done | |
else | |
echo "NO ACTION $ACTION DEFINED!" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment