You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Periodic Reconciliation - Able to Set Max Interval Between Reconciliations #848
In some cases, like when managing external resources, or just having a simple controller that we want to periodically reschedule it would be handy to be able to define that "I want to have maximum delay [X time] between reconciliations".
This would be much better than fixed rate, since that can easily lead to very close executions after each other, what is not the intention in these use cases.
One way that this is already doable is to make sure that the UpdateControl returns with UpdateControl.<MyCustomResource>noUpdate().rescheduleAfter(8, TimeUnit.HOURS);. Where it would return just noUpdate() - (or alternaives like updateStatus() )
But this is not that nice, since basically puts kinda noise in the code.
This could be also a new annoation @PeriodicReconciliation(maxDelay=8, timeUnit=HOURS) on the reconciler
or a property of @ControllerConfuguration(periodicReconiliationMaxDelay=8, periodicReconiliationTimeUnit = HOURS )
please let me know what do you think.
Implementation notes
Implementation wise regarding the execution, it is very simple to do, we just always put a reschedule if there is missing from the UpdateControl.
That would help for testing. Actually, and especialy true on quarkus side, tests are more integration tests than unit testing the Reconciler. Then, it is not easy to test if a reschedule has been set.
Informers can help detecting change but for time based behaviour, I guess we still need to use either TimedEventSource or reschedule.
changed the title [-]Periodic Reconciliation - Able to Set Max Delay Between Reconciliations[/-][+]Periodic Reconciliation - Able to Set Max Interval Between Reconciliations[/+]on Jan 27, 2022
Activity
andreaTP commentedon Jan 19, 2022
I think that
@ControllerConfuguration(periodicReconiliationMaxDelay=8 ...with sensible defaults works perfectly for this use-case.metacosm commentedon Jan 19, 2022
I'd favor a configuration option as well. It makes more sense that way than having to remember to call a reschedule on
UpdateControl…csviri commentedon Jan 19, 2022
see also: https://kubernetes.slack.com/archives/CAW0GV7A5/p1642594910160600
For the record, I think discussed before, if you have informers in place and correct code, this is not needed. It's really a fail safe.
sclorng commentedon Jan 19, 2022
That would help for testing. Actually, and especialy true on quarkus side, tests are more integration tests than unit testing the Reconciler. Then, it is not easy to test if a reschedule has been set.
Informers can help detecting change but for time based behaviour, I guess we still need to use either TimedEventSource or reschedule.
[-]Periodic Reconciliation - Able to Set Max Delay Between Reconciliations[/-][+]Periodic Reconciliation - Able to Set Max Interval Between Reconciliations[/+]