Description
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
.