Skip to content

Commit

Permalink
Merge pull request #21049 from k9withabone/quadlet-ulimit-multiple
Browse files Browse the repository at this point in the history
quadlet container support multiple Ulimit options
  • Loading branch information
openshift-merge-bot[bot] authored Dec 18, 2023
2 parents 702c6f8 + 6a96c8b commit c324dbb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/source/markdown/podman-systemd.unit.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,8 @@ This key can be listed multiple times.

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

This key can be listed multiple times.

### `Unmask=`

Specify the paths to unmask separated by a colon. unmask=ALL or /path/1:/path/2, or shell expanded paths (/proc/*):
Expand Down
4 changes: 2 additions & 2 deletions pkg/systemd/quadlet/quadlet.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,8 @@ func ConvertContainer(container *parser.UnitFile, names map[string]string, isUse
podman.add("--security-opt", fmt.Sprintf("label=level:%s", securityLabelLevel))
}

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

Expand Down
6 changes: 4 additions & 2 deletions test/e2e/quadlet/ulimit.container
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## assert-podman-final-args localhost/imagename
## assert-podman-args "--ulimit nproc:1234:5678"
## assert-podman-args --ulimit nproc=1234:5678
## assert-podman-args --ulimit cpu=1234:5678

[Container]
Image=localhost/imagename
Ulimit=nproc:1234:5678
Ulimit=nproc=1234:5678
Ulimit=cpu=1234:5678
1 change: 1 addition & 0 deletions test/e2e/quadlet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ BOGUS=foo
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"),
Entry("sysctl.container", "sysctl.container", 0, ""),
Entry("timezone.container", "timezone.container", 0, ""),
Entry("ulimit.container", "ulimit.container", 0, ""),
Entry("unmask.container", "unmask.container", 0, ""),
Entry("user.container", "user.container", 0, ""),
Entry("userns.container", "userns.container", 0, ""),
Expand Down

0 comments on commit c324dbb

Please sign in to comment.