Repository navigation
backport: feat(pro): manage the ubuntu-advantage charm from the manifest and store enable --manifest - #1039
Open
vsz-work wants to merge 2 commits into
Open
backport: feat(pro): manage the ubuntu-advantage charm from the manifest and store enable --manifest#1039vsz-work wants to merge 2 commits into
vsz-work wants to merge 2 commits into
Conversation
…g from the manifest
The deploy-pro plan only set the token on the ubuntu-advantage charm, so
contract_url and the other charm options kept their defaults. The only
way to change them was a manual `juju config`, which Sunbeam does not
own and can lose on a later apply or redeploy.
Register the ubuntu-advantage charm in the pro feature's default
software config, with UBUNTU_ADVANTAGE_CHANNEL (latest/edge, the
existing plan default) as its channel, and map its channel, revision
and config to new or existing plan variables, as other features do:
- ubuntu-advantage-channel (existing)
- ubuntu-advantage-revision (new, default null)
- ubuntu-advantage-config (new, map(string), default {})
Any charm option can now be set in the manifest, for example:
features:
pro:
software:
charms:
ubuntu-advantage:
config:
contract_url: https://contracts.example.com
The plan merges the manifest config under the token passed on the
command line, so the CLI token always wins over a token key in the
manifest.
Backport notes: stable/2024.1 still deploys the ubuntu-advantage charm
(the switch to ubuntu-pro is only on main), so the manifest key,
tfvars and default channel use the ubuntu-advantage names. The new
CHARM constant holds the charm name, which differs from the ubuntu-pro
application name; refresh looks manifest entries up by charm name.
The ubuntu-pro plan tests from main are not included.
Jira: OPEN-4937
Assisted-By: Claude Code (Claude Opus 5.5)
Related-Bug: #2174604
(cherry picked from commit 03ffd06)
Signed-off-by: Vítor Zeni <vitor.zeni@bairesdev.com>
Collaborator
|
Wrong merge base I guess? |
Author
Yep. Fixed it. |
vsz-work
marked this pull request as ready for review
November 23, 2026 17:22
vsz-work
force-pushed
the
2024.1/lp2174604-pro-contract-url
branch
2 times, most recently
from
November 24, 2026 11:55
3c5d965 to
d294736
Compare
…le> pro` The pro feature never stored a manifest given with --manifest. The file only applied to that one run, and a later `sunbeam enable pro <token>` read the latest manifest from clusterd, fell back to an empty charm config and dropped options such as contract_url again. Start the enable plan with AddManifestStep when --manifest is given, as the OpenStack features and telemetry already do. Like for those features, the file is stored as the whole latest manifest, so it should be a full manifest (e.g. from `sunbeam manifest show latest`) with the pro section added, not a pro-only file. Without --manifest the plan is unchanged. Jira: OPEN-4937 Assisted-By: Claude Code (Claude Opus 5.5) Closes-Bug: #2174604 Signed-off-by: Vítor Zeni <vitor.zeni@bairesdev.com> (cherry picked from commit 63bfa2b)
vsz-work
force-pushed
the
2024.1/lp2174604-pro-contract-url
branch
from
November 24, 2026 13:53
d294736 to
8a0d6ab
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
feat(pro): set the ubuntu-advantage charm channel, revision and config from the manifest03ffd06dchannel,revisionandconfig. The CLI token always wins over atokenkey in the manifestfix(pro): store the manifest passed to sunbeam enable --manifest <file> pro63bfa2b2enable --manifeststores the file as the latest manifest, so laterenable proruns keep the settingsAdaptations for 2024.1
stable/2024.1still deploys theubuntu-advantagecharm. The switch toubuntu-pro(#1020) is only on main, so the first commit doesn't apply cleanly and was adapted by hand:ubuntu-advantage, notubuntu-pro. A newCHARMconstant holds it. The Juju application is still namedubuntu-pro(APPLICATION), but manifest charm keys are charm names:sunbeam cluster refreshlooks entries up by the deployed charm name (find_charm), so the key has to match the charm.ubuntu-advantage-channel(existing), plus newubuntu-advantage-revisionandubuntu-advantage-config.latest/edge(UBUNTU_ADVANTAGE_CHANNEL), the existing default of the plan's channel variable. Main'slatest/stablewould silently move existing deployments to another channel on their next enable or refresh. A unit test checks that the constant and the variable default stay in sync.TestTerraformPlanchecks theubuntu-procharm from feat(pro): deploy the ubuntu-pro charm instead of ubuntu-advantage #1020, so it isn't included. The newTestManifestCharmConfigandTestRunEnablePlansuse the 2024.1 names.The second commit applied with only an import conflict in the tests.
Manifest example on 2024.1:
Caveat:
latest/edge→latest/stablecan't be done on 2024.1On 24.04 amd64,
ubuntu-advantagelatest/edge(rev 147, the 2024.1 default) is a charm format v2 build, andlatest/stable(rev 143) is v1. Juju refuses v2 → v1, so a manifest that setschannel: latest/stableon a deployment running edge fails insunbeam cluster refresh(QA B7):The charm is left unchanged and stays attached.
enable prowould most likely fail the same way, since the Juju provider issues the same refresh. Moving to stable needs a disable, then an enable with the stable channel. stable → edge works (QA B7c). This is a limit of the charm's packaging, not of this backport, but it's worth a line in the docs.Upgrade caveat: the manifest key differs from main
Sunbeam validates the stored manifest's charm keys on every command. If a 2024.1 deployment stores a
features.pro.software.charms.ubuntu-advantageentry and is later moved to a snap that only knowsubuntu-pro, every command that loads the manifest fails withManifest Software charms keys should be one of …. Deployments that never set a pro section aren't affected. Options:sunbeam cluster refresh --manifest <file>, before moving to a release with theubuntu-procharmubuntu-advantageas a legacy alias on main and rename it toubuntu-proon loadOpen to opinions. This doesn't block the backport, since 2024.1 deployments can't set a pro section today at all.
QA steps
Unit tests:
On a 2024.1 single-node deployment, with a snap built from this branch:
Tested
stable/2024.1+ this branchruff format,ruff checkandmypy sunbeamare cleanterraform fmt -checkandterraform validateondeploy-proubuntu-advantagelatest/edgerev 147, as before; tfvarsubuntu-advantage-channel: latest/edge, no-config;contract_urlis the charm defaultcontract_urlfrom--manifest(keyubuntu-advantage)ubuntu-advantage-config;juju configanduaclient.confshow the value; the charm re-attached; attached--manifestubuntu-advantageentry; the value is kepttokenkey in the manifest configcontract_urlback to the charm defaultenable profails:unknown option "contrct_url"; the unit stays active and attachedcluster refresh --manifest,latest/edge→latest/stableRunning refresh for app ubuntu-pro with manifest config), but Juju refused the downgrade (see the caveat above). Charm unchanged, still attachedlatest/stable, thencluster refreshtolatest/edgelatest/stablerev 143 from the manifest. Refresh with no pro section used the default entry: rev 143 →latest/edgerev 147,upgrade-charm+config-changed, no detach. CLI token kept; attached; stored manifest has no pro sectionenable proafter the refreshlatest/edge;Apply complete! Resources: 0 added, 0 changed, 0 destroyed; charm unchanged; attachedubuntu-proapp orjuju-inforelation left. Needs #1023Sunbeam VM run (2026-11-23):
2024.1/stablesnap (2024.1-d392d37a, rev 1169), then the QA snap installed over it. Juju 3.6.29.disable profails on 2024.1 too (machine_model_uuidunset). fix(pro): detach machines from Ubuntu Pro before removing the charm #1028 isn't included, so after each disable the machine was detached by hand.https://contracts.canonical.com/, as in feat(pro): manage the ubuntu-pro charm from the manifest and store enable --manifest #1032.B2, tfvars written by Sunbeam (token removed) and the charm's log:
{ "ubuntu-advantage-config": { "contract_url": "https://contracts.canonical.com/" }, "machine_model_uuid": "…" }B7c, refresh from
latest/stableto the defaultlatest/edge:The behaviour was tested end to end on main in #1032 (T1–T10, including
sunbeam cluster refresh).Links
ubuntu-procharm, main only)Jira card: OPEN-4732