From 6f3ce0d2a154da28eb14866c2297d0953e2df54d Mon Sep 17 00:00:00 2001 From: Utku Ozdemir Date: Mon, 9 Dec 2024 14:37:54 +0100 Subject: [PATCH] fix: regenerate wipe id of infra machines only once per de-allocation We were generating a random wipe id multiple times in infra.MachineController, causing the infra provider to run many reconciles. Fix it by doing it only once by checking the allocation information. Signed-off-by: Utku Ozdemir --- .../backend/runtime/omni/controllers/omni/infra_machine.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/backend/runtime/omni/controllers/omni/infra_machine.go b/internal/backend/runtime/omni/controllers/omni/infra_machine.go index 6f8e3678..337d740b 100644 --- a/internal/backend/runtime/omni/controllers/omni/infra_machine.go +++ b/internal/backend/runtime/omni/controllers/omni/infra_machine.go @@ -119,9 +119,12 @@ func (h *infraMachineControllerHelper) transformExtraOutput(ctx context.Context, // the machine is deallocated, clear the cluster information and mark it for wipe by assigning it a new wipe ID + if infraMachine.TypedSpec().Value.ClusterTalosVersion != "" { + infraMachine.TypedSpec().Value.WipeId = uuid.NewString() + } + infraMachine.TypedSpec().Value.ClusterTalosVersion = "" infraMachine.TypedSpec().Value.Extensions = nil - infraMachine.TypedSpec().Value.WipeId = uuid.NewString() if err = r.RemoveFinalizer(ctx, clusterMachine.Metadata(), InfraMachineControllerName); err != nil { return err