File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,8 @@ for i in $(seq $start_index $end_index); do
7171 docker cp $TEMPLATE_NODE_NAME :/kind/kubeadm.conf kubeadm-$i .conf > /dev/null 2>&1
7272
7373 # Replace the container role name with specific node name in the kubeadm file
74- sed -i " s/$TEMPLATE_NODE_NAME $/$NEW_NODE_NAME /g" " ./kubeadm-$i .conf"
74+ sed -i.bak " s/$TEMPLATE_NODE_NAME $/$NEW_NODE_NAME /g" " ./kubeadm-$i .conf"
75+ rm -f " ./kubeadm-$i .conf.bak"
7576
7677 IMAGE=$( docker ps | grep $CLUSTER_NAME | awk ' {print $2}' | head -1)
7778
@@ -84,8 +85,24 @@ for i in $(seq $start_index $end_index); do
8485 --detach --tty --label io.x-k8s.kind.cluster=$CLUSTER_NAME --net kind \
8586 --restart=on-failure:1 --init=false $IMAGE > /dev/null 2>&1
8687
88+ # wait for cgroupv2 initialization before docker exec
89+ wait_count=0
90+ while [ $wait_count -lt 30 ]; do
91+ status=$( docker exec $NEW_NODE_NAME systemctl is-system-running 2> /dev/null || true)
92+ if [[ " $status " == " running" ]]; then
93+ break
94+ fi
95+ sleep 2
96+ wait_count=$(( wait_count + 1 ))
97+ done
98+ status=$( docker exec $NEW_NODE_NAME systemctl is-system-running 2> /dev/null || true)
99+ if [[ $wait_count -ge 30 ]] && [ " $status " != " running" ]; then
100+ echo " Container $NEW_NODE_NAME failed to initialize systemd"
101+ echo " Review $NEW_NODE_NAME logs and remove container"
102+ exit 1
103+ fi
87104 docker cp kubeadm-$i .conf $NEW_NODE_NAME :/kind/kubeadm.conf > /dev/null 2>&1
88105 docker exec --privileged $NEW_NODE_NAME kubeadm join --config /kind/kubeadm.conf --skip-phases=preflight --v=6 > /dev/null 2>&1
89106 rm -f kubeadm-* .conf
90107 echo " Done!"
91- done
108+ done
You can’t perform that action at this time.
0 commit comments