From f665163ee9de7d850c7859a8027d860739feda59 Mon Sep 17 00:00:00 2001 From: Joaquin Date: Mon, 15 Apr 2024 11:43:45 +0300 Subject: [PATCH] add uninstall script --- uninstall.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 uninstall.sh diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..b034d3f --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -eoa pipefail + +SCRIPT_DIR=$(dirname "$(readlink -f "$0")") +PLATFORM_DIR="$SCRIPT_DIR/.platform" +PLATFORM_CONFIG="$PLATFORM_DIR/.config" + +# check if the platform directory exists +if [ -d "$PLATFORM_DIR" ]; then + # source the configuration file + source $PLATFORM_CONFIG +else + echo "The platform directory not found: $PLATFORM_DIR" + echo "Please run the setup.sh script first, or check the 'Manual deletion' section in the setup.md for manual deletion of the platform." + exit 1 +fi + +# Delete the cluster +kind delete cluster --name $CLUSTER_NAME + +if [ "$INSTALL_LOCAL_REGISTRY" = "true" ]; then + # Delete the local Docker registry + echo "Deleting the local Docker registry..." + docker stop kind-registry + docker rm kind-registry + echo "Local Docker registry deleted." +fi + +rm -rf "$PLATFORM_DIR" + +echo "The platform has been successfully uninstalled." +exit 0