Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(join): Limit join retry attempts #118

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading