@@ -116,15 +116,13 @@ func (r *HostLeaseReconciler) handleUpdate(ctx context.Context, hostLease *v1alp
116116 return ctrl.Result {}, nil
117117 }
118118
119- if hostLease .Status .Phase == "" {
120- hostLease .Status .Phase = v1alpha1 .HostLeasePhaseProgressing
121- }
122-
123119 if ! controllerutil .ContainsFinalizer (hostLease , hostLeaseFinalizer ) {
124120 controllerutil .AddFinalizer (hostLease , hostLeaseFinalizer )
125121 if err := r .Update (ctx , hostLease ); err != nil {
122+ hostLease .Status .Phase = v1alpha1 .HostLeasePhaseFailed
126123 return ctrl.Result {}, err
127124 }
125+ hostLease .Status .Phase = v1alpha1 .HostLeasePhaseProgressing
128126 return ctrl.Result {Requeue : true }, nil
129127 }
130128
@@ -136,6 +134,7 @@ func (r *HostLeaseReconciler) handleUpdate(ctx context.Context, hostLease *v1alp
136134 return result , provErr
137135 }
138136 if ! result .IsZero () {
137+ hostLease .Status .Phase = v1alpha1 .HostLeasePhaseProgressing
139138 return result , nil
140139 }
141140 }
@@ -167,10 +166,18 @@ func (r *HostLeaseReconciler) handleUpdate(ctx context.Context, hostLease *v1alp
167166 if hostLease .Spec .PoweredOn != nil {
168167 currentlyOn := node .PowerState == ironic .PowerOn .String ()
169168 if * hostLease .Spec .PoweredOn != currentlyOn {
169+ hostLease .Status .Phase = v1alpha1 .HostLeasePhaseProgressing
170170 return ctrl.Result {RequeueAfter : r .RecheckInterval }, nil
171171 }
172172 }
173173
174+ provisionCond := hostLease .GetStatusCondition (v1alpha1 .HostConditionProvisionTemplateComplete )
175+ if provisionCond != nil && provisionCond .Status != metav1 .ConditionTrue {
176+ hostLease .Status .Phase = v1alpha1 .HostLeasePhaseFailed
177+ log .Info ("HostLease not ready: provision template not complete" , "hostLease" , hostLease .Name )
178+ return ctrl.Result {}, nil
179+ }
180+
174181 hostLease .Status .Phase = v1alpha1 .HostLeasePhaseReady
175182 log .Info ("HostLease reconcile completed; status changes pending persistence" , "hostLease" , hostLease .Name )
176183 return ctrl.Result {}, nil
0 commit comments