forked from GoogleCloudPlatform/anthos-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv
76 lines (70 loc) · 3.07 KB
/
env
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Base dirs
if [[ -z "$BASE_DIR" ]]; then
export BASE_DIR=$(pwd)
export WORK_DIR=$BASE_DIR/workdir
export PATH=$PATH:$WORK_DIR/bin:
echo "export BASE_DIR=\"$(pwd)\"" >> ~/.bashrc
echo "export WORK_DIR=\"$BASE_DIR/workdir\"" >> ~/.bashrc
echo "export PATH=\"$PATH\"" >> ~/.bashrc
fi
# GCP project
if [[ -z "$PROJECT" ]]; then
export PROJECT=$(gcloud config get-value project)
echo "export PROJECT=\"$(gcloud config get-value project)\"" >> ~/.bashrc
echo "gcloud config set project ${PROJECT}" >> ~/.bashrc
fi
# Tools versions
if [[ -z "$ISTIO_VERSION" ]]; then
export ISTIO_VERSION=1.1.15
export KUBECTX_VERSION=v0.7.0
export HELM_VERSION=v2.14.3
export CLUSTER_VERSION=1.13
export KOPS_VERSION=1.12.3
echo 'export ISTIO_VERSION="1.1.15"' >> ~/.bashrc
echo 'export KUBECTX_VERSION="v0.7.0"' >> ~/.bashrc
echo 'export HELM_VERSION="v2.14.3"' >> ~/.bashrc
echo 'export CLUSTER_VERSION="1.13"' >> ~/.bashrc
echo 'export KOPS_VERSION="1.12.3"' >> ~/.bashrc
fi
## Setting variables for GKE
if [[ -z "$CLUSTER_NAME" ]]; then
export CLUSTER_NAME="central"
export CLUSTER_ZONE="us-central1-b"
export CLUSTER_KUBECONFIG=$WORK_DIR/$CLUSTER_NAME.context
echo 'export CLUSTER_NAME="central"' >> ~/.bashrc
echo 'export CLUSTER_ZONE="us-central1-b"' >> ~/.bashrc
echo "export CLUSTER_KUBECONFIG=\"$WORK_DIR/$CLUSTER_NAME.context\"" >> ~/.bashrc
fi
# Variables for remote kops cluster
if [[ -z "$REMOTE_CLUSTER_NAME_BASE" ]]; then
export REMOTE_CLUSTER_NAME_BASE="remote"
export REMOTE_CLUSTER_NAME=$REMOTE_CLUSTER_NAME_BASE.k8s.local
export KOPS_STORE=gs://$PROJECT-kops-$REMOTE_CLUSTER_NAME_BASE
export REMOTE_KUBECONFIG=$WORK_DIR/remote.context
export NODE_COUNT=4
export NODE_SIZE=n1-standard-2
export ZONES=us-central1-a
export INSTANCE_IP=$(curl -s api.ipify.org)
export INSTANCE_CIDR=$INSTANCE_IP/32
echo 'export REMOTE_CLUSTER_NAME_BASE="remote"' >> ~/.bashrc
echo "export REMOTE_CLUSTER_NAME=\"$REMOTE_CLUSTER_NAME_BASE.k8s.local\"" >> ~/.bashrc
echo "export KOPS_STORE=\"gs://$PROJECT-kops-$REMOTE_CLUSTER_NAME_BASE\"" >> ~/.bashrc
echo "export REMOTE_KUBECONFIG=\"$WORK_DIR/remote.context\"" >> ~/.bashrc
echo 'export NODE_COUNT="4"' >> ~/.bashrc
echo 'export NODE_SIZE="n1-standard-2"' >> ~/.bashrc
echo 'export ZONES="us-central1-a"' >> ~/.bashrc
echo 'export INSTANCE_IP=$(curl -s api.ipify.org)' >> ~/.bashrc
echo 'export INSTANCE_CIDR=$INSTANCE_IP/32' >> ~/.bashrc
fi
# Variables for config manager
if [[ -z "$OPERATOR_YAML_LOCATION" ]]; then
export OPERATOR_YAML_LOCATION=$(gsutil cat gs://anthos-workshop/cfg-op-loc)
echo "export OPERATOR_YAML_LOCATION=\"$(gsutil cat gs://anthos-workshop/cfg-op-loc)\"" >> ~/.bashrc
fi
# Variables for istio
if [[ -z "$ISTIO_DIR" ]]; then
export ISTIO_DIR=$WORK_DIR/istio-$ISTIO_VERSION
export ISTIO_CONFIG_DIR="$BASE_DIR/hybrid-multicluster/istio"
echo "export ISTIO_DIR=\"$WORK_DIR/istio-$ISTIO_VERSION\"" >> ~/.bashrc
echo "export ISTIO_CONFIG_DIR=\"$BASE_DIR/hybrid-multicluster/istio\"" >> ~/.bashrc
fi