Skip to content

Commit 642e16c

Browse files
committed
test/e2e check for machines being ready after provisioning on Runtime SDK test
The topology controller checks if the ControlPlane IsScaling() or any MachineDeployment IsRollingOut() before running the BeforeClusterUpgrade hook. In some cases in e2e tests the nodes were not ready yet and the timeout for the BeforeClusterUpgrade hook was not sufficient for the nodes to get ready and running the hook.
1 parent 91277b5 commit 642e16c

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/e2e/cluster_upgrade_runtimesdk.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,30 @@ func clusterUpgradeWithRuntimeSDKSpec(ctx context.Context, inputGetter func() cl
169169
clusterRef,
170170
input.E2EConfig.GetIntervals(specName, "wait-cluster"))
171171
},
172+
PostMachinesProvisioned: func() {
173+
Eventually(func() error {
174+
// Before running the BeforeClusterUpgrade hook, the topology controller
175+
// checks if the ControlPlane `IsScaling()` and for MachineDeployments if
176+
// `IsAnyRollingOut()`.
177+
// This PostMachineProvisioned function ensures that the clusters machines
178+
// are healthy by checking the MachineNodeHealthyCondition, so the upgrade
179+
// below does not get delayed or runs into timeouts before even reaching
180+
// the BeforeClusterUpgrade hook.
181+
machineList := &clusterv1.MachineList{}
182+
if err := input.BootstrapClusterProxy.GetClient().List(ctx, machineList, client.InNamespace(namespace.Name)); err != nil {
183+
return errors.Wrap(err, "list machines")
184+
}
185+
186+
for i := range machineList.Items {
187+
machine := &machineList.Items[i]
188+
if !conditions.IsTrue(machine, clusterv1.MachineNodeHealthyCondition) {
189+
return errors.Errorf("machine %q does not have %q condition set to true", machine.GetName(), clusterv1.MachineNodeHealthyCondition)
190+
}
191+
}
192+
193+
return nil
194+
}, 5*time.Minute, 15*time.Second).Should(Succeed(), "Waiting for rollouts to finish")
195+
},
172196
WaitForClusterIntervals: input.E2EConfig.GetIntervals(specName, "wait-cluster"),
173197
WaitForControlPlaneIntervals: input.E2EConfig.GetIntervals(specName, "wait-control-plane"),
174198
WaitForMachineDeployments: input.E2EConfig.GetIntervals(specName, "wait-worker-nodes"),

0 commit comments

Comments
 (0)