feat(templates): add workload module to Kubernetes and machine profiles
Metadata
Current evaluation
Merged. Adds a standalone workload module to Kubernetes and machine profiles, updates charmcraft init, refactors charm.py, and includes updated tests and docs. Approved by reviewers and passed CI.
Suggested action: —
No scores available.
Issue body
This PR update the `kubernetes` and `machine` profiles to include a standalone module for workload-specific logic. Other profiles are not changed in any way.
In addition to the new workload module, the updated profiles have a bit more structure in `charm.py` to illustrate the basic flow of logic through the charm & workload module, and improved unit tests in `test_charm.py`.
**This PR includes**
- New/updated template files for the `kubernetes` and `machine` profiles.
- Changes to `charmcraft/application/commands/init.py`, to determine the name of the workload module from the charm name (using `workload.py` if the charm has a generic name such as `charm` or `k8s-operator`).
- Changes to `tests/integration/commands/test_init.py`, to test the updated functionality (with tests passing).
- Updated help and output of `charmcraft init`, to make users aware of the workload module.
- New/updated reference docs:
- [`src/<workload>.py` file](https://canonical-charmcraft--2242.com.readthedocs.build/en/2242/reference/files/src-workload-py-file/) (new)
- [`src/charm.py` file](https://canonical-charmcraft--2242.com.readthedocs.build/en/2242/reference/files/src-charm-py-file/) (updated)
Hopefully it will be easy to follow my commits in sequence. I tried to make the changes in a logical step-by-step order.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged. Adds a standalone workload module to Kubernetes and machine profiles, updates charmcraft init, refactors charm.py, and includes updated tests and docs. Approved by reviewers and passed CI. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Introduces a standalone workload module for Kubernetes and machine profiles, updates charmcraft init to generate it, and adds corresponding tests and documentation. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Added a standalone workload module to Kubernetes and machine profiles, updating templates, charmcraft init logic, tests, and documentation. Improves charm structure and workflow clarity. |
Update history
No update history recorded yet.
Related issues
No related issues found above the similarity threshold.