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
|
|
|
CUR_DIR=$(pwd)
|
|
|
|
OUTPUT_DIR=${CUR_DIR}
|
2024-01-21 18:25:02 +00:00
|
|
|
|
|
|
|
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"
|
2024-02-12 08:00:25 +00:00
|
|
|
echo "-o --output override the directory the files output to"
|
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
|
|
|
-o|--output)
|
|
|
|
shift
|
|
|
|
OUTPUT_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)
|
2024-05-03 14:32:59 +00:00
|
|
|
PROVIDER=""
|
2024-01-21 18:25:02 +00:00
|
|
|
CONTEXT=""
|
|
|
|
|
|
|
|
case ${POS_ARGS[0]} in
|
|
|
|
"aws"|"capa")
|
2024-05-03 14:32:59 +00:00
|
|
|
PROVIDER="aws"
|
2024-01-21 18:25:02 +00:00
|
|
|
CONTEXT="capa"
|
|
|
|
;;
|
|
|
|
"azure"|"capz")
|
2024-05-03 14:32:59 +00:00
|
|
|
PROVIDER="azure"
|
2024-01-21 18:25:02 +00:00
|
|
|
CONTEXT="capz"
|
|
|
|
;;
|
|
|
|
"vsphere"|"capv")
|
2024-05-03 14:32:59 +00:00
|
|
|
PROVIDER="vsphere"
|
2024-01-21 18:25:02 +00:00
|
|
|
CONTEXT="capv"
|
|
|
|
;;
|
|
|
|
"cloud-director"|"capvcd")
|
2024-05-03 14:32:59 +00:00
|
|
|
PROVIDER="cloud-director"
|
2024-01-21 18:25:02 +00:00
|
|
|
CONTEXT="capvcd"
|
|
|
|
;;
|
|
|
|
"eks")
|
2024-05-03 14:32:59 +00:00
|
|
|
PROVIDER="eks"
|
2024-01-21 18:25:02 +00:00
|
|
|
CONTEXT="eks"
|
|
|
|
;;
|
|
|
|
"aws-private"|"capa-private")
|
2024-05-03 14:32:59 +00:00
|
|
|
PROVIDER="aws"
|
2024-01-21 18:25:02 +00:00
|
|
|
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/standup/main.go \
|
2024-05-03 14:32:59 +00:00
|
|
|
--provider ${PROVIDER} \
|
2024-01-21 18:25:02 +00:00
|
|
|
--context ${CONTEXT} \
|
2024-02-12 08:00:25 +00:00
|
|
|
--output ${OUTPUT_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
|