@@ -215,6 +215,11 @@ func (r *KonnectEntityReconciler[T, TEnt]) Reconcile(
215215 return ctrl.Result {}, err
216216 }
217217 } else if ! res .IsZero () {
218+ // If the result is not zero (e.g., requeue), we still need to update the Programmed
219+ // status condition based on other conditions.
220+ if _ , errStatus := patchWithProgrammedStatusConditionBasedOnOtherConditions (ctx , r .Client , ent ); errStatus != nil {
221+ return ctrl.Result {}, errStatus
222+ }
218223 return res , nil
219224 }
220225 // If a type has a KongConsumer ref, handle it.
@@ -255,6 +260,11 @@ func (r *KonnectEntityReconciler[T, TEnt]) Reconcile(
255260
256261 return patchWithProgrammedStatusConditionBasedOnOtherConditions (ctx , r .Client , ent )
257262 } else if ! res .IsZero () {
263+ // If the result is not zero (e.g., requeue), we still need to update the Programmed
264+ // status condition based on other conditions.
265+ if _ , errStatus := patchWithProgrammedStatusConditionBasedOnOtherConditions (ctx , r .Client , ent ); errStatus != nil {
266+ return ctrl.Result {}, errStatus
267+ }
258268 return res , nil
259269 }
260270
@@ -292,6 +302,11 @@ func (r *KonnectEntityReconciler[T, TEnt]) Reconcile(
292302
293303 return patchWithProgrammedStatusConditionBasedOnOtherConditions (ctx , r .Client , ent )
294304 } else if ! res .IsZero () {
305+ // If the result is not zero (e.g., requeue), we still need to update the Programmed
306+ // status condition based on other conditions.
307+ if _ , errStatus := patchWithProgrammedStatusConditionBasedOnOtherConditions (ctx , r .Client , ent ); errStatus != nil {
308+ return ctrl.Result {}, errStatus
309+ }
295310 return res , nil
296311 }
297312
@@ -332,6 +347,13 @@ func (r *KonnectEntityReconciler[T, TEnt]) Reconcile(
332347
333348 return patchWithProgrammedStatusConditionBasedOnOtherConditions (ctx , r .Client , ent )
334349 } else if ! res .IsZero () {
350+ // If the result is not zero (e.g., requeue), we still need to update the Programmed
351+ // status condition based on other conditions (e.g., KongCertificateRefValid set to False
352+ // when referenced KongCertificate is not programmed yet).
353+ // We patch the status but still return the original requeue result.
354+ if _ , errStatus := patchWithProgrammedStatusConditionBasedOnOtherConditions (ctx , r .Client , ent ); errStatus != nil {
355+ return ctrl.Result {}, errStatus
356+ }
335357 return res , nil
336358 }
337359
0 commit comments