@@ -123,8 +123,10 @@ func (r *HostLeaseReconciler) handleUpdate(ctx context.Context, hostLease *v1alp
123123 if ! controllerutil .ContainsFinalizer (hostLease , hostLeaseFinalizer ) {
124124 controllerutil .AddFinalizer (hostLease , hostLeaseFinalizer )
125125 if err := r .Update (ctx , hostLease ); err != nil {
126+ hostLease .Status .Phase = v1alpha1 .HostLeasePhaseFailed
126127 return ctrl.Result {}, err
127128 }
129+ hostLease .Status .Phase = v1alpha1 .HostLeasePhaseProgressing
128130 return ctrl.Result {Requeue : true }, nil
129131 }
130132
@@ -136,6 +138,7 @@ func (r *HostLeaseReconciler) handleUpdate(ctx context.Context, hostLease *v1alp
136138 return result , provErr
137139 }
138140 if ! result .IsZero () {
141+ hostLease .Status .Phase = v1alpha1 .HostLeasePhaseProgressing
139142 return result , nil
140143 }
141144 }
@@ -167,10 +170,18 @@ func (r *HostLeaseReconciler) handleUpdate(ctx context.Context, hostLease *v1alp
167170 if hostLease .Spec .PoweredOn != nil {
168171 currentlyOn := node .PowerState == ironic .PowerOn .String ()
169172 if * hostLease .Spec .PoweredOn != currentlyOn {
173+ hostLease .Status .Phase = v1alpha1 .HostLeasePhaseProgressing
170174 return ctrl.Result {RequeueAfter : r .RecheckInterval }, nil
171175 }
172176 }
173177
178+ provisionCond := hostLease .GetStatusCondition (v1alpha1 .HostConditionProvisionTemplateComplete )
179+ if provisionCond != nil && provisionCond .Status != metav1 .ConditionTrue {
180+ hostLease .Status .Phase = v1alpha1 .HostLeasePhaseFailed
181+ log .Info ("HostLease not ready: provision template not complete" , "hostLease" , hostLease .Name )
182+ return ctrl.Result {}, nil
183+ }
184+
174185 hostLease .Status .Phase = v1alpha1 .HostLeasePhaseReady
175186 log .Info ("HostLease reconcile completed; status changes pending persistence" , "hostLease" , hostLease .Name )
176187 return ctrl.Result {}, nil
0 commit comments