@@ -31,6 +31,7 @@ KUSTOMIZE="${REPO_ROOT}/hack/tools/bin/kustomize"
31
31
make --directory=" ${REPO_ROOT} " " ${KUBECTL##*/ } " " ${HELM##*/ } " " ${KIND##*/ } " " ${KUSTOMIZE##*/ } "
32
32
KIND_CLUSTER_NAME=" ${KIND_CLUSTER_NAME:- capz} "
33
33
WORKER_MACHINE_COUNT=" ${WORKER_MACHINE_COUNT:- 2} "
34
+ EXTRA_NODES=" ${EXTRA_NODES:- 0} "
34
35
export KIND_CLUSTER_NAME
35
36
# export the variables so they are available in bash -c wait_for_nodes below
36
37
export KUBECTL
@@ -214,6 +215,22 @@ wait_for_pods() {
214
215
done
215
216
}
216
217
218
+ # wait_for_extra_nodes accommodates building large clusters gradually
219
+ wait_for_extra_nodes () {
220
+ local existing_nodes=" ${WORKER_MACHINE_COUNT} "
221
+ local remaining_extra_nodes=" ${EXTRA_NODES} "
222
+ while [[ " ${remaining_extra_nodes} " -gt 10 ]]; do
223
+ NEW_REPLICA_COUNT=$(( existing_nodes + 10 ))
224
+ " ${KUBECTL} " --kubeconfig " ${REPO_ROOT} /${KIND_CLUSTER_NAME} .kubeconfig" scale machinedeployment/" ${CLUSTER_NAME} " -md-0 --replicas=" ${NEW_REPLICA_COUNT} "
225
+ sleep 120
226
+ existing_nodes=$(( existing_nodes + 10 ))
227
+ remaining_extra_nodes=$(( remaining_extra_nodes - 10 ))
228
+ done
229
+ NEW_REPLICA_COUNT=$(( existing_nodes + remaining_extra_nodes))
230
+ " ${KUBECTL} " --kubeconfig " ${REPO_ROOT} /${KIND_CLUSTER_NAME} .kubeconfig" scale machinedeployment/" ${CLUSTER_NAME} " -md-0 --replicas=" ${NEW_REPLICA_COUNT} "
231
+ sleep 120
232
+ }
233
+
217
234
install_addons () {
218
235
export -f copy_kubeadm_config_map wait_for_copy_kubeadm_config_map
219
236
timeout --foreground 600 bash -c wait_for_copy_kubeadm_config_map
@@ -224,6 +241,8 @@ install_addons() {
224
241
timeout --foreground 1800 bash -c wait_for_nodes
225
242
export -f wait_for_pods
226
243
timeout --foreground 1800 bash -c wait_for_pods
244
+ export -f wait_for_extra_nodes
245
+ timeout --foreground 10800 bash -c wait_for_pods
227
246
}
228
247
229
248
copy_secret () {
0 commit comments