Last active
July 30, 2018 14:20
-
-
Save matheusneder/fe090b73f0e71b89eb56a35b822ae43e 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
#!/bin/bash | |
NAMESPACE=$1 | |
if [ -z $NAMESPACE ] | |
then | |
echo "Usage: $0 namespace" | |
exit 1 | |
fi | |
if ! kubectl get namespace | grep $NAMESPACE > /dev/null 2>&1 | |
then | |
echo "Namespace '$NAMESPACE' not found" >> /dev/stderr | |
exit 1 | |
fi | |
kubectl config set-context $(kubectl config current-context) --namespace=$NAMESPACE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment