Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Valeriy Khorunzhin <valeriy.khorunzhin@flant.com>
  • Loading branch information
Valeriy Khorunzhin committed Nov 28, 2024
1 parent 4442a4c commit 72f8127
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -64,13 +60,15 @@ 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 {
leaseStatus.Phase = virtv2.VirtualMachineIPAddressLeasePhaseReleased
cb.Status(metav1.ConditionFalse).
Reason(vmiplcondition.Released).
Message("VirtualMachineIPAddress lease is not used by any VirtualMachineIPAddress")
conditions.SetCondition(cb, &leaseStatus.Conditions)
}
}

Expand Down

0 comments on commit 72f8127

Please sign in to comment.