2024-01-21 18:25:02 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
source .utils
|
|
|
|
|
2024-05-03 14:17:43 +00:00
|
|
|
CODE_DIR="${HOME}/Code/GiantSwarm/cluster-standup-teardown"
|
2024-05-03 14:32:59 +00:00
|
|
|
CURR_DIR=$(pwd)
|
2024-05-03 14:17:43 +00:00
|
|
|
INPUT_DIR=$(pwd)
|
2024-01-21 18:25:02 +00:00
|
|
|
|
|
|
|
print_usage() {
|
|
|
|
orange "gs-teardown - Teardown a previously created test cluster"
|
|
|
|
echo " "
|
|
|
|
underline "Usage:"
|
|
|
|
echo "gs-teardown [provider]"
|
|
|
|
echo " "
|
|
|
|
underline "Examples:"
|
|
|
|
echo "> gs-teardown capa"
|
|
|
|
echo "> gs-teardown eks"
|
|
|
|
echo " "
|
|
|
|
underline "Options:"
|
|
|
|
echo "-h, --help show this help text"
|
|
|
|
echo " --dir override the directory of cluster-test-suite code"
|
2024-02-12 08:00:25 +00:00
|
|
|
echo " --in override the directory where the previously output files exist"
|
2024-01-21 18:25:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
POS_ARGS=()
|
|
|
|
|
|
|
|
while test $# -gt 0; do
|
|
|
|
case "$1" in
|
|
|
|
-h|--help)
|
|
|
|
print_usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
--dir)
|
|
|
|
shift
|
|
|
|
CODE_DIR=$1
|
|
|
|
shift
|
|
|
|
;;
|
2024-02-12 08:00:25 +00:00
|
|
|
--input)
|
|
|
|
shift
|
|
|
|
INPUT_DIR=$1
|
|
|
|
shift
|
|
|
|
;;
|
2024-01-21 18:25:02 +00:00
|
|
|
*)
|
|
|
|
POS_ARGS+=(`echo $1 | tr '/' ' '`)
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
case ${#POS_ARGS[@]} in
|
|
|
|
0)
|
|
|
|
print_usage
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
1)
|
|
|
|
CONTEXT=""
|
|
|
|
|
|
|
|
case ${POS_ARGS[0]} in
|
|
|
|
"aws"|"capa")
|
|
|
|
CONTEXT="capa"
|
|
|
|
;;
|
|
|
|
"azure"|"capz")
|
|
|
|
CONTEXT="capz"
|
|
|
|
;;
|
|
|
|
"vsphere"|"capv")
|
|
|
|
CONTEXT="capv"
|
|
|
|
;;
|
|
|
|
"cloud-director"|"capvcd")
|
|
|
|
CONTEXT="capvcd"
|
|
|
|
;;
|
|
|
|
"eks")
|
|
|
|
CONTEXT="eks"
|
|
|
|
;;
|
|
|
|
"aws-private"|"capa-private")
|
|
|
|
CONTEXT="capa-private-proxy"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2024-05-03 14:32:59 +00:00
|
|
|
cd ${CODE_DIR}
|
2024-01-21 18:25:02 +00:00
|
|
|
go run ${CODE_DIR}/cmd/teardown/main.go \
|
|
|
|
--context ${CONTEXT} \
|
2024-02-12 09:05:49 +00:00
|
|
|
--standup-directory ${INPUT_DIR}
|
2024-05-03 14:32:59 +00:00
|
|
|
cd ${CUR_DIR}
|
2024-01-21 18:25:02 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
print_usage
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|