Skip to content

Commit

Permalink
Check if detach annotation helps
Browse files Browse the repository at this point in the history
  • Loading branch information
lentzi90 committed Jan 21, 2025
1 parent ffce770 commit 7f53891
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/e2e/pivoting.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 7f53891

Please sign in to comment.