Merge pull request #18788 from ygalblum/quadlet-pull

Quadlet - add support for Pull key in .container
This commit is contained in:
OpenShift Merge Robot
2023-06-05 11:27:21 -04:00
committed by GitHub
4 changed files with 21 additions and 2 deletions

View File

@ -121,6 +121,7 @@ Valid options for `[Container]` are listed below:
| Notify=true | --sdnotify container | | Notify=true | --sdnotify container |
| PodmanArgs=--add-host foobar | --add-host foobar | | PodmanArgs=--add-host foobar | --add-host foobar |
| PublishPort=true | --publish | | PublishPort=true | --publish |
| Pull=never | --pull=never |
| ReadOnly=true | --read-only | | ReadOnly=true | --read-only |
| RunInit=true | --init | | RunInit=true | --init |
| SeccompProfile=/tmp/s.json | --security-opt seccomp=/tmp/s.json | | SeccompProfile=/tmp/s.json | --security-opt seccomp=/tmp/s.json |
@ -283,8 +284,7 @@ Equivalent to the Podman `--hostname` option.
### `Image=` ### `Image=`
The image to run in the container. This image must be locally installed for the service to work The image to run in the container.
when it is activated, because the generated service file never tries to download images.
It is recommended to use a fully qualified image name rather than a short name, both for It is recommended to use a fully qualified image name rather than a short name, both for
performance and robustness reasons. performance and robustness reasons.
@ -391,6 +391,11 @@ allocated port can be found with the `podman port` command.
This key can be listed multiple times. This key can be listed multiple times.
### `Pull=`
Set the image pull policy.
This is equivalent to the Podman `--pull` option
### `ReadOnly=` (defaults to `no`) ### `ReadOnly=` (defaults to `no`)
If enabled, makes image read-only, with /var/tmp, /tmp and /run a tmpfs (unless disabled by `VolatileTmp=no`).r If enabled, makes image read-only, with /var/tmp, /tmp and /run a tmpfs (unless disabled by `VolatileTmp=no`).r

View File

@ -81,6 +81,7 @@ const (
KeyOptions = "Options" KeyOptions = "Options"
KeyPodmanArgs = "PodmanArgs" KeyPodmanArgs = "PodmanArgs"
KeyPublishPort = "PublishPort" KeyPublishPort = "PublishPort"
KeyPull = "Pull"
KeyReadOnly = "ReadOnly" KeyReadOnly = "ReadOnly"
KeyRemapGID = "RemapGid" KeyRemapGID = "RemapGid"
KeyRemapUID = "RemapUid" KeyRemapUID = "RemapUid"
@ -143,6 +144,7 @@ var (
KeyNotify: true, KeyNotify: true,
KeyPodmanArgs: true, KeyPodmanArgs: true,
KeyPublishPort: true, KeyPublishPort: true,
KeyPull: true,
KeyReadOnly: true, KeyReadOnly: true,
KeyRemapGID: true, KeyRemapGID: true,
KeyRemapUID: true, KeyRemapUID: true,
@ -625,6 +627,11 @@ func ConvertContainer(container *parser.UnitFile, isUser bool) (*parser.UnitFile
podman.add("--hostname", hostname) podman.add("--hostname", hostname)
} }
pull, ok := container.Lookup(ContainerGroup, KeyPull)
if ok && len(pull) > 0 {
podman.add("--pull", pull)
}
handlePodmanArgs(container, ContainerGroup, podman) handlePodmanArgs(container, ContainerGroup, podman)
if len(image) > 0 { if len(image) > 0 {

View File

@ -0,0 +1,6 @@
## assert-podman-final-args localhost/imagename
## assert-podman-args --pull never
[Container]
Image=localhost/imagename
Pull=never

View File

@ -578,6 +578,7 @@ var _ = Describe("quadlet system generator", func() {
Entry("mount.container", "mount.container"), Entry("mount.container", "mount.container"),
Entry("health.container", "health.container"), Entry("health.container", "health.container"),
Entry("hostname.container", "hostname.container"), Entry("hostname.container", "hostname.container"),
Entry("pull.container", "pull.container"),
Entry("basic.volume", "basic.volume"), Entry("basic.volume", "basic.volume"),
Entry("label.volume", "label.volume"), Entry("label.volume", "label.volume"),