fix: don’t hold node lock if reboot is blocked #819
Merged
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.
Fixes #792
This PR moves the "is this node blocked for reboot?" foo earlier in the code flow in the main "does node need to be rebooted?" loop. The purpose is to determine whether or not the node is blocked for reboot prior to trying to acquire a node lock that will prevent another node in the cluster from being rebooted.
The purpose of blocking a node from rebooting is to implement node-specific safety checks prior to taking a node offline (an obvious side-effect of a reboot). These safety checks should be independent from the configuration that enforces how many nodes may go offline at any time (implemented via the node reboot concurrency config + the daemonset lock). This is what informs my thinking that we should simply check for a blocking condition prior to attempting to acquire a lock. If we are blocked for reboot, we should simply short-circuit the loop and try again later, like we do for other conditional outcomes that don't allow us to make forward progress.