[JUJU-523] Ensure a robust isController wrapper for machine manifolds #13668
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.
Some manifolds in the machine dependency engine are wrapped with
isController
to ensure they only run on controllers. This wrapper in turn has the state worker as a dependency.Depending on state in this case is problematic, because if the state fails to ping Mongo, all such workers will bounce whether or not they depend on state.
Instead we use the state config watcher, which determines whether we are a controller based on the presence of state serving info. This will remain static when we change the Mongo primary (and bounce the state worker), leaving fewer workers to restart in such an event.
In addition, some redundant usage of
isController
is removed where it is already implied by other dependencies.QA steps
juju enable-ha
.juju deploy ubuntu
.juju ssh 0
and runjuju_engine_report
.juju ssh -m controller 0
and runjuju_engine_report
.rs.stepDown()
In my simple A/B test, these workers did not bounce for a Mongo primary switch:
Documentation changes
None.
Bug reference
N/A