Skip to content

Commit 3fa7900

Browse files
authored
retry aemm installs (#237)
1 parent 713db7c commit 3fa7900

15 files changed

+70
-15
lines changed

test/e2e/cordon-only-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ aemm_helm_args=(
5757
aemm_helm_args+=("${common_helm_args[@]}")
5858

5959
set -x
60-
helm "${aemm_helm_args[@]}"
60+
retry 5 helm "${aemm_helm_args[@]}"
6161
set +x
6262

6363
emtp_helm_args=(

test/e2e/imds-v2-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ aemm_helm_args=(
8080
aemm_helm_args+=("${common_helm_args[@]}")
8181

8282
set -x
83-
helm "${aemm_helm_args[@]}"
83+
retry 5 helm "${aemm_helm_args[@]}"
8484
set +x
8585

8686
TAINT_CHECK_CYCLES=15

test/e2e/maintenance-event-cancellation-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ aemm_helm_args=(
8484
aemm_helm_args+=("${common_helm_args[@]}")
8585

8686
set -x
87-
helm "${aemm_helm_args[@]}"
87+
retry 5 helm "${aemm_helm_args[@]}"
8888
set +x
8989

9090
TAINT_CHECK_CYCLES=15

test/e2e/maintenance-event-dry-run-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ aemm_helm_args=(
8484
aemm_helm_args+=("${common_helm_args[@]}")
8585

8686
set -x
87-
helm "${aemm_helm_args[@]}"
87+
retry 5 helm "${aemm_helm_args[@]}"
8888
set +x
8989

9090
logs=0

test/e2e/maintenance-event-reboot-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ aemm_helm_args=(
7878
aemm_helm_args+=("${common_helm_args[@]}")
7979

8080
set -x
81-
helm "${aemm_helm_args[@]}"
81+
retry 5 helm "${aemm_helm_args[@]}"
8282
set +x
8383

8484
TAINT_CHECK_CYCLES=15

test/e2e/maintenance-event-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ aemm_helm_args=(
8686
aemm_helm_args+=("${common_helm_args[@]}")
8787

8888
set -x
89-
helm "${aemm_helm_args[@]}"
89+
retry 5 helm "${aemm_helm_args[@]}"
9090
set +x
9191

9292
TAINT_CHECK_CYCLES=15

test/e2e/prometheus-metrics-test

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ common_helm_args=()
2020
[[ "${TEST_WINDOWS-}" == "true" ]] && common_helm_args+=(--set targetNodeOs="windows")
2121
[[ -n "${NTH_WORKER_LABEL-}" ]] && common_helm_args+=(--set nodeSelector."$NTH_WORKER_LABEL")
2222

23+
helm repo add stable https://kubernetes-charts.storage.googleapis.com
24+
helm repo update
25+
retry 5 helm install prometheus-operator stable/prometheus-operator --set prometheusOperator.admissionWebhooks.enabled="false"
26+
2327
anth_helm_args=(
2428
upgrade
2529
--install
@@ -35,6 +39,7 @@ anth_helm_args=(
3539
--set enableSpotInterruptionDraining="true"
3640
--set taintNode="true"
3741
--set enablePrometheusServer="true"
42+
--set podMonitor.create="true"
3843
--set tolerations=""
3944
)
4045
[[ -n "${NODE_TERMINATION_HANDLER_DOCKER_PULL_POLICY-}" ]] &&
@@ -80,7 +85,7 @@ aemm_helm_args=(
8085
aemm_helm_args+=("${common_helm_args[@]}")
8186

8287
set -x
83-
helm "${aemm_helm_args[@]}"
88+
retry 5 helm "${aemm_helm_args[@]}"
8489
set +x
8590

8691
TAINT_CHECK_CYCLES=15

test/e2e/spot-interruption-dry-run-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ aemm_helm_args=(
8282
aemm_helm_args+=("${common_helm_args[@]}")
8383

8484
set -x
85-
helm "${aemm_helm_args[@]}"
85+
retry 5 helm "${aemm_helm_args[@]}"
8686
set +x
8787

8888
logs=0

test/e2e/spot-interruption-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ aemm_helm_args=(
8686
aemm_helm_args+=("${common_helm_args[@]}")
8787

8888
set -x
89-
helm "${aemm_helm_args[@]}"
89+
retry 5 helm "${aemm_helm_args[@]}"
9090
set +x
9191

9292
TAINT_CHECK_CYCLES=15

test/e2e/webhook-http-proxy-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ aemm_helm_args=(
9393
aemm_helm_args+=("${common_helm_args[@]}")
9494

9595
set -x
96-
helm "${aemm_helm_args[@]}"
96+
retry 5 helm "${aemm_helm_args[@]}"
9797
set +x
9898

9999
emtp_helm_args=(

test/e2e/webhook-secret-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ aemm_helm_args=(
4242
aemm_helm_args+=("${common_helm_args[@]}")
4343

4444
set -x
45-
helm "${aemm_helm_args[@]}"
45+
retry 5 helm "${aemm_helm_args[@]}"
4646
set +x
4747

4848
emtp_helm_args=(

test/e2e/webhook-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ aemm_helm_args=(
8383
aemm_helm_args+=("${common_helm_args[@]}")
8484

8585
set -x
86-
helm "${aemm_helm_args[@]}"
86+
retry 5 helm "${aemm_helm_args[@]}"
8787
set +x
8888

8989
TAINT_CHECK_CYCLES=15

test/eks-cluster-test/run-test

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,31 @@ function exit_and_fail {
6262
exit 1
6363
}
6464

65+
function retry {
66+
local retries=$1
67+
shift
68+
69+
local count=0
70+
set +e
71+
trap "set -e" RETURN
72+
until "$@"; do
73+
exit=$?
74+
set -e
75+
wait=$((2 ** $count))
76+
count=$(($count + 1))
77+
if [ $count -lt $retries ]; then
78+
echo "Retry $count/$retries exited $exit, retrying in $wait seconds..."
79+
sleep $wait
80+
else
81+
echo "Retry $count/$retries exited $exit, no more retries left."
82+
return $exit
83+
fi
84+
set +e
85+
done
86+
return 0
87+
}
88+
export -f retry
89+
6590
function clean_up {
6691
if [[ "$PRESERVE" == false ]]; then
6792
echo "====================================================================================================="

test/k8s-local-cluster-test/provision-cluster

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,21 @@ if [[ OVERRIDE_PATH -eq 1 ]]; then
9595
else
9696
if [ ! -x "$TMP_DIR/kubectl" ]; then
9797
echoerr "🥑 Downloading the \"kubectl\" binary"
98-
curl -Lo $TMP_DIR/kubectl "https://storage.googleapis.com/kubernetes-release/release/$KUBECTL_VERSION/bin/$PLATFORM/amd64/kubectl"
98+
retry 5 curl -Lo $TMP_DIR/kubectl "https://storage.googleapis.com/kubernetes-release/release/$KUBECTL_VERSION/bin/$PLATFORM/amd64/kubectl"
9999
chmod +x $TMP_DIR/kubectl
100100
echoerr "👍 Downloaded the \"kubectl\" binary"
101101
fi
102102

103103
if [ ! -x "$TMP_DIR/kind" ]; then
104104
echoerr "🥑 Downloading the \"kind\" binary"
105-
curl -Lo $TMP_DIR/kind https://github.com/kubernetes-sigs/kind/releases/download/v$KIND_VERSION/kind-$PLATFORM-amd64
105+
retry 5 curl -Lo $TMP_DIR/kind https://github.com/kubernetes-sigs/kind/releases/download/v$KIND_VERSION/kind-$PLATFORM-amd64
106106
chmod +x $TMP_DIR/kind
107107
echoerr "👍 Downloaded the \"kind\" binary"
108108
fi
109109

110110
if [ ! -x "$TMP_DIR/helm" ]; then
111111
echoerr "🥑 Downloading the \"helm\" binary"
112-
curl -L https://get.helm.sh/helm-v$HELM_VERSION-$PLATFORM-amd64.tar.gz | tar zxf - -C $TMP_DIR
112+
retry 5 curl -L https://get.helm.sh/helm-v$HELM_VERSION-$PLATFORM-amd64.tar.gz | tar zxf - -C $TMP_DIR
113113
mv $TMP_DIR/$PLATFORM-amd64/helm $TMP_DIR/.
114114
chmod +x $TMP_DIR/helm
115115
echoerr "👍 Downloaded the \"helm\" binary"

test/k8s-local-cluster-test/run-test

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,31 @@ function relpath() {
2828
perl -e 'use File::Spec; print File::Spec->abs2rel(@ARGV) . "\n"' $1 $2
2929
}
3030

31+
function retry {
32+
local retries=$1
33+
shift
34+
35+
local count=0
36+
set +e
37+
trap "set -e" RETURN
38+
until "$@"; do
39+
exit=$?
40+
set -e
41+
wait=$((2 ** $count))
42+
count=$(($count + 1))
43+
if [ $count -lt $retries ]; then
44+
echo "Retry $count/$retries exited $exit, retrying in $wait seconds..."
45+
sleep $wait
46+
else
47+
echo "Retry $count/$retries exited $exit, no more retries left."
48+
return $exit
49+
fi
50+
set +e
51+
done
52+
return 0
53+
}
54+
export -f retry
55+
3156
function clean_up {
3257
if [[ "$PRESERVE" == false ]]; then
3358
$SCRIPTPATH/../k8s-local-cluster-test/delete-cluster $DELETE_CLUSTER_ARGS || :

0 commit comments

Comments
 (0)