From e5c91ff03afeaf8cf310c46c4a99c806bf2dcda0 Mon Sep 17 00:00:00 2001 From: Misaki Kasumi Date: Tue, 20 Aug 2024 17:41:00 +0800 Subject: [PATCH] quadlet: set infra name to %s-infra e.g.: if the pod name is systemd-awd, the name of its infra container will be systemd-awd-infra Signed-off-by: Misaki Kasumi --- pkg/systemd/quadlet/quadlet.go | 1 + test/e2e/quadlet/basic.pod | 2 +- test/e2e/quadlet/name.pod | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/systemd/quadlet/quadlet.go b/pkg/systemd/quadlet/quadlet.go index 2509259d3d..3c06a4bff4 100644 --- a/pkg/systemd/quadlet/quadlet.go +++ b/pkg/systemd/quadlet/quadlet.go @@ -1656,6 +1656,7 @@ func ConvertPod(podUnit *parser.UnitFile, name string, unitsInfoMap map[string]* return nil, err } + execStartPre.addf("--infra-name=%s-infra", podName) execStartPre.addf("--name=%s", podName) handlePodmanArgs(podUnit, PodGroup, execStartPre) diff --git a/test/e2e/quadlet/basic.pod b/test/e2e/quadlet/basic.pod index 2b8a7bb1e4..ba507cf9aa 100644 --- a/test/e2e/quadlet/basic.pod +++ b/test/e2e/quadlet/basic.pod @@ -1,7 +1,7 @@ ## assert-key-is Unit RequiresMountsFor "%t/containers" ## assert-key-is Service Type forking ## assert-key-is Service SyslogIdentifier "%N" -## assert-key-is-regex Service ExecStartPre ".*/podman pod create --infra-conmon-pidfile=%t/%N.pid --pod-id-file=%t/%N.pod-id --exit-policy=stop --replace --name=systemd-basic" +## assert-key-is-regex Service ExecStartPre ".*/podman pod create --infra-conmon-pidfile=%t/%N.pid --pod-id-file=%t/%N.pod-id --exit-policy=stop --replace --infra-name=systemd-basic-infra --name=systemd-basic" ## assert-key-is-regex Service ExecStart ".*/podman pod start --pod-id-file=%t/%N.pod-id" ## assert-key-is-regex Service ExecStop ".*/podman pod stop --pod-id-file=%t/%N.pod-id --ignore --time=10" ## assert-key-is-regex Service ExecStopPost ".*/podman pod rm --pod-id-file=%t/%N.pod-id --ignore --force" diff --git a/test/e2e/quadlet/name.pod b/test/e2e/quadlet/name.pod index 33c528d7bc..40dcd67092 100644 --- a/test/e2e/quadlet/name.pod +++ b/test/e2e/quadlet/name.pod @@ -1,4 +1,5 @@ ## assert-podman-pre-args "--name=test-pod" +## assert-podman-pre-args "--infra-name=test-pod-infra" [Pod] PodName=test-pod