@@ -197,12 +197,27 @@ func UpgradeManagementClusterAndWait(ctx context.Context, input UpgradeManagemen
197
197
client := input .ClusterProxy .GetClient ()
198
198
199
199
if input .ClusterctlBinaryPath != "" {
200
- UpgradeWithBinary (ctx , input .ClusterctlBinaryPath , upgradeInput )
200
+ clusterctlVersion , err := getClusterCtlVersion (input .ClusterctlBinaryPath )
201
+ Expect (err ).ToNot (HaveOccurred ())
202
+ upgradeRetries := 1
203
+ // Older versions of clusterctl may need to retry the upgrade process to allow for
204
+ // cert-manager CAs to become available before continuing. For newer versions of clusterctl
205
+ // this is addressed with https://github.com/kubernetes-sigs/cluster-api/pull/10513
206
+ if clusterctlVersion .LT (semver .MustParse ("1.7.0" )) {
207
+ upgradeRetries = 2
208
+ }
209
+ for i := range upgradeRetries {
210
+ err := UpgradeWithBinary (ctx , input .ClusterctlBinaryPath , upgradeInput )
211
+ if err != nil && i < upgradeRetries - 1 {
212
+ log .Logf ("Failed to UpgradeWithBinary, retrying: %v" , err )
213
+ continue
214
+ }
215
+ Expect (err ).ToNot (HaveOccurred ())
216
+ break
217
+ }
201
218
// Old versions of clusterctl may deploy CRDs, Mutating- and/or ValidatingWebhookConfigurations
202
219
// before creating the new Certificate objects. This check ensures the CA's are up to date before
203
220
// continuing.
204
- clusterctlVersion , err := getClusterCtlVersion (input .ClusterctlBinaryPath )
205
- Expect (err ).ToNot (HaveOccurred ())
206
221
if clusterctlVersion .LT (semver .MustParse ("1.7.2" )) {
207
222
Eventually (func () error {
208
223
return verifyCAInjection (ctx , client )
0 commit comments