-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makefile: Add kind-down target for deleting dev kind cluster
Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
- Loading branch information
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#! /bin/bash | ||
#!/usr/bin/env bash | ||
|
||
error() { | ||
echo "$@" 1>&2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env bash | ||
|
||
error() { | ||
echo "$@" 1>&2 | ||
exit 1 | ||
} | ||
|
||
set -eu | ||
|
||
PROJECT_ROOT="$(git rev-parse --show-toplevel)" | ||
cd "$PROJECT_ROOT" | ||
source contrib/kind/conf | ||
|
||
if ! command -v kind &>/dev/null; then | ||
error "kind is not in \$PATH! Bailing out!" | ||
fi | ||
|
||
usage() { | ||
echo "usage: delete-kind-cluster.sh [OPTIONS]" 1>&2 | ||
echo "OPTIONS:" 1>&2 | ||
echo " --cluster override cluster name" 1>&2 | ||
} | ||
|
||
while [ $# -ge 1 ]; do | ||
if [ "$1" == "--cluster" ]; then | ||
CLUSTER_NAME="$2" | ||
shift 2 | ||
else | ||
usage | ||
exit 1 | ||
fi | ||
done | ||
|
||
|
||
if ! kind get clusters | grep "$CLUSTER_NAME" &>/dev/null; then | ||
echo "Cluster $CLUSTER_NAME doesn't exist. Exiting." 1>&2 | ||
exit 0 | ||
else | ||
kind delete cluster --name "$CLUSTER_NAME" | ||
fi |