Skip to content

Commit a77a758

Browse files
committed
Fixed #27120: Pod Quadlet can configure podman pod stop --time
Signed-off-by: ByoungUk Lee <[email protected]>
1 parent 7fecff5 commit a77a758

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

pkg/systemd/quadlet/quadlet.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ var (
485485
KeyRemapUsers: true,
486486
KeyServiceName: true,
487487
KeyShmSize: true,
488+
KeyStopTimeout: true,
488489
KeySubGIDMap: true,
489490
KeySubUIDMap: true,
490491
KeyUIDMap: true,
@@ -1552,9 +1553,13 @@ func ConvertPod(podUnit *parser.UnitFile, unitsInfoMap map[string]*UnitInfo, isU
15521553

15531554
execStop := createBasePodmanCommand(podUnit, PodGroup)
15541555
execStop.add("pod", "stop")
1556+
stopTimeout := "10"
1557+
if value, ok := podUnit.Lookup(PodGroup, "StopTimeout"); ok {
1558+
stopTimeout = value
1559+
}
15551560
execStop.add(
15561561
"--ignore",
1557-
"--time=10",
1562+
fmt.Sprintf("--time=%s", stopTimeout),
15581563
podName,
15591564
)
15601565
service.AddCmdline(ServiceGroup, "ExecStop", execStop.Args)

test/e2e/quadlet/stoptimeout.pod

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## assert-podman-stop-args --time=20
2+
3+
[Unit]
4+
Description=A pod with a custom stop timeout
5+
6+
[Pod]
7+
PodName=test-pod
8+
StopTimeout=20

test/e2e/quadlet_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,7 @@ BOGUS=foo
10931093
Entry("Pod - Remap keep-id", "remap-keep-id.pod"),
10941094
Entry("Pod - Remap manual", "remap-manual.pod"),
10951095
Entry("Pod - Shm Size", "shmsize.pod"),
1096+
Entry("Pod - StopTimeout", "stoptimeout.pod"),
10961097
Entry("Pod - Service Environment", "service-environment.pod"),
10971098
)
10981099

0 commit comments

Comments
 (0)