diff options
Diffstat (limited to 'scripts/k8s')
-rwxr-xr-x | scripts/k8s | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/k8s b/scripts/k8s new file mode 100755 index 0000000..350a19a --- /dev/null +++ b/scripts/k8s @@ -0,0 +1,40 @@ +#!/bin/bash + +usage() { + echo "Usage: $0 (apply|delete)" +} + +if [ $# -ne 1 ]; then + usage + exit 1 +fi + +command=$1 + +if [ "$1" != "apply" ] && [ "$1" != "delete" ]; then + usage + exit 1 +fi + +K8S_FOLDER="../k8s" + +if [ "$(basename "$PWD")" = "backend" ]; then + K8S_FOLDER="./k8s" +fi + +YAML_FILES=( + "cas-config.yaml" + "cas-deployment.yaml" + "cas-secret.yaml" + "cas-service.yaml" + "network-policy.yaml" + "pgdata-pvc.yaml" + "postgres-deployment.yaml" + "postgres-service.yaml" +) + +for file in "${YAML_FILES[@]}"; do + file="$K8S_FOLDER/$file" + echo "${command^}ing $file ..." + envsubst < $file | kubectl "$command" -f - +done |