Skip to content

Commit 4f04eb7

Browse files
chore(join): Limit join retry attempts (#118)
1 parent a30c352 commit 4f04eb7

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

controllers/cloudinit/scripts/20-microk8s-join.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,23 @@ shift
1616

1717
# Loop over the given join addresses until microk8s join command succeeds.
1818
joined="false"
19+
attempts=0
20+
max_attempts=30
1921
while [ "$joined" = "false" ]; do
2022

2123
for url in "${@}"; do
24+
if [ $attempts -ge $max_attempts ]; then
25+
echo "Max join retry limit reached, exiting."
26+
exit 1
27+
fi
28+
2229
if microk8s join "${url}" $join_args; then
2330
joined="true"
2431
break
2532
fi
2633

27-
echo "Failed to join MicroK8s cluster, will retry"
34+
echo "Failed to join MicroK8s cluster, retrying ($((attempts+1))/$max_attempts)"
35+
attempts=$((attempts+1))
2836
sleep 5
2937
done
3038

integration/cluster-manifests/cluster.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ spec:
4747
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
4848
kind: AWSMachineTemplate
4949
name: test-ci-cluster-control-plane
50-
replicas: 1
50+
replicas: 3
5151
upgradeStrategy: SmartUpgrade
5252
version: v1.27.0
5353
---

0 commit comments

Comments
 (0)