Skip to content

Commit

Permalink
chore(join): Limit join retry attempts (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
HomayoonAlimohammadi authored Oct 24, 2024
1 parent a30c352 commit 4f04eb7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion controllers/cloudinit/scripts/20-microk8s-join.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,23 @@ shift

# Loop over the given join addresses until microk8s join command succeeds.
joined="false"
attempts=0
max_attempts=30
while [ "$joined" = "false" ]; do

for url in "${@}"; do
if [ $attempts -ge $max_attempts ]; then
echo "Max join retry limit reached, exiting."
exit 1
fi

if microk8s join "${url}" $join_args; then
joined="true"
break
fi

echo "Failed to join MicroK8s cluster, will retry"
echo "Failed to join MicroK8s cluster, retrying ($((attempts+1))/$max_attempts)"
attempts=$((attempts+1))
sleep 5
done

Expand Down
2 changes: 1 addition & 1 deletion integration/cluster-manifests/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSMachineTemplate
name: test-ci-cluster-control-plane
replicas: 1
replicas: 3
upgradeStrategy: SmartUpgrade
version: v1.27.0
---
Expand Down

0 comments on commit 4f04eb7

Please sign in to comment.