-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfigure.sh
More file actions
executable file
·30 lines (22 loc) · 1.26 KB
/
configure.sh
File metadata and controls
executable file
·30 lines (22 loc) · 1.26 KB
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
28
29
30
#!/usr/bin/env bash
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CLUSTER_NAME=`cat $ROOT/terraform/terraform.tfvars | grep cluster_name | awk '{print $3}' | sed -e 's/^"//' -e 's/"$//'`
PROJECT=`cat $ROOT/terraform/terraform.tfvars | grep project | awk '{print $3}' | sed -e 's/^"//' -e 's/"$//'`
echo "Checking for credentials.json in terraform directory...";
if [ ! -f "$ROOT/terraform/credentials.json" ]; then
echo "Credentials file not present! You can create one by creating a service account";
exit 1;
fi
echo "Building out environment";
(cd "$ROOT/terraform"; terraform init -input=false)
(cd "$ROOT/terraform"; terraform apply -input=false -auto-approve)
echo "Generating Kubeconfig entry for the certificate"
certificate_region=$(gcloud container clusters list | grep $CLUSTER_NAME | awk '{print $2}')
gcloud container clusters get-credentials "${CLUSTER_NAME}" --region "${certificate_region}" --project "${PROJECT}"
(cd "$ROOT/manifests/postgresql"; kubectl apply -f .)
(cd "$ROOT/manifests/nodejs"; kubectl apply -f .)
echo "Deployment Complete! Please note that the certs might take up to 20 mins to generate..."
# until [[ $(kubectl describe managedcertificate) == "" ]]; do
# echo "Waiting for cert to become available..."
# sleep 120
# done