Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 2.9 into develop #13565

Merged
merged 16 commits into from
Dec 15, 2021
Merged

Merge 2.9 into develop #13565

merged 16 commits into from
Dec 15, 2021

Conversation

manadart
Copy link
Member

Merge from 2.9 bringing forward:

Minor conflicts including those typical to version bumps:

  • apiserver/facades/agent/uniter/mocks/newlxdprofile.go
  • cmd/juju/application/deployer/bundlehandler_test.go
  • scripts/win-installer/setup.iss
  • snap/snapcraft.yaml
  • version/version.go

manadart and others added 14 commits December 6, 2021 16:43
of *charm.URL.

There is an overhead for parsing the stored URL, which we are paying
whether we access it or not.
Include the application name to point user in the correct direction.
With bundle handling, any number of applications could cause the
problem.  LP 1931739.
Help with debugging later by using the required logger in ChangeConfig
if the model doesn't have one.
Fix for LP 1950237. Old controllers have the charm channel data, but do
not include it in FullStatus results.  It is available in
ApplicationInfo.  Covers cases where bundles are exported from old
controllers, edited to include a channel, and deployed with newer
clients.  There may be others.
Existing model data now ensures that the channel is provided, to
correctly determine if the bundle is attempting an upgrade by channel,
assume a stable channel if none is provided in the bundle.

Unit tests updated to include data as current controllers will return.
Include the application name so the person deploying the bundle has a
starting point to fix the error.
Allow the order of arguments to change from the expected alphabeticial
ordering.  Update the response appropriately too.
…ller

juju#13556

Fix 1950237 by using ApplicationsInfo to find existing channels, rather than the status output, which doesn't contain the data in pre-2.9 controllers. This will only be done for pre 2.9 controllers, as is the case when the defaultCharmSchema is charmstore. Nicely, ApplicationsInfo is a bulk api call. However this necessitated requiring applications to have a channel from the bundle. To keep compatibility assume stable if channel not specified in the bundle.

Fix 1931739 by updating the error messages to include the application name causing the failure. Helps finding the problem in the bundle, where multiple applications exist.

Now that ChangeConfig is internal to juju, ensure there is always a logger.

## QA steps

Please try various combinations of juju clients and controllers with deploying bundles and redeploying them with --dry-run to ensure no changes. Below are reproducers for the bugs resolved.

```console
$ sudo snap refresh juju --channel 2.8/stable
# using the snap juju:
$ juju bootstrap localhost two-eight
$ juju deploy cs:~ubuntu-mirror-charm-maintainers/ubuntu-mirror
Located charm "cs:~ubuntu-mirror-charm-maintainers/ubuntu-mirror-9".
Deploying charm "cs:~ubuntu-mirror-charm-maintainers/ubuntu-mirror-9".
$ juju deploy cs:~ubuntu-mirror-charm-maintainers/ubuntu-mirror --channel candidate ubuntu-mirror-candidate
Located charm "cs:~ubuntu-mirror-charm-maintainers/ubuntu-mirror-9".
Deploying charm "cs:~ubuntu-mirror-charm-maintainers/ubuntu-mirror-9".
$ juju export-bundle > /tmp/bundle.yaml

# edit the bundle to include the candidate channel for ubuntu-mirror-candidate

# with the 2.9 client:
$ juju deploy /tmp/bundle.yaml --dry-run
No changes to apply.
```

## Bug reference

https://bugs.launchpad.net/juju/+bug/1950237
https://bugs.launchpad.net/juju/+bug/1931739
was at the time (version 2.8) that stored *charm.URL instead of *string.
juju#13546

We have long stored in the unit Mongo document, an actual `*charm.URL` reference.

This of course is fraught with danger, as upstream changes to the library can change what is stored, and potentially render old documents incompatible with an updated type.

In addition, we instituted `GetBSON` and `SetBSON` helpers to handle persistence and retrieval, which were made non-trivial by the introduction of CharmHub and multiple possible formats for this URL.

We have ended up in a situation where we are paying a small overhead to parse this URL upon every access, even when we might not use the field.

Here we update the document to store a string, and only parse the URL at need. The patch is scoped only to what is necessary to change the one field in the unit document. We still do unnecessary conversion, and could benefit from changing the application document as well, including all the sundry methods that accept `*charm.URL`, but immediately stringify it for use.

Upgrades had one usage of the doc for a version 2.8 step. This is replaced with the old version of the doc still storing a `*charm.URL`.

## QA steps

- Bootstrap a 2.7 controller and `juju install ubuntu -n 3`.
- With this patch, `juju upgrade-controller --build-agent`.
- Run `juju upgrade-model` twice. It will jump to the latest 2.8, then this patch.
- Ensure that the logs show no errors relating to unit documents.

## Documentation changes

None.

## Bug reference

N/A
@manadart manadart added the 3.0 label Dec 10, 2021
Copy link
Member

@hmlanigan hmlanigan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you.

@manadart
Copy link
Member Author

Test failures:

  • BundleDeployRepositorySuite.TestDeployBundleSwitch
  • BundleDeployRepositorySuite.TestDeployBundleTwiceScaleUp

@hpidcock
Copy link
Member

Test failures:

  • BundleDeployRepositorySuite.TestDeployBundleSwitch
  • BundleDeployRepositorySuite.TestDeployBundleTwiceScaleUp

@hmlanigan any insights on these two tests? it looks related to #13556

channel request." Found with merge of 2.9 into develop.
commit "Fix tests related to channel/revision changes for client
compatibility with 2.9 < controllers"
@hmlanigan
Copy link
Member

@hpidcock, yes, new tests in develop which needed to be fix for #13556. fixed them.

@hmlanigan
Copy link
Member

$$merge$$

@jujubot jujubot merged commit ff9d528 into juju:develop Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants