quadlet: support Memory= in [Container] sections

Maps to the `--memory=` flag.

Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
This commit is contained in:
Ben Boeckel
2025-02-17 17:25:06 +01:00
parent 10ab978c26
commit 543be25ef3
4 changed files with 15 additions and 0 deletions

View File

@ -319,6 +319,7 @@ Valid options for `[Container]` are listed below:
| LogDriver=journald | --log-driver journald |
| LogOpt=path=/var/log/mykube\.json | --log-opt path=/var/log/mykube\.json |
| Mask=/proc/sys/foo\:/proc/sys/bar | --security-opt mask=/proc/sys/foo:/proc/sys/bar |
| Memory=20g | --memory 20g |
| Mount=type=... | --mount type=... |
| Network=host | --network host |
| NetworkAlias=name | --network-alias name |
@ -659,6 +660,10 @@ This key can be listed multiple times.
Specify the paths to mask separated by a colon. `Mask=/path/1:/path/2`. A masked path cannot be accessed inside the container.
### `Memory=`
Specify the amount of memory for the container.
### `Mount=`
Attach a filesystem mount to the container.

View File

@ -122,6 +122,7 @@ const (
KeyLogDriver = "LogDriver"
KeyLogOpt = "LogOpt"
KeyMask = "Mask"
KeyMemory = "Memory"
KeyMount = "Mount"
KeyNetwork = "Network"
KeyNetworkAlias = "NetworkAlias"
@ -240,6 +241,7 @@ var (
KeyLogDriver: true,
KeyLogOpt: true,
KeyMask: true,
KeyMemory: true,
KeyMount: true,
KeyNetwork: true,
KeyNetworkAlias: true,
@ -635,6 +637,7 @@ func ConvertContainer(container *parser.UnitFile, isUser bool, unitsInfoMap map[
KeyStopSignal: "--stop-signal",
KeyStopTimeout: "--stop-timeout",
KeyPull: "--pull",
KeyMemory: "--memory",
}
lookupAndAddString(container, ContainerGroup, stringKeys, podman)

View File

@ -0,0 +1,6 @@
## assert-podman-final-args localhost/imagename
## assert-podman-args --memory 20g
[Container]
Image=localhost/imagename
Memory=20g

View File

@ -876,6 +876,7 @@ BOGUS=foo
Entry("logdriver.container", "logdriver.container"),
Entry("logopt.container", "logopt.container"),
Entry("mask.container", "mask.container"),
Entry("memory.container", "memory.container"),
Entry("name.container", "name.container"),
Entry("nestedselinux.container", "nestedselinux.container"),
Entry("network.container", "network.container"),