Skip to content

Commit c324dbb

Browse files
Merge pull request #21049 from k9withabone/quadlet-ulimit-multiple
quadlet container support multiple Ulimit options
2 parents 702c6f8 + 6a96c8b commit c324dbb

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

docs/source/markdown/podman-systemd.unit.5.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,8 @@ This key can be listed multiple times.
659659

660660
Ulimit options. Sets the ulimits values inside of the container.
661661

662+
This key can be listed multiple times.
663+
662664
### `Unmask=`
663665

664666
Specify the paths to unmask separated by a colon. unmask=ALL or /path/1:/path/2, or shell expanded paths (/proc/*):

pkg/systemd/quadlet/quadlet.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,8 @@ func ConvertContainer(container *parser.UnitFile, names map[string]string, isUse
574574
podman.add("--security-opt", fmt.Sprintf("label=level:%s", securityLabelLevel))
575575
}
576576

577-
ulimit, ok := container.Lookup(ContainerGroup, KeyUlimit)
578-
if ok && len(ulimit) > 0 {
577+
ulimits := container.LookupAll(ContainerGroup, KeyUlimit)
578+
for _, ulimit := range ulimits {
579579
podman.add("--ulimit", ulimit)
580580
}
581581

test/e2e/quadlet/ulimit.container

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## assert-podman-final-args localhost/imagename
2-
## assert-podman-args "--ulimit nproc:1234:5678"
2+
## assert-podman-args --ulimit nproc=1234:5678
3+
## assert-podman-args --ulimit cpu=1234:5678
34

45
[Container]
56
Image=localhost/imagename
6-
Ulimit=nproc:1234:5678
7+
Ulimit=nproc=1234:5678
8+
Ulimit=cpu=1234:5678

test/e2e/quadlet_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,7 @@ BOGUS=foo
815815
Entry("subidmapping-with-remap.container", "subidmapping-with-remap.container", 1, "converting \"subidmapping-with-remap.container\": deprecated Remap keys are set along with explicit mapping keys"),
816816
Entry("sysctl.container", "sysctl.container", 0, ""),
817817
Entry("timezone.container", "timezone.container", 0, ""),
818+
Entry("ulimit.container", "ulimit.container", 0, ""),
818819
Entry("unmask.container", "unmask.container", 0, ""),
819820
Entry("user.container", "user.container", 0, ""),
820821
Entry("userns.container", "userns.container", 0, ""),

0 commit comments

Comments
 (0)