dotfiles/home/.bin/gs-standup

100 lines
2.0 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env bash
source .utils
CODE_DIR="${HOME}/Code/GiantSwarm/cluster-test-suites"
CUR_DIR=$(pwd)
OUTPUT_DIR=${CUR_DIR}
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)
PROVIDER=""
CONTEXT=""
case ${POS_ARGS[0]} in
"aws"|"capa")
PROVIDER="aws"
CONTEXT="capa"
;;
"azure"|"capz")
PROVIDER="azure"
CONTEXT="capz"
;;
"vsphere"|"capv")
PROVIDER="vsphere"
CONTEXT="capv"
;;
"cloud-director"|"capvcd")
PROVIDER="cloud-director"
CONTEXT="capvcd"
;;
"eks")
PROVIDER="eks"
CONTEXT="eks"
;;
"aws-private"|"capa-private")
PROVIDER="aws"
CONTEXT="capa-private-proxy"
;;
esac
cd ${CODE_DIR}
go run ${CODE_DIR}/cmd/standup/main.go \
--provider ${PROVIDER} \
--context ${CONTEXT} \
--cluster-values ${CODE_DIR}/providers/${CONTEXT}/standard/test_data/cluster_values.yaml \
--default-apps-values ${CODE_DIR}/providers/${CONTEXT}/standard/test_data/default-apps_values.yaml \
--output ${OUTPUT_DIR}
cd ${CUR_DIR}
;;
*)
print_usage
exit 1
;;
esac