Stop daemons & timers while the operator is on peering freeze #675
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When the operator goes to peering freeze, all the watch streams disconnect from the API and wait until the operator is resumed.
However, this mode was not passed to the daemons & timers subsystem, so they continued running — while not getting any updates on the resource's state from the cluster (because the watch-streams are frozen).
This fix synchronizes the daemons & timers to the global operator freeze:
Once an operator is frozen, all daemons & timers are stopped almost the same way as when the operator exits (e.g. due to SIGTERM/SIGINT) — with all the cancellation backoffs, timeouts, and other procedures of graceful & forced termination.
Once the operator is resumed, nothing is done explicitly: the resumed watch-streams will naturally spawn new daemons/timers for all matching resources to the moment — as if those started to match the filters, all at once. (This will implicitly cover the case of "up to date" relevance: those resources that did not exist before the freeze, will be spawned too; those that has gone, will not be resumed.)
TODOs left:
Fixes #673.