mirror of
https://github.com/containers/podman.git
synced 2025-06-24 03:08:13 +08:00
Merge pull request #19955 from rhatdan/quadlet
Add support for PidsLimit in quadlet
This commit is contained in:
@ -160,6 +160,7 @@ Valid options for `[Container]` are listed below:
|
||||
| NoNewPrivileges=true | --security-opt no-new-privileges |
|
||||
| Rootfs=/var/lib/rootfs | --rootfs /var/lib/rootfs |
|
||||
| Notify=true | --sdnotify container |
|
||||
| PidsLimit=10000 | --pids-limit 10000 |
|
||||
| PodmanArgs=--add-host foobar | --add-host foobar |
|
||||
| PublishPort=50-59 | --publish 50-59 |
|
||||
| Pull=never | --pull=never |
|
||||
@ -431,6 +432,11 @@ starts the child in the container. However, if the container application support
|
||||
`Notify` to true passes the notification details to the container allowing it to notify
|
||||
of startup on its own.
|
||||
|
||||
### `PidsLimit=`
|
||||
|
||||
Tune the container's pids limit.
|
||||
This is equivalent to the Podman `--pids-limit` option.
|
||||
|
||||
### `PodmanArgs=`
|
||||
|
||||
This key contains a list of arguments passed directly to the end of the `podman run` command
|
||||
|
@ -94,6 +94,7 @@ const (
|
||||
KeyNoNewPrivileges = "NoNewPrivileges"
|
||||
KeyNotify = "Notify"
|
||||
KeyOptions = "Options"
|
||||
KeyPidsLimit = "PidsLimit"
|
||||
KeyPodmanArgs = "PodmanArgs"
|
||||
KeyPublishPort = "PublishPort"
|
||||
KeyPull = "Pull"
|
||||
@ -169,6 +170,7 @@ var (
|
||||
KeyNetwork: true,
|
||||
KeyNoNewPrivileges: true,
|
||||
KeyNotify: true,
|
||||
KeyPidsLimit: true,
|
||||
KeyPodmanArgs: true,
|
||||
KeyPublishPort: true,
|
||||
KeyPull: true,
|
||||
@ -456,18 +458,23 @@ func ConvertContainer(container *parser.UnitFile, names map[string]string, isUse
|
||||
podman.add("--security-opt", "label:nested")
|
||||
}
|
||||
|
||||
securityLabelType, _ := container.Lookup(ContainerGroup, KeySecurityLabelType)
|
||||
if len(securityLabelType) > 0 {
|
||||
pidsLimit, ok := container.Lookup(ContainerGroup, KeyPidsLimit)
|
||||
if ok && len(pidsLimit) > 0 {
|
||||
podman.add("--pids-limit", pidsLimit)
|
||||
}
|
||||
|
||||
securityLabelType, ok := container.Lookup(ContainerGroup, KeySecurityLabelType)
|
||||
if ok && len(securityLabelType) > 0 {
|
||||
podman.add("--security-opt", fmt.Sprintf("label=type:%s", securityLabelType))
|
||||
}
|
||||
|
||||
securityLabelFileType, _ := container.Lookup(ContainerGroup, KeySecurityLabelFileType)
|
||||
if len(securityLabelFileType) > 0 {
|
||||
securityLabelFileType, ok := container.Lookup(ContainerGroup, KeySecurityLabelFileType)
|
||||
if ok && len(securityLabelFileType) > 0 {
|
||||
podman.add("--security-opt", fmt.Sprintf("label=filetype:%s", securityLabelFileType))
|
||||
}
|
||||
|
||||
securityLabelLevel, _ := container.Lookup(ContainerGroup, KeySecurityLabelLevel)
|
||||
if len(securityLabelLevel) > 0 {
|
||||
securityLabelLevel, ok := container.Lookup(ContainerGroup, KeySecurityLabelLevel)
|
||||
if ok && len(securityLabelLevel) > 0 {
|
||||
podman.add("--security-opt", fmt.Sprintf("label=level:%s", securityLabelLevel))
|
||||
}
|
||||
|
||||
|
6
test/e2e/quadlet/pids-limit.container
Normal file
6
test/e2e/quadlet/pids-limit.container
Normal file
@ -0,0 +1,6 @@
|
||||
## assert-podman-final-args localhost/imagename
|
||||
## assert-podman-args "--pids-limit" "8765432"
|
||||
|
||||
[Container]
|
||||
Image=localhost/imagename
|
||||
PidsLimit=8765432
|
Reference in New Issue
Block a user