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

PLAT-8958 fix helm install nor retrying #294

Merged
merged 3 commits into from
Nov 14, 2024
Merged
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
26 changes: 16 additions & 10 deletions modules/eks/submodules/k8s/templates/k8s-functions.sh.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
EC="\e[0m"

KUBECONFIG="${kubeconfig_path}"
Expand Down Expand Up @@ -111,7 +112,9 @@ install_calico() {
local sleep_duration=10

for i in $(seq 1 $max_retries); do
helm_cmd upgrade "calico-tigera-operator" \
echo "Attempt $i of $max_retries..."

if helm_cmd upgrade "calico-tigera-operator" \
tigera-operator \
--repo "https://projectcalico.docs.tigera.io/charts" \
--version "${calico_version}" \
Expand All @@ -125,20 +128,23 @@ install_calico() {
--wait \
--timeout 10m \
--create-namespace \
--install
--install; then

if [ $? -eq 0 ]; then
printf "$GREEN Calico installation succeeded. $EC \n"
break
fi

if [ $i -lt $max_retries ]; then
echo "Attempt $i failed. Retrying in $${sleep_duration}s..."
sleep $sleep_duration
else
printf "$RED Maximum attempts reached. Exiting. $EC \n"
exit 1
fi
printf "$YELLOW Helm install attempt $i failed. $EC \n"

if [ $i -lt $max_retries ]; then
printf "Retrying in $sleep_duration s..."
sleep $sleep_duration
else
printf "$RED Maximum attempts reached. Exiting. $EC \n"
exit 1
fi

fi
done
}

Expand Down
Loading