-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathcreate-pool-edgelb-all.sh
executable file
·86 lines (85 loc) · 2.4 KB
/
create-pool-edgelb-all.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
80
81
82
83
84
85
86
clusters=$1
publicnodes=$(dcos node --json | jq --raw-output ".[] | select((.type | test(\"agent\")) and (.attributes.public_ip != null)) | .id" | wc -l | awk '{ print $1 }')
cat <<EOF > pool-edgelb-all.json
{
"apiVersion":"V2",
"name":"all",
"namespace":"infra/network/dcos-edgelb/pools",
"count":${publicnodes},
"autoCertificate":true,
"haproxy":{
"stats":{
"bindPort":9090
},
"frontends":[
{
"bindPort":8443,
"protocol":"HTTPS",
"certificates":[
"\$AUTOCERT"
],
"linkBackend":{
"map":[
{
"hostEq":"infra.storage.portworx.mesos.lab",
"backend":"infra-storage-portworx"
},
EOF
awk -v clusters=${clusters} 'BEGIN { for (i=1; i<=clusters; i++) printf("%02d\n", i) }' | while read i; do
cat <<EOF >> pool-edgelb-all.json
{
"hostEq":"training.prod.k8s.cluster${i}.mesos.lab",
"backend":"training-prod-k8s-cluster${i}-backend"
}
EOF
if [ $i -ne $clusters ]; then
printf "," >> pool-edgelb-all.json
fi
done
cat <<EOF >> pool-edgelb-all.json
]
}
}
],
"backends":[
{
"name":"infra-storage-portworx",
"protocol":"HTTP",
"services":[
{
"endpoint":{
"type":"ADDRESS",
"address":"lighthouse-0-start.infrastorageportworx.autoip.dcos.thisdcos.directory",
"port":8085
}
}
]
},
EOF
awk -v clusters=${clusters} 'BEGIN { for (i=1; i<=clusters; i++) printf("%02d\n", i) }' | while read i; do
cat <<EOF >> pool-edgelb-all.json
{
"name":"training-prod-k8s-cluster${i}-backend",
"protocol":"HTTPS",
"services":[
{
"mesos":{
"frameworkName":"training/prod/k8s/cluster${i}",
"taskNamePattern":"kube-control-plane"
},
"endpoint":{
"portName":"apiserver"
}
}
]
}
EOF
if [ $i -ne $clusters ]; then
printf "," >> pool-edgelb-all.json
fi
done
cat <<EOF >> pool-edgelb-all.json
]
}
}
EOF