quadlet: allow variables in PublishPort

There is no reason to validate the args here, first podman may change
the syntax so this is just duplication that may hurt us long term. It
also added special handling of some options that just do not make sense,
i.e. removing 0.0.0.0, podman should really be the only parser here. And
more importantly this prevents variables from being used.

Fixes #24081

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2024-10-01 09:58:23 +02:00
parent a3ba5ff320
commit abc4cfb049
3 changed files with 18 additions and 76 deletions

View File

@@ -8,19 +8,19 @@ ExposeHostPort=2000-3000
## assert-podman-args --publish 127.0.0.1:80:90
PublishPort=127.0.0.1:80:90
## assert-podman-args --publish 80:91
## assert-podman-args --publish 0.0.0.0:80:91
PublishPort=0.0.0.0:80:91
## assert-podman-args --publish 80:92
## assert-podman-args --publish :80:92
PublishPort=:80:92
## assert-podman-args --publish 127.0.0.1::93
PublishPort=127.0.0.1::93
## assert-podman-args --publish 94
## assert-podman-args --publish 0.0.0.0::94
PublishPort=0.0.0.0::94
## assert-podman-args --publish 95
## assert-podman-args --publish ::95
PublishPort=::95
## assert-podman-args --publish 80:96
@@ -47,6 +47,11 @@ PublishPort=1234:1234/tcp
## assert-podman-args --publish 127.0.0.1:1234:1234/tcp
PublishPort=127.0.0.1:1234:1234/tcp
# https://github.com/containers/podman/issues/24081
# Allow variables to be used as systemd expands them at runtime.
## assert-podman-args --publish ${PORT}:${PORT}
PublishPort=${PORT}:${PORT}
## assert-podman-args --expose=2000-3000/udp
ExposeHostPort=2000-3000/udp

View File

@@ -4,19 +4,19 @@ Yaml=/opt/k8s/deployment.yml
## assert-podman-args --publish 127.0.0.1:80:90
PublishPort=127.0.0.1:80:90
## assert-podman-args --publish 80:91
## assert-podman-args --publish 0.0.0.0:80:91
PublishPort=0.0.0.0:80:91
## assert-podman-args --publish 80:92
## assert-podman-args --publish :80:92
PublishPort=:80:92
## assert-podman-args --publish 127.0.0.1::93
PublishPort=127.0.0.1::93
## assert-podman-args --publish 94
## assert-podman-args --publish 0.0.0.0::94
PublishPort=0.0.0.0::94
## assert-podman-args --publish 95
## assert-podman-args --publish ::95
PublishPort=::95
## assert-podman-args --publish 80:96