feat(profile): add secrets handling to kubernetes and machine init profiles
Metadata
Current evaluation
Merged as 5888db42, adding Juju secrets handling to Charmcraft's Kubernetes and machine init profiles, including observed/app-managed secrets, rotation, expiry, and tests.
Resolution: closed resolved
Reason: PR #2814 was merged as commit 5888db42. The merged change adds secret configuration, lifecycle handling, and tests to both init profiles.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Extends both the `kubernetes` and `machine` profiles so that `charmcraft init` scaffolds a charm that handles Juju secrets from both sides, with unit and integration tests for it.
The profile is a strong signal to human and agentic charmers for best practices. Secrets are a good candidate for that signal because they are easy to get half-right: reading an observed secret once on `config-changed` looks correct until the operator adds a new revision and nothing happens, and rotating an owned secret looks correct until revisions pile up because nothing removes them. Both failures are silent, so the profile handles the full event set rather than the two events that are enough for a demo.
A charm also meets secrets in two roles that need different code — it observes secrets an operator grants it, and it owns secrets it generates for its workload. A charm author who has only seen one usually writes the other incorrectly.
### Changes
Both profiles in `charmcraft.yaml.j2`:
Adds an `api-token` config option of `type: secret`, with a description giving the operator the three commands they need (`juju add-secret`, `juju grant-secret`, `juju config`).
In both profiles, the observed secret:
`config-changed` and `secret-changed` share one `_configure_api_token()`, which fetches with `model.get_secret(id=..., label=API_TOKEN_LABEL)` and reads with `get_content(refresh=True)`. Attaching the label is what lets the `secret-changed` handler recognise the secret, since the event carries the label rather than the config value. A secret that isn't granted, or has gone away, leaves the unit blocked.
In both profiles, the app-managed secret:
The leader creates a workload password on `start` (machine) or `pebble-ready` (kubernetes), with monthly rotation and a 90 day expiry; creation is looked up by label first, so it's idempotent. `secret-rotate` and `secret-expired` both add a new revision — expiry doesn't remove the expiring revision, because that's the latest one and other units may still be reading it. `secret-remove` does the cleanup, once Juju reports that no unit is tracking a revision.
---
- [x] I've followed the [contribution guidelines](https://github.com/canonical/charmcraft/blob/main/CONTRIBUTING.md).
- [x] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/).
- [x] I've successfully run `make lint && make test`.
- [ ] ~I've added or updated any relevant documentation.~
- [ ] ~In documents I changed, I [added a meta description](https://canonical-starflow.readthedocs-hosted.com/how-to/add-a-page-meta-description/) if one was missing.~
- [x] I've updated the relevant release notes.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged as 5888db42, adding Juju secrets handling to Charmcraft's Kubernetes and machine init profiles, including observed/app-managed secrets, rotation, expiry, and tests. | |
| qwen/qwen3.8-27b | — | closed resolved | Merged as commit 5888db42. Adds Juju secrets handling to the kubernetes and machine init profiles: an api-token secret config option, observed-secret handling, and a leader-managed workload password with rotation/expiry, plus unit and integration tests. | |
| stealth/space-bunny-alpha |
Impact:
47
Quick Win:
15
Complexity:
52
Confidence:
89
Actionability:
68
|
needs review | Adds observed- and owned-secret examples, tests, and release notes to machine and Kubernetes init profiles; approved by three reviewers, with four unresolved threads and OSV still failing. | |
| stealth/space-bunny-alpha |
Impact:
52
Quick Win:
14
Complexity:
58
Confidence:
78
Actionability:
62
|
needs review | Adds observed and owned Juju secrets handling to Kubernetes and machine init profiles, with unit and integration tests. Approved by three reviewers; four comments remain unresolved, OSV-scanner fails, and snap/spread checks are pending. | |
| stealth/space-bunny-alpha |
Impact:
45
Quick Win:
9
Complexity:
58
Confidence:
91
Actionability:
48
|
keep open | Adds observed- and app-managed Juju secrets to Kubernetes and machine init profiles with tests; approved, but four review threads remain unresolved, OSV-scanner fails, and three build checks are pending. | |
| stealth/space-bunny-alpha |
Impact:
53
Quick Win:
22
Complexity:
47
Confidence:
81
Actionability:
78
|
needs review | Adds observed and owned Juju secrets patterns, tests, and release notes to Kubernetes and machine init profiles; approved by three reviewers, but four threads remain unresolved and OSV/scanning builds are incomplete. | |
| qwen3.6-35b-a3b-mtp-q6 |
Impact:
60
Quick Win:
27
Staleness:
35
Complexity:
55
Confidence:
75
|
needs review | Adds secrets handling to kubernetes and machine init profiles with unit and integration tests. Approved by 3 reviewers but has 4 unresolved comments and some CI failures. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
10
Complexity:
55
Confidence:
85
|
needs review | Extends kubernetes and machine init profiles with secrets handling scaffolding, including config options, event handlers, and tests. Currently approved by three reviewers but has four unresolved comments and failing CI checks on several Ubuntu versions. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
30
Complexity:
60
Confidence:
90
|
needs review | Adds secrets handling scaffolding to kubernetes and machine init profiles, including config options, event handlers for observed/owned secrets, and tests. Currently approved by 3 reviewers, CI passing, pending snap tests, with 4 unresolved review comments. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
10
Complexity:
45
Confidence:
85
|
needs review | Adds secrets handling scaffolding to kubernetes and machine init profiles, including unit/integration tests and config options. Currently approved by two reviewers but has 4 unresolved comments and pending CI checks. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
10
Complexity:
45
Confidence:
85
|
needs review | Extends kubernetes and machine init profiles to scaffold Juju secrets handling, covering observed and owned secret lifecycles with tests. Currently holds two approvals, has 4 unresolved review comments, and pending CI checks. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
25
Complexity:
65
Confidence:
85
|
needs review | Extends kubernetes and machine init profiles to scaffold Juju secrets handling, including observed and app-managed secret lifecycle management, configuration options, and integration tests. Currently approved by two reviewers but has eight unresolved comments and awaits maintainer feedback. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
15
Complexity:
50
Confidence:
85
|
needs review | Adds secrets handling scaffolding to Kubernetes and machine init profiles with unit and integration tests. Approved by two reviewers with passing CI, though eight review comments remain unresolved. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
15
Complexity:
65
Confidence:
85
|
needs review | Adds secrets handling scaffolding to Kubernetes and machine init profiles with unit and integration tests. Approved by two reviewers but has 8 unresolved comments and several failing CI checks. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
15
Complexity:
65
Confidence:
80
|
needs review | Extends kubernetes and machine init profiles to scaffold Juju secrets handling, including unit and integration tests. Currently approved by two reviewers but has seven unresolved comments and several failing CI checks. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
10
Complexity:
45
Confidence:
85
|
needs review | Adds secrets handling scaffolding to Kubernetes and machine init profiles with unit and integration tests. Currently approved by two reviewers, pending final CI suites, and has six unresolved review comments. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
15
Complexity:
65
Confidence:
85
|
needs review | Adds secrets handling scaffolding to kubernetes and machine init profiles with event handlers and tests. Currently approved by two reviewers but has seven unresolved comments and several failing CI checks. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
15
Complexity:
65
Confidence:
85
|
needs review | Extends kubernetes and machine init profiles to scaffold Juju secrets handling with tests. Currently holds one approval, has seven unresolved review comments, and shows minor OS-specific CI failures. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
15
Complexity:
65
Confidence:
85
|
needs review | Adds secrets handling scaffolding to kubernetes and machine init profiles, including config options, observed/app-managed secret logic, and tests. Currently approved by one reviewer, has 2 unresolved comments, and CI shows mixed results with some failing tests. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
10
Complexity:
50
Confidence:
80
|
needs review | Adds secrets handling scaffolding to Kubernetes and machine init profiles, including config options, observed and app-managed secret logic, and tests. Currently approved by one reviewer with two unresolved comments and pending CI checks. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
15
Complexity:
65
Confidence:
85
|
needs review | Extends kubernetes and machine init profiles to scaffold Juju secrets handling with unit and integration tests. Currently approved by one reviewer, has 2 unresolved comments, and several CI checks pending. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
15
Complexity:
55
Confidence:
85
|
needs review | Adds secrets handling scaffolding to Kubernetes and machine init profiles, including unit and integration tests. Currently approved by one reviewer with two unresolved comments, and several CI checks pending. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
15
Complexity:
65
Confidence:
85
|
needs review | Adds secrets handling scaffolding to kubernetes and machine init profiles, including config options, observed/app-managed secret lifecycle management, and tests. Currently approved by 1 reviewer, has 4 unresolved comments, and one failing CI check on minimum dependencies. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
10
Complexity:
55
Confidence:
85
|
needs review | Adds secrets handling scaffolding to kubernetes and machine init profiles, including config options, event handlers, and tests. Currently approved by one reviewer, has one unresolved comment, and one failing CI check on minimum dependencies. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
15
Complexity:
65
Confidence:
85
|
needs review | Extends kubernetes and machine init profiles with secrets handling scaffolding, including config options, event handlers, and tests. Currently approved with one unresolved review comment and a failing minimum-dependencies CI check. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
15
Complexity:
65
Confidence:
85
|
needs review | Adds secrets handling scaffolding to kubernetes and machine init profiles, including unit and integration tests for observed and app-managed secrets. Currently approved by one reviewer with passing CI checks and zero unresolved comments. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
35
Complexity:
55
Confidence:
85
|
needs review | Adds secrets handling scaffolding to Kubernetes and machine init profiles, including config options, observed/owned secret lifecycle management, and tests. Currently approved by one reviewer, pending CI completion, with one unresolved review comment. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
15
Complexity:
55
Confidence:
85
|
needs review | Adds secrets handling scaffolding to Kubernetes and machine init profiles, including config options, observed/app-managed secret logic, and tests. Currently approved by one reviewer, has one unresolved comment, and pending CI checks. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
15
Complexity:
45
Confidence:
85
|
needs review | Adds secrets handling scaffolding to Kubernetes and machine charm profiles, including unit/integration tests and full event handling for observed and owned secrets. Currently approved by one reviewer with one unresolved comment, and CI tests are pending. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
15
Complexity:
65
Confidence:
85
|
needs review | Adds secrets handling scaffolding to kubernetes and machine profiles in charmcraft init, including config options, observed/app-managed secret event handlers, and tests. Currently approved by one reviewer with four unresolved comments and minor CI failures. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
5
Complexity:
45
Confidence:
90
|
needs review | Adds secrets handling scaffolding to kubernetes and machine init profiles, including config options, event handlers, and tests. Currently awaiting maintainer review with passing CI. |
Update history
| Date | Change |
|---|---|
| closed | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| created |
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2813 feat(profile): add example action to kubernetes and machine init profiles | charmcraft | merged | Merged PR #2813, adding example pause/resume actions for machine charms and restart for Kubernetes charms to the charmcraft init profiles, complete with unit and integration tests. |