Prevent btrix helper from doing anything to k8s contexts other than docker-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."
This commit is contained in:
Tessa Walsh 2025-02-27 02:13:25 -05:00 committed by GitHub
parent 67668438c0
commit da77b066a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

5
btrix
View File

@ -120,6 +120,11 @@ CONTEXT=$(cat ~/.kube/config | grep "current-context:" | sed "s/current-context:
MICROK8S="-microk8s" MICROK8S="-microk8s"
WAIT="-wait" 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 if [[ $1 = "setup" ]]; then
setupLocalConfig setupLocalConfig
fi fi