Skip to content

fix(quadlet): emit CPU resource limits via PodmanArgs#423

Merged
Jaro-c merged 1 commit into
developfrom
fix/quadlet-cpu
Jun 17, 2026
Merged

fix(quadlet): emit CPU resource limits via PodmanArgs#423
Jaro-c merged 1 commit into
developfrom
fix/quadlet-cpu

Conversation

@Jaro-c

@Jaro-c Jaro-c commented Jun 17, 2026

Copy link
Copy Markdown
Member

Closes #408.

Problem

generate quadlet silently dropped all CPU limits (cpus, cpuset, cpu_shares, cpu_quota, cpu_period) — neither emitted nor warned — while mem_limit/pids_limit were honored. Inconsistent and surprising: an operator's cpus: "2" had no effect in the generated unit.

Fix

CPU has no native [Container] Quadlet key in Podman 5.x (unlike Memory=/PidsLimit=), so route it through PodmanArgs=, mirroring the existing --memory handling. cpus falls back to deploy.resources.limits.cpus.

Verification

Real podup generate quadlet on a service with cpus/cpuset/cpu_shares now emits:

PodmanArgs=--cpus=1.5
PodmanArgs=--cpuset-cpus=0,1
PodmanArgs=--cpu-shares=512

Unit tests cover the five service-level keys and the deploy fallback. cargo fmt/clippy clean.

Note

internal/quadlet/unit.rs is now at 490/500 lines. The broader quadlet sweep (#419) will need to split this file to stay under the line-limit gate.

generate quadlet silently dropped all CPU limits (cpus, cpuset, cpu_shares,
cpu_quota, cpu_period) — neither emitted nor warned, while memory and pids
limits were honored. CPU has no native [Container] Quadlet key in Podman
5.x, so route it through PodmanArgs= exactly like --memory, with cpus
falling back to deploy.resources.limits.cpus.

Verified with a real generate: a service with cpus/cpuset/cpu_shares now
yields the matching PodmanArgs lines. Adds unit tests for the service-level
keys and the deploy fallback.

Closes #408

Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
@Jaro-c Jaro-c added type:bug Something broken prio:P2 Medium area:quadlet Quadlet / systemd unit generation labels Jun 17, 2026
@Jaro-c Jaro-c merged commit 2e049e7 into develop Jun 17, 2026
13 checks passed
@Jaro-c Jaro-c deleted the fix/quadlet-cpu branch June 17, 2026 10:59
Jaro-c added a commit that referenced this pull request Jun 17, 2026
…CPU/tmpfs, NOTICE) (#425)

Promote verified develop fixes to main (merge, **no tag** — not a
release; tag is cut later when releasing).

Brings to main:
- #421 (closes #417, P1): synthesize `<project>_default` network so
services with no `networks:` block resolve each other by name.
Real-Podman verified.
- #422 (#418 item 1): `deploy.restart_policy.condition: any` → `always`.
- #423 (closes #408): quadlet emits CPU limits via `PodmanArgs=`.
- #424 (#419 item 1): quadlet long-form tmpfs → `Tmpfs=`.
- #409: NOTICE `podman-compose` → `podup`.

All merged to develop individually with CI green + unit/integration
tests. No public API change (bug fixes); no version bump, no release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:quadlet Quadlet / systemd unit generation prio:P2 Medium type:bug Something broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant