dotfiles/home/.bin/gs-standup
Marcus Noble aae5d5791d
Updated standup/teardown
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-05-03 15:17:43 +01:00

87 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
source .utils
CODE_DIR="${HOME}/Code/GiantSwarm/cluster-standup-teardown"
OUTPUT_DIR=$(pwd)
print_usage() {
orange "gs-standup - Standup a new test workload cluster, using the cluster-test-suites modules."
echo " "
underline "Usage:"
echo "gs-standup [provider]"
echo " "
underline "Examples:"
echo "> gs-standup capa"
echo "> gs-standup eks"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo " --dir override the directory of cluster-test-suite code"
echo "-o --output override the directory the files output to"
}
POS_ARGS=()
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
--dir)
shift
CODE_DIR=$1
shift
;;
-o|--output)
shift
OUTPUT_DIR=$1
shift
;;
*)
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
go run ${CODE_DIR}/cmd/standup/main.go \
--context ${CONTEXT} \
--output ${OUTPUT_DIR}
;;
*)
print_usage
exit 1
;;
esac