You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
echo "CSR Attempt $i of $csr_max_retries: Checking for pending CSRs..."
112
-
if ! oc get csr 2>/dev/null | grep -i Pending; then
113
-
echo "No pending CSRs found. Continuing"
114
-
approved_csrs=true
115
-
break
116
-
else
117
-
echo "There are pending CSRs. That probably means cluster was hibernated for more than 24 hours. Need to approve them (until OCPBUGS-55339 is resolved)"
118
-
if oc get csr -oname | xargs oc adm certificate approve; then
119
-
echo "Successfully submitted approval for CSRs on attempt $i."
120
-
sleep 60 # Small delay for changes to propagate
121
-
if ! oc get csr 2>/dev/null | grep -i Pending; then
122
-
echo "Confirmed no pending CSRs after approval."
123
-
approved_csrs=true
124
-
break
105
+
for ((provisioning_attempt=1; provisioning_attempt<=provisioning_max_retries; provisioning_attempt++)); do
106
+
echo "=== Cluster Provisioning Attempt $provisioning_attempt of $provisioning_max_retries ==="
107
+
108
+
# Reset flags for this attempt
109
+
csr_max_retries=5
110
+
csr_sleep_duration=10
111
+
approved_csrs=false
112
+
113
+
console_max_retries=30
114
+
console_sleep_duration=10
115
+
console_connect_timeout=10
116
+
console_accessible=false
117
+
118
+
echo "--- Starting CSR Approval Process ---"
119
+
for ((i=1; i<=csr_max_retries; i++)); do
120
+
echo "CSR Attempt $i of $csr_max_retries: Checking for pending CSRs..."
121
+
if ! oc get csr 2>/dev/null | grep -i Pending; then
122
+
echo "No pending CSRs found. Continuing"
123
+
approved_csrs=true
124
+
break
125
+
else
126
+
echo "There are pending CSRs. That probably means cluster was hibernated for more than 24 hours. Need to approve them (until OCPBUGS-55339 is resolved)"
127
+
if oc get csr -oname | xargs oc adm certificate approve; then
128
+
echo "Successfully submitted approval for CSRs on attempt $i."
129
+
sleep 60 # Small delay for changes to propagate
130
+
if ! oc get csr 2>/dev/null | grep -i Pending; then
131
+
echo "Confirmed no pending CSRs after approval."
132
+
approved_csrs=true
133
+
break
134
+
else
135
+
echo "Pending CSRs still exist after approval attempt $i."
136
+
fi
125
137
else
126
-
echo "Pending CSRs still exist after approval attempt $i."
138
+
echo "Failed to run approval command for CSRs on attempt $i."
127
139
fi
128
-
else
129
-
echo "Failed to run approval command for CSRs on attempt $i."
130
140
fi
131
-
fi
132
141
133
-
if [[ "$i" -lt "$csr_max_retries" ]]; then
134
-
echo "Sleeping for $csr_sleep_duration seconds before next CSR retry..."
135
-
sleep "$csr_sleep_duration"
136
-
fi
137
-
done
142
+
if [[ "$i" -lt "$csr_max_retries" ]]; then
143
+
echo "Sleeping for $csr_sleep_duration seconds before next CSR retry..."
144
+
sleep "$csr_sleep_duration"
145
+
fi
146
+
done
138
147
139
-
if [[ "$approved_csrs" == "true" ]]; then
148
+
if [[ "$approved_csrs" == "false" ]]; then
149
+
echo "Failed to ensure all pending CSRs were approved after $csr_max_retries attempts."
150
+
if [[ "$provisioning_attempt" -lt "$provisioning_max_retries" ]]; then
151
+
echo "Will retry entire provisioning process..."
152
+
continue
153
+
else
154
+
echo "All provisioning attempts exhausted. Exiting."
155
+
exit 1
156
+
fi
157
+
fi
140
158
echo "CSR check and approval process completed successfully."
141
-
else
142
-
echo "Failed to ensure all pending CSRs were approved after $csr_max_retries attempts."
0 commit comments