@@ -229,41 +229,36 @@ func (r *Reconciler[T]) Reconcile(ctx context.Context, req ctrl.Request) (result
229229 return ctrl.Result {Requeue : true }, nil
230230 }
231231
232- // note: with the logic implemented below, annotation changes on the component object will *not* trigger a reconciliation!
233- if status .AppliedGeneration < component .GetGeneration () || status .LastAppliedAt .Before (& metav1.Time {Time : now .Add (- 60 * time .Second )}) {
234- log .V (2 ).Info ("reconciling dependent resources" )
235- for hookOrder , hook := range r .preReconcileHooks {
232+ log .V (2 ).Info ("reconciling dependent resources" )
233+ for hookOrder , hook := range r .preReconcileHooks {
234+ if err := hook (ctx , r .client , component .(T )); err != nil {
235+ return ctrl.Result {}, errors .Wrapf (err , "error running pre-reconcile hook (%d)" , hookOrder )
236+ }
237+ }
238+ ok , err := r .reconcileDependentResources (ctx , component )
239+ if err != nil {
240+ log .V (1 ).Info ("error while reconciling dependent resources" )
241+ return ctrl.Result {}, errors .Wrap (err , "error reconciling dependent resources" )
242+ }
243+ if ok {
244+ for hookOrder , hook := range r .postReconcileHooks {
236245 if err := hook (ctx , r .client , component .(T )); err != nil {
237- return ctrl.Result {}, errors .Wrapf (err , "error running pre -reconcile hook (%d)" , hookOrder )
246+ return ctrl.Result {}, errors .Wrapf (err , "error running post -reconcile hook (%d)" , hookOrder )
238247 }
239248 }
240- ok , err := r .reconcileDependentResources (ctx , component )
241- if err != nil {
242- log .V (1 ).Info ("error while reconciling dependent resources" )
243- return ctrl.Result {}, errors .Wrap (err , "error reconciling dependent resources" )
244- }
245- if ok {
246- for hookOrder , hook := range r .postReconcileHooks {
247- if err := hook (ctx , r .client , component .(T )); err != nil {
248- return ctrl.Result {}, errors .Wrapf (err , "error running post-reconcile hook (%d)" , hookOrder )
249- }
250- }
251- log .V (1 ).Info ("all dependent resources successfully reconciled" )
252- status .SetState (StateReady , readyConditionReasonReady , "Dependent resources successfully reconciled" )
253- status .AppliedGeneration = component .GetGeneration ()
254- status .LastAppliedAt = & now
255- return ctrl.Result {RequeueAfter : 10 * time .Minute }, nil
256- } else {
257- log .V (1 ).Info ("not all dependent resources successfully reconciled" )
258- status .SetState (StateProcessing , readyConditionReasonProcessing , "Reconcilation of dependent resources triggered; waiting until all dependent resources are ready" )
259- if ! reflect .DeepEqual (status .Inventory , savedStatus .Inventory ) {
260- r .backoff .Forget (req )
261- }
262- return ctrl.Result {RequeueAfter : r .backoff .Next (req , readyConditionReasonProcessing )}, nil
249+ log .V (1 ).Info ("all dependent resources successfully reconciled" )
250+ status .SetState (StateReady , readyConditionReasonReady , "Dependent resources successfully reconciled" )
251+ status .AppliedGeneration = component .GetGeneration ()
252+ status .LastAppliedAt = & now
253+ return ctrl.Result {RequeueAfter : 10 * time .Minute }, nil
254+ } else {
255+ log .V (1 ).Info ("not all dependent resources successfully reconciled" )
256+ status .SetState (StateProcessing , readyConditionReasonProcessing , "Reconcilation of dependent resources triggered; waiting until all dependent resources are ready" )
257+ if ! reflect .DeepEqual (status .Inventory , savedStatus .Inventory ) {
258+ r .backoff .Forget (req )
263259 }
260+ return ctrl.Result {RequeueAfter : r .backoff .Next (req , readyConditionReasonProcessing )}, nil
264261 }
265-
266- return ctrl.Result {}, nil
267262 } else if allowed , msg , err := r .deletionAllowed (ctx , component ); err != nil || ! allowed {
268263 // deletion is blocked because of existing managed CROs and so on
269264 // TODO: eliminate this msg logic
0 commit comments