-
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#17560 from barrettj12/agenttools-modelsvc
juju#17560 The agenttools facade now uses a model config service to access model config, and a model agent service to access the current agent version (as introduced in juju#17598). Unfortunately, we can't entirely remove state from this facade yet, as we still need it to update the model. We introduce a new interfaces `ModelConfigService` and `ModelAgentService`, stored in `service.go`, and replaced with gomock-generated mocks in testing. BREAKING CHANGE: agenttools now checks all preferred streams in preference order, starting with the user-specified stream in `agent-stream`. Previously, it always checked the "released" stream first, even if a custom `agent-stream` was set, and it would only check the user-defined stream if nothing was found in "released". Additional changes: - Add a new env variable to the Makefile (`JUJU_PUBLISH_STREAM`) that allows `make simplestreams` to publish to a specified stream. - General modernising and code improvement on the agenttools facade, such as moving internal functions to methods on the API struct. ## Checklist <!-- If an item is not applicable, use `~strikethrough~`. --> - [x] Code style: imports ordered, good names, simple structure, etc - [x] Comments saying why design decisions were made - [x] Go unit tests, with comments saying what you're testing - ~[ ] [Integration tests](https://github.com/juju/juju/tree/main/tests), with comments saying what you're testing~ - ~[ ] [doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages~ ## QA steps <!-- Describe steps to verify that the change works. --> This facade reads the following keys from model config: `agent-version`, `agent-stream`, `development`. `agent-version` is immutable, but the other two can be changed and observed to have an effect. By default, the toolsversionchecker worker checks for updated tools every six hours. To QA this, we need to set this value to something much smaller, e.g. 5 seconds: https://github.com/juju/juju/blob/65266db76c2f84e4a545a574d4db82d3388d89eb/internal/worker/toolsversionchecker/manifold.go#L47-L49 Publish simplestreams data into "proposed" and "devel" streams: ```bash # set version to 4.0-beta5 $ JUJU_PUBLISH_STREAM=proposed make simplestreams # set version to 4.0-beta5 $ JUJU_PUBLISH_STREAM=devel make simplestreams # set version back to 4.0-beta4 $ make go-build ``` Start the simplestreams server: ``` $ cd _build/simplestreams/tools $ python3 -m http.server Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ... ``` Use `hostname -I | cut -d' ' -f1` to get your computer's IP address, we will feed this to Juju config. Bootstrap Juju with the given simplestreams server, and `agent-stream` initially set to "proposed": ```bash juju bootstrap lxd c \n --config agent-metadata-url=http://192.168.1.25:8000/ \n --config agent-stream=proposed ``` Switch to the `controller` model and run `juju status`. We should see that an upgrade to 4.0-beta5 is available. ``` $ juju status Model Controller Cloud/Region Version Timestamp Notes controller c localhost/localhost 4.0-beta4.1 17:02:06+12:00 upgrade available: 4.0-beta5 ``` Now change the agent stream to `devel`, wait for the toolsversionchecker worker to update, and check that an upgrade to 4.0-beta6 is available. ``` $ juju model-config agent-stream=devel $ juju status Model Controller Cloud/Region Version Timestamp Notes controller c localhost/localhost 4.0-beta4.1 17:02:06+12:00 upgrade available: 4.0-beta6 ``` You can do the same with the `development` model config key and the `devel` stream, however observe that this key only has an effect for non-development versions of Juju, so you would have to try it with versions e.g. 4.0.0 and 4.0.1. ## Links <!-- Link to all relevant specification, documentation, bug, issue or JIRA card. --> **Jira card:** JUJU-6104
- Loading branch information
Showing
7 changed files
with
283 additions
and
93 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
Oops, something went wrong.