-
Notifications
You must be signed in to change notification settings - Fork 0
/
prod_cluster.sh
80 lines (60 loc) · 1.78 KB
/
prod_cluster.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -xe
echo "Today is " `date`
echo -e "\nEnter a Region/LOCATION name"
read LOCATION
echo -e "\nEnter a cluster name"
read CLUSTER
echo -e "\nEnter the ResourceGroup"
read RESOURCEGROUP
echo -e "\nEnter a Cluster version"
read VERSION
echo -e "\n Your cluster will be created in $LOCATION region, ResourceGroup $RESOURCEGROUP, with version $VERSION and the Cluster name will be: $CLUSTER"
echo "Creating Resource Group"
az group create \
--name $RESOURCEGROUP \
--location $LOCATION
if [ $? -ne 0 ]; then
echo "Error occurred."
fi
echo -e "\n==================================================================="
echo "Creating VNET"
az network vnet create \
--resource-group $RESOURCEGROUP \
--name aro-vnet \
--address-prefixes 10.0.0.0/22
if [ $? -ne 0 ]; then
echo "Error occurred."
fi
echo -e "\n ==================================================================="
echo "Creating Master Subnet"
az network vnet subnet create \
--resource-group $RESOURCEGROUP \
--vnet-name aro-vnet \
--name master-subnet \
--address-prefixes 10.0.0.0/23
if [ $? -ne 0 ]; then
echo "Error occurred."
fi
echo -e "\n ==================================================================="
echo -e "\nCreating Worker Subnet"
az network vnet subnet create \
--resource-group $RESOURCEGROUP \
--vnet-name aro-vnet \
--name worker-subnet \
--address-prefixes 10.0.2.0/23
if [ $? -ne 0 ]; then
echo "Error occurred."
fi
echo -e "\n==================================================================="
echo -e "\nCreating a Public API visibility cluster with version $VERSION"
az aro create \
--resource-group $RESOURCEGROUP \
--name $CLUSTER \
--vnet aro-vnet \
--master-subnet master-subnet \
--worker-subnet worker-subnet \
--version $VERSION
if [ $? -ne 0 ]; then
echo "Error occurred."
fi