From 72f8127a3f1feae4619eb4fb54789497ba77bf91 Mon Sep 17 00:00:00 2001 From: Valeriy Khorunzhin Date: Thu, 28 Nov 2024 10:40:47 +0300 Subject: [PATCH] fix Signed-off-by: Valeriy Khorunzhin --- .../pkg/controller/vmiplease/internal/lifecycle_handler.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/images/virtualization-artifact/pkg/controller/vmiplease/internal/lifecycle_handler.go b/images/virtualization-artifact/pkg/controller/vmiplease/internal/lifecycle_handler.go index 5bbe15308..18ef101d1 100644 --- a/images/virtualization-artifact/pkg/controller/vmiplease/internal/lifecycle_handler.go +++ b/images/virtualization-artifact/pkg/controller/vmiplease/internal/lifecycle_handler.go @@ -50,10 +50,6 @@ func (h *LifecycleHandler) Handle(ctx context.Context, state state.VMIPLeaseStat Reason(conditions.ReasonUnknown). Status(metav1.ConditionUnknown) - defer func() { - conditions.SetCondition(cb, &leaseStatus.Conditions) - }() - vmip, err := state.VirtualMachineIPAddress(ctx) if err != nil { return reconcile.Result{}, err @@ -64,6 +60,7 @@ func (h *LifecycleHandler) Handle(ctx context.Context, state state.VMIPLeaseStat leaseStatus.Phase = virtv2.VirtualMachineIPAddressLeasePhaseBound cb.Status(metav1.ConditionTrue). Reason(vmiplcondition.Bound) + conditions.SetCondition(cb, &leaseStatus.Conditions) } } else { if leaseStatus.Phase != virtv2.VirtualMachineIPAddressLeasePhaseReleased { @@ -71,6 +68,7 @@ func (h *LifecycleHandler) Handle(ctx context.Context, state state.VMIPLeaseStat cb.Status(metav1.ConditionFalse). Reason(vmiplcondition.Released). Message("VirtualMachineIPAddress lease is not used by any VirtualMachineIPAddress") + conditions.SetCondition(cb, &leaseStatus.Conditions) } }