feat(podman): add a role that defaults to crun #58

Merged
claudiomaradonna merged 1 commit from feat/podman-crun into main 2026-11-22 21:33:03 +01:00
Collaborator

Why

castrum's service roles configure what a host runs once the host
switches them on. Hosts that run their containers with podman had no
such role: podman started containers with whatever OCI runtime it found,
runc where crun was not installed, and no flag said which hosts use
podman at all. The owner of a few podman workstations wants crun, the
runtime podman prefers, on every one of them.

What changed

A new service role, podman, switched on per host with
podman_enabled: true. It installs the distribution's crun package
and writes /etc/containers/containers.conf.d/castrum-runtime.conf,
which sets runtime = "crun" under [engine]. The host's own
containers.conf and other drop-ins stay as they are, and installing
podman stays with the host.

A host that sets the flag and whose podman --version does not answer
fails the run at this role, before the package and the drop-in, also
under --check. Under -e update_only=true the role does nothing.

Docker is outside this change: docker-engine and daemon.json are
untouched.

The role joins service_roles, the role catalogue and the update_only
table. A new gate, tests/gates/check_podman.sh, joins make check,
and a molecule scenario joins make test.

How to verify

Set up as CONTRIBUTING says. Base main at
9fe0d4b, branch feat/podman-crun at 58e673c.

  1. The refusal, run and passed on the branch:

    ./tests/gates/check_podman.sh
    

    It prints one line ending "with the flag off or under update_only
    nothing runs". Copied onto the base with its fixture, it fails with
    "The role 'podman' was not found".

  2. The install and the drop-in, untested: the environment the
    change was written in has no podman.

    ./tests/molecule/run.sh roles/podman
    

    Expected: the scenario converges, its idempotence step reports no
    change, and verify finds crun installed, the drop-in naming crun
    and the planted containers.conf and host-own.conf unchanged.

  3. On a host the role has run on, as the user who owns the containers:

    podman info --format '{{.Host.OCIRuntime.Name}}'
    

    Expected: crun. Untested: no playbook ran against a real host.

Checks run on the branch: make check passed, with its 16 gates and
the linters; make verify stopped at "ERROR: 'make test' needs
podman", so the molecule scenarios and the tag_propagation gate did
not run.

Considerations

  • The molecule scenario has never run; its playbooks were read by two
    reviewers. Run step 2 before merging.
  • The scenario stubs podman, since Debian's package depends on crun
    or runc and would leave the role nothing to install. No test
    exercises a real podman reading the drop-in.
  • A container keeps the runtime it was created with, so crun runs only
    the containers created after the role.
  • A host drop-in that sorts after castrum-runtime.conf and names a
    runtime wins, as does a user's own
    ~/.config/containers/containers.conf; the README says so.
  • Set aside, rated low in the second review round: the gate asserts
    that the refusal names the flag, not the return code and stderr the
    message also prints.
## Why castrum's service roles configure what a host runs once the host switches them on. Hosts that run their containers with podman had no such role: podman started containers with whatever OCI runtime it found, runc where crun was not installed, and no flag said which hosts use podman at all. The owner of a few podman workstations wants crun, the runtime podman prefers, on every one of them. ## What changed A new service role, `podman`, switched on per host with `podman_enabled: true`. It installs the distribution's `crun` package and writes `/etc/containers/containers.conf.d/castrum-runtime.conf`, which sets `runtime = "crun"` under `[engine]`. The host's own `containers.conf` and other drop-ins stay as they are, and installing podman stays with the host. A host that sets the flag and whose `podman --version` does not answer fails the run at this role, before the package and the drop-in, also under `--check`. Under `-e update_only=true` the role does nothing. Docker is outside this change: `docker-engine` and `daemon.json` are untouched. The role joins `service_roles`, the role catalogue and the `update_only` table. A new gate, `tests/gates/check_podman.sh`, joins `make check`, and a molecule scenario joins `make test`. ## How to verify Set up as [CONTRIBUTING](CONTRIBUTING.md#setup) says. Base `main` at 9fe0d4b, branch `feat/podman-crun` at 58e673c. 1. The refusal, run and passed on the branch: ```bash ./tests/gates/check_podman.sh ``` It prints one line ending "with the flag off or under update_only nothing runs". Copied onto the base with its fixture, it fails with "The role 'podman' was not found". 2. The install and the drop-in, **untested**: the environment the change was written in has no podman. ```bash ./tests/molecule/run.sh roles/podman ``` Expected: the scenario converges, its idempotence step reports no change, and verify finds `crun` installed, the drop-in naming crun and the planted `containers.conf` and `host-own.conf` unchanged. 3. On a host the role has run on, as the user who owns the containers: ```bash podman info --format '{{.Host.OCIRuntime.Name}}' ``` Expected: `crun`. Untested: no playbook ran against a real host. Checks run on the branch: `make check` passed, with its 16 gates and the linters; `make verify` stopped at "ERROR: 'make test' needs podman", so the molecule scenarios and the `tag_propagation` gate did not run. ## Considerations - The molecule scenario has never run; its playbooks were read by two reviewers. Run step 2 before merging. - The scenario stubs `podman`, since Debian's package depends on crun or runc and would leave the role nothing to install. No test exercises a real podman reading the drop-in. - A container keeps the runtime it was created with, so crun runs only the containers created after the role. - A host drop-in that sorts after `castrum-runtime.conf` and names a runtime wins, as does a user's own `~/.config/containers/containers.conf`; the README says so. - Set aside, rated low in the second review round: the gate asserts that the refusal names the flag, not the return code and stderr the message also prints.
feat(podman): add a role that defaults to crun
All checks were successful
check / check (pull_request) Successful in 20m34s
check / check (push) Successful in 20m38s
58e673cc23
Hosts that run containers with podman started them with whatever OCI
runtime podman found, runc where crun was not installed, and no role
or flag said which hosts use podman.

The role is switched on per host with podman_enabled. It leaves
installing podman to the host and fails a host whose podman does not
answer, so the flag cannot claim an engine that is not there.

The molecule scenario stubs podman: Debian's package depends on crun
or runc and would leave the role nothing to install.
claudiomaradonna deleted branch feat/podman-crun 2026-11-22 21:33:11 +01:00
Sign in to join this conversation.
No description provided.