feat(profile): add secrets handling to kubernetes and machine init profiles
Metadata
Current evaluation
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.
Suggested action: needs review
Reason: The PR has been approved by 3 reviewers but still has 4 unresolved review comments and CI failures on snap-tests (ubuntu-20.04-64, ubuntu-22.04-64, ubuntu-25.10-64). Maintainer review is needed to address these remaining issues before merging.
Impact:
60
Quick Win:
27.0
Staleness:
35
Complexity:
55
Confidence:
75
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 |
|---|---|---|---|---|
| qwen3.6-35b-a3b-mtp-q6 |
Impact:
60
Quick Win:
27.0
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 |
|---|---|
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| created |
Related issues
No related issues found above the similarity threshold.