dotfiles/home/.bin/kind-delete-cluster
Marcus Noble 5650fc8fdb
Added kind helpers
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-09-01 16:44:24 +01:00

32 lines
749 B
Bash
Executable File

#!/usr/bin/env bash
source .utils
# Force using the `go install` version as we need to pin to 0.19 for now
alias kind=$GOPATH/bin/kind
CONTEXT_NAME=$(kubectl config current-context | sed -e "s/kind-//")
kind --version | grep "0.19." > /dev/null
if [[ "$?" != "0" ]]; then
echo "Kind v0.19.0 is required"
exit 1
fi
print_usage() {
orange "kind-delete-cluster - delete a Kind cluster"
echo " "
underline "Usage:"
echo "kind-delete-cluster [cluster-name]"
echo " "
echo "If no cluster-name is provided it will attempt to get it from the current kubectl context"
echo " "
underline "Options:"
echo "-h, --help show this help text"
}
# Positional args
NAME=${1:-${CONTEXT_NAME}}
kind delete cluster --name ${NAME}