-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request juju#18068 from wallyworld/wireup-unit-life
juju#18068 Application and unit life is written to dqlite and so can be read from there. The facades which used to get the life value from mongo now use the domain service. There were domain state methods to get life but service methods were needed to expose these to the facades. As with the EnsureDead and Remove apiserver plugins which relied on a generic mongo FindEntity, the LifeGetter plugin is removed from facades and bespoke code used instead. The code calls the relevant GetUnitLife or GetApplicationLife. These common API plugins were meant to stop the code duplication on the facade structs. However, we ran have run into issues around versioning etc. One option we discussed at the time was to have an instance of the common struct instead of embedding it, and then thunk to it via a top level method on the facade. However, I wanted just to do it this way to start with - yes a bit of duplication etc. But it's minimal and is essentially just iterating over some api args, parsing a tag, doing an api call, returning result. Let's keep everything simple and flat to start with, and once all the facades have the common plugins refactored out and sittling on top of the new services, then we can look at optimisation, rather than doing it now (early) and maybe missing something. Not all places could be converted. Specifically, there's the life flag worker and similar which will need to be done separately. Also, there's places where more than just unit life is needed and that's not yet in dqlite. Another temporary compromise is to add a method to allow the state cleanup job to set an app life to dead in dqlite. This is because cleanup still happens in mongo and will be needed for a while until that get sorted out. The second commit reverts the use of domain errors outside the apiserver layer. The new work in this PR only uses generic errors and some existing code needed to be converted so that everything could work together. ## QA steps 1. test migration while units are still coming after after deployment, check the pre checks work, eg ``` $ juju migrate foo c2 ERROR source prechecks failed: unit ubuntu/1 not idle or executing (allocating) ``` after things quiesce, test migration works 2. test k8s scale down bootstrap to k8s juju deploy snappass-test -n 3 juju scale-application snappass-test 2 juju destroy-model foo ## Links **Jira card:** [JUJU-6591](https://warthogs.atlassian.net/browse/JUJU-6591) [JUJU-6591]: https://warthogs.atlassian.net/browse/JUJU-6591?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
- Loading branch information
Showing
82 changed files
with
1,520 additions
and
552 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.