@@ -58,6 +58,11 @@ if [ "$#" -lt $CONTROL_PLANE_REPLICAS ]; then
58
58
exit 1
59
59
fi
60
60
61
+ if [ " $CONTROL_PLANE_REPLICAS " != 1 ] && [ " $CONTROL_PLANE_REPLICAS " != 3 ] && [ " $CONTROL_PLANE_REPLICAS " != 5 ]; then
62
+ echo " Number of control plane replicas can only be 1, 3, or 5."
63
+ exit 1
64
+ fi
65
+
61
66
server_exec () {
62
67
ssh -oStrictHostKeyChecking=no -p 22 " $1 " " $2 " ;
63
68
}
@@ -157,7 +162,7 @@ function setup_workers() {
157
162
setup_vhive_firecracker_daemon $node
158
163
fi
159
164
160
- if [ $2 -eq " MASTER" ]; then
165
+ if [ " $2 " = " MASTER" ]; then
161
166
server_exec $node " sudo ${MASTER_LOGIN_TOKEN} "
162
167
echo " Backup master node $node has joined the cluster."
163
168
else
@@ -170,12 +175,12 @@ function setup_workers() {
170
175
echo " Stretching node capacity for $node ."
171
176
server_exec $node " echo \" maxPods: ${PODS_PER_NODE} \" > >(sudo tee -a /var/lib/kubelet/config.yaml >/dev/null)"
172
177
server_exec $node " echo \" containerLogMaxSize: 512Mi\" > >(sudo tee -a /var/lib/kubelet/config.yaml >/dev/null)"
173
- server_exec $node ' sudo systemctl restart kubelet'
178
+ server_exec $node ' sudo systemctl daemon-reload && sudo systemctl restart kubelet'
174
179
server_exec $node ' sleep 10'
175
180
176
181
# Rejoin has to be performed although errors will be thrown. Otherwise, restarting the kubelet will cause the node unreachable for some reason
177
182
178
- if [ $2 -eq " MASTER" ]; then
183
+ if [ " $2 " = " MASTER" ]; then
179
184
server_exec $node " sudo ${MASTER_LOGIN_TOKEN} > /dev/null 2>&1"
180
185
echo " Backup master node $node joined the cluster (again :P)."
181
186
else
@@ -187,13 +192,14 @@ function setup_workers() {
187
192
NODE_COUNTER=1
188
193
for node in " $@ "
189
194
do
190
- # Set up API Server load balancer arguments
195
+ # Set up API Server load balancer arguments - Less than because 1 CP is the "main" master node already
191
196
HA_SETTING=" "
192
- if [ " $NODE_COUNTER " -le $CONTROL_PLANE_REPLICAS ]; then
197
+ if [ " $NODE_COUNTER " -lt $CONTROL_PLANE_REPLICAS ]; then
193
198
HA_SETTING=" MASTER"
194
199
fi
195
200
196
201
internal_setup " $node " $HA_SETTING &
202
+ let NODE_COUNTER++
197
203
done
198
204
199
205
wait
@@ -285,7 +291,7 @@ function copy_k8s_certificates() {
285
291
namespace_info=$( server_exec $MASTER_NODE " kubectl get namespaces" )
286
292
done
287
293
288
- echo " Master node $MASTER_NODE finalised ."
294
+ echo " Master node $MASTER_NODE finalized ."
289
295
290
296
# Copy API server certificates from master to each worker node
291
297
copy_k8s_certificates " $@ "
0 commit comments