Skip to content

Commit 8f02111

Browse files
committed
fix: ensure mounted disk are all up
1 parent 91baabd commit 8f02111

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

node/cloud-init.yaml.tpl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,20 @@ runcmd:
281281
- /usr/local/bin/install-or-upgrade-rke2.sh
282282
- echo 'alias crictl="sudo /var/lib/rancher/rke2/bin/crictl -r unix:///run/k3s/containerd/containerd.sock"' >> /home/${system_user}/.bashrc
283283
- echo 'alias ctr="sudo /var/lib/rancher/rke2/bin/ctr --address /run/k3s/containerd/containerd.sock --namespace k8s.io"' >> /home/${system_user}/.bashrc
284+
- >
285+
for MNT in /mnt; do
286+
RETRIES=0; MAX_RETRIES=30;
287+
until mountpoint -q "$MNT"; do
288+
RETRIES=$((RETRIES + 1));
289+
if [ $RETRIES -ge $MAX_RETRIES ]; then
290+
echo "ERROR: $MNT not mounted after $MAX_RETRIES retries.";
291+
exit 1;
292+
fi;
293+
echo "$MNT not mounted yet, retrying in 10 seconds...";
294+
sleep 5;
295+
done;
296+
echo "$MNT mounted successfully.";
297+
done;
284298
%{~ if is_server ~}
285299
- systemctl restart systemd-modules-load.service # ensure ipvs is loaded
286300
- echo 'alias kubectl="sudo /var/lib/rancher/rke2/bin/kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml"' >> /home/${system_user}/.bashrc

0 commit comments

Comments
 (0)