Skip to content

Commit

Permalink
Prevent btrix helper from doing anything to k8s contexts other than d…
Browse files Browse the repository at this point in the history
…ocker-desktop (#2431)

The `./btrix` development helper shouldn't be used for anything other
than local dev, which this commit helps to enforce.

When running any command, if the k8s context is anything other than
`docker-desktop` the script will now shut down immediately without doing
anything and print the message: "Attempting to modify context other than
docker-desktop not supported. Quitting."
  • Loading branch information
tw4l authored Feb 27, 2025
1 parent 6766843 commit da77b06
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions btrix
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ CONTEXT=$(cat ~/.kube/config | grep "current-context:" | sed "s/current-context:
MICROK8S="-microk8s"
WAIT="-wait"

if [ $CONTEXT != "docker-desktop" ]; then
echo "Attempting to modify context other than docker-desktop not supported. Quitting."
exit 1
fi

if [[ $1 = "setup" ]]; then
setupLocalConfig
fi
Expand Down

0 comments on commit da77b06

Please sign in to comment.