Skip to content

Commit 7932289

Browse files
committed
set first status before running post-read hooks
1 parent 767f278 commit 7932289

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pkg/component/reconcile.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,12 @@ func (r *Reconciler[T]) Reconcile(ctx context.Context, req ctrl.Request) (result
229229
}
230230
}()
231231

232+
// set a first status (and requeue, because the status update itself will not trigger another reconciliation because of the event filter set)
233+
if status.ObservedGeneration <= 0 {
234+
status.SetState(StateProcessing, readyConditionReasonNew, "First seen")
235+
return ctrl.Result{Requeue: true}, nil
236+
}
237+
232238
// run post-read hooks
233239
// note: it's important that this happens after deferring the status handler
234240
for hookOrder, hook := range r.postReadHooks {
@@ -237,12 +243,6 @@ func (r *Reconciler[T]) Reconcile(ctx context.Context, req ctrl.Request) (result
237243
}
238244
}
239245

240-
// set a first status (and requeue, because the status update itself will not trigger another reconciliation because of the event filter set)
241-
if status.ObservedGeneration <= 0 {
242-
status.SetState(StateProcessing, readyConditionReasonNew, "First seen")
243-
return ctrl.Result{Requeue: true}, nil
244-
}
245-
246246
// setup target
247247
targetClient, err := r.getClientForComponent(component)
248248
if err != nil {

0 commit comments

Comments
 (0)