From d1c43e3ae84c107d3c22918375261a333dc53728 Mon Sep 17 00:00:00 2001 From: ByoungUk Lee Date: Wed, 8 Oct 2025 07:50:47 +0000 Subject: [PATCH] Fixed #27120: Pod Quadlet can configure podman pod stop --time Signed-off-by: ByoungUk Lee --- pkg/systemd/quadlet/quadlet.go | 7 ++++++- test/e2e/quadlet/stoptimeout.pod | 8 ++++++++ test/e2e/quadlet_test.go | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 test/e2e/quadlet/stoptimeout.pod diff --git a/pkg/systemd/quadlet/quadlet.go b/pkg/systemd/quadlet/quadlet.go index c077043f9d..80eb2f0fa1 100644 --- a/pkg/systemd/quadlet/quadlet.go +++ b/pkg/systemd/quadlet/quadlet.go @@ -485,6 +485,7 @@ var ( KeyRemapUsers: true, KeyServiceName: true, KeyShmSize: true, + KeyStopTimeout: true, KeySubGIDMap: true, KeySubUIDMap: true, KeyUIDMap: true, @@ -1552,9 +1553,13 @@ func ConvertPod(podUnit *parser.UnitFile, unitsInfoMap map[string]*UnitInfo, isU execStop := createBasePodmanCommand(podUnit, PodGroup) execStop.add("pod", "stop") + stopTimeout := "10" + if value, ok := podUnit.Lookup(PodGroup, KeyStopTimeout); ok { + stopTimeout = value + } execStop.add( "--ignore", - "--time=10", + fmt.Sprintf("--time=%s", stopTimeout), podName, ) service.AddCmdline(ServiceGroup, "ExecStop", execStop.Args) diff --git a/test/e2e/quadlet/stoptimeout.pod b/test/e2e/quadlet/stoptimeout.pod new file mode 100644 index 0000000000..3162612fd1 --- /dev/null +++ b/test/e2e/quadlet/stoptimeout.pod @@ -0,0 +1,8 @@ +## assert-podman-stop-args --time=20 + +[Unit] +Description=A pod with a custom stop timeout + +[Pod] +PodName=test-pod +StopTimeout=20 diff --git a/test/e2e/quadlet_test.go b/test/e2e/quadlet_test.go index 44dad370d5..30e38cdf4c 100644 --- a/test/e2e/quadlet_test.go +++ b/test/e2e/quadlet_test.go @@ -1093,6 +1093,7 @@ BOGUS=foo Entry("Pod - Remap keep-id", "remap-keep-id.pod"), Entry("Pod - Remap manual", "remap-manual.pod"), Entry("Pod - Shm Size", "shmsize.pod"), + Entry("Pod - StopTimeout", "stoptimeout.pod"), Entry("Pod - Service Environment", "service-environment.pod"), )