Skip to content

Commit

Permalink
Added a retry for clusterctl just in case
Browse files Browse the repository at this point in the history
  • Loading branch information
e-minguez committed Apr 18, 2024
1 parent 229d8d6 commit 2a74f0e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions examples/edge30-full-example/custom/files/metal3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,18 @@ if [ $(${KUBECTL} get pods -n ${METAL3_CAPISYSTEMNAMESPACE} -o name | wc -l) -lt
repository: ${METAL3_CAPI_IMAGES}
EOF

clusterctl init \
# Try this command 3 times just in case, stolen from https://stackoverflow.com/a/33354419
if ! (r=3; while ! clusterctl init \
--core "cluster-api:v${METAL3_CAPICOREVERSION}"\
--infrastructure "metal3:v${METAL3_CAPIMETAL3VERSION}"\
--bootstrap "${METAL3_CAPIPROVIDER}:v${METAL3_CAPIRKE2VERSION}"\
--control-plane "${METAL3_CAPIPROVIDER}:v${METAL3_CAPIRKE2VERSION}"
--control-plane "${METAL3_CAPIPROVIDER}:v${METAL3_CAPIRKE2VERSION}" ; do
((--r))||exit
echo "Something went wrong, let's wait 10 seconds and retry"
sleep 10;done) ; then
echo "clsuterctl failed"
exit 1
fi

# Wait for capi-controller-manager
while ! ${KUBECTL} wait --for condition=ready -n ${METAL3_CAPISYSTEMNAMESPACE} $(${KUBECTL} get pods -n ${METAL3_CAPISYSTEMNAMESPACE} -l cluster.x-k8s.io/provider=cluster-api -o name) --timeout=10s; do sleep 2 ; done
Expand Down

0 comments on commit 2a74f0e

Please sign in to comment.