Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions internal/controller/hostlease_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ func (r *HostLeaseReconciler) handleUpdate(ctx context.Context, hostLease *v1alp
if !controllerutil.ContainsFinalizer(hostLease, hostLeaseFinalizer) {
controllerutil.AddFinalizer(hostLease, hostLeaseFinalizer)
if err := r.Update(ctx, hostLease); err != nil {
hostLease.Status.Phase = v1alpha1.HostLeasePhaseFailed
return ctrl.Result{}, err
}
hostLease.Status.Phase = v1alpha1.HostLeasePhaseProgressing
return ctrl.Result{Requeue: true}, nil
}

Expand All @@ -136,6 +138,7 @@ func (r *HostLeaseReconciler) handleUpdate(ctx context.Context, hostLease *v1alp
return result, provErr
}
if !result.IsZero() {
hostLease.Status.Phase = v1alpha1.HostLeasePhaseProgressing
return result, nil
}
}
Expand Down Expand Up @@ -167,10 +170,18 @@ func (r *HostLeaseReconciler) handleUpdate(ctx context.Context, hostLease *v1alp
if hostLease.Spec.PoweredOn != nil {
currentlyOn := node.PowerState == ironic.PowerOn.String()
if *hostLease.Spec.PoweredOn != currentlyOn {
hostLease.Status.Phase = v1alpha1.HostLeasePhaseProgressing
return ctrl.Result{RequeueAfter: r.RecheckInterval}, nil
}
}

provisionCond := hostLease.GetStatusCondition(v1alpha1.HostConditionProvisionTemplateComplete)
if provisionCond != nil && provisionCond.Status != metav1.ConditionTrue {
hostLease.Status.Phase = v1alpha1.HostLeasePhaseFailed
log.Info("HostLease not ready: provision template not complete", "hostLease", hostLease.Name)
return ctrl.Result{}, nil
}

hostLease.Status.Phase = v1alpha1.HostLeasePhaseReady
log.Info("HostLease reconcile completed; status changes pending persistence", "hostLease", hostLease.Name)
return ctrl.Result{}, nil
Expand Down
Loading