summaryrefslogtreecommitdiff
path: root/run.sh
blob: 12d91147a1d9349aee09c64a997b8283e9001416 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/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="./yaml"

YAML_FILES=( "postgres.yaml" "backend.yaml" "frontend.yaml" )

for file in "${YAML_FILES[@]}"; do
  file="$K8S_FOLDER/$file"
  echo "${command^}ing $file ..."
  envsubst < $file | kubectl "$command" -f -
done