From 7f538916c87833430c35564a4fe5e89ee58929c6 Mon Sep 17 00:00:00 2001 From: Lennart Jern Date: Tue, 21 Jan 2025 15:48:31 +0200 Subject: [PATCH] Check if detach annotation helps --- test/e2e/pivoting.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/e2e/pivoting.go b/test/e2e/pivoting.go index fe57a638f..a2b2accd1 100644 --- a/test/e2e/pivoting.go +++ b/test/e2e/pivoting.go @@ -202,6 +202,13 @@ func pivoting(ctx context.Context, inputGetter func() PivotingInput) { return input.TargetCluster.GetClient().Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem) }, "5s", "100ms").Should(BeNil(), "Failed to assert target API server stability") + // Detach BMHs to avoid deprovisioning when deleted + bmhs, err := GetAllBmhs(ctx, input.BootstrapClusterProxy.GetClient(), input.Namespace) + Expect(err).NotTo(HaveOccurred()) + for _, bmh := range bmhs { + AnnotateBmh(ctx, input.BootstrapClusterProxy.GetClient(), bmh, bmov1alpha1.DetachedAnnotation, &input.SpecName) + } + By("Moving the cluster to self hosted") clusterctl.Move(ctx, clusterctl.MoveInput{ LogFolder: filepath.Join(input.ArtifactFolder, "clusters", input.ClusterName+"-bootstrap"), @@ -233,6 +240,13 @@ func pivoting(ctx context.Context, inputGetter func() PivotingInput) { }) Expect(controlPlane).ToNot(BeNil()) + // Remove detach annotation + bmhs, err = GetAllBmhs(ctx, input.BootstrapClusterProxy.GetClient(), input.Namespace) + Expect(err).NotTo(HaveOccurred()) + for _, bmh := range bmhs { + AnnotateBmh(ctx, input.BootstrapClusterProxy.GetClient(), bmh, bmov1alpha1.DetachedAnnotation, nil) + } + By("Check that BMHs are in provisioned state") WaitForNumBmhInState(ctx, bmov1alpha1.StateProvisioned, WaitForNumInput{ Client: input.TargetCluster.GetClient(),