From da77b066a41dc8490969623abed7444f5bf3ac41 Mon Sep 17 00:00:00 2001 From: Tessa Walsh Date: Thu, 27 Feb 2025 02:13:25 -0500 Subject: [PATCH] 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." --- btrix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/btrix b/btrix index 247a862d..5155ef92 100755 --- a/btrix +++ b/btrix @@ -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