Skip to content

Commit ec03189

Browse files
authored
Merge pull request #12396 from k8s-infra-cherrypick-robot/cherry-pick-12379-to-release-1.9
[release-1.9] 🌱 Fix e2e test capi-e2e-release-1.8
2 parents 2f38dd4 + 3b368e1 commit ec03189

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/e2e/self_hosted.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,14 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
245245
return selfHostedClusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem)
246246
}, "5s", "100ms").Should(BeNil(), "Failed to assert self-hosted API server stability")
247247

248+
By("Ensure all machines have NodeRef before doing move")
249+
// Ensure all machines have NodeRef before attempting to move.
250+
// This prevents clusterctl move failures when machines are still provisioning.
251+
framework.WaitForClusterMachineNodeRefs(ctx, framework.WaitForClusterMachineNodeRefsInput{
252+
GetLister: input.BootstrapClusterProxy.GetClient(),
253+
Cluster: cluster,
254+
}, input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade")...)
255+
248256
// Get the machines of the workloadCluster before it is moved to become self-hosted to make sure that the move did not trigger
249257
// any unexpected rollouts.
250258
preMoveMachineList := &unstructured.UnstructuredList{}
@@ -447,6 +455,14 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
447455
return selfHostedClusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem)
448456
}, "5s", "100ms").Should(BeNil(), "Failed to assert self-hosted API server stability")
449457

458+
By("Ensure all machines have NodeRef before doing move back")
459+
// Ensure all machines have NodeRef before attempting to move back to bootstrap.
460+
// This prevents clusterctl move failures when machines are still provisioning.
461+
framework.WaitForClusterMachineNodeRefs(ctx, framework.WaitForClusterMachineNodeRefsInput{
462+
GetLister: selfHostedClusterProxy.GetClient(),
463+
Cluster: selfHostedCluster,
464+
}, input.E2EConfig.GetIntervals(specName, "wait-machine-upgrade")...)
465+
450466
By("Moving the cluster back to bootstrap")
451467
clusterctl.Move(ctx, clusterctl.MoveInput{
452468
LogFolder: filepath.Join(input.ArtifactFolder, "clusters", clusterResources.Cluster.Name),

0 commit comments

Comments
 (0)