Skip to content

Instantly share code, notes, and snippets.

@rpetrich
Created February 23, 2019 19:02
Show Gist options
  • Save rpetrich/42bfc9dd443be85a22fae4d7d7900b4a to your computer and use it in GitHub Desktop.
Save rpetrich/42bfc9dd443be85a22fae4d7d7900b4a to your computer and use it in GitHub Desktop.
Simple kube config selector
#!/bin/bash
mkdir -p ~/.kube/
if [ -z "$1" ]; then
CURRENT=$(readlink ~/.kube/config | cut -d - -f 2-)
ls ~/Dropbox/kube* | cut -d - -f 2- | sed "s/$CURRENT\$/$CURRENT (current)/"
else
[[ -L ~/.kube/config ]] && rm ~/.kube/config
ln -s "$HOME/Dropbox/kubeconfig-$1" ~/.kube/config
rm -rf ~/.kube/cache ~/.kube/http-cache
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment