-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
53 lines (41 loc) · 1.02 KB
/
deploy.sh
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
#
# Create Janus infrastructure using Google Kubernetes Engine
#
# Setup:
# `export GCP_PROJECT_ID=your_google_cloud_project_unique_id'`
#
# Run:
# `sh ./deploy cluster-node-name`
err() {
echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $@" >&2
}
compute_zone='us-central1-a'
node_name=''
project_id=''
if [ -z $GCP_PROJECT_ID ]; then
err "Please 'export GCP_PROJECT_ID=your_google_cloud_project_unique_id'"
exit 1
fi
project_id=$GCP_PROJECT_ID
if [ -z $1 ]; then
err "Please pass a cluster node name as a parameter."
exit 1
fi
node_name=$1
if ! gcloud config set project "$project_id" ; then
err "Could not set project ID to $project_id"
exit 1
fi
if ! gcloud config set compute/zone "$compute_zone" ; then
err "Could not set compute zone to $compute_zone"
exit 1
fi
if ! gcloud container clusters create "$node_name" ; then
err "Could not set create node $node_name"
exit 1
fi
if ! gcloud container clusters get-credentials "$node_name" ; then
err "Could not get credentials for node $node_name"
exit 1
fi