Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion docs/source/markdown/podman-systemd.unit.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ a `$name.pod` file creates a `$name-pod.service` unit and a `systemd-$name` Podm

Valid options for `[Pod]` are listed below:

| **[Pod] options** | **podman pod create equivalent** |
| **[Pod] options** | **podman pod create equivalent** |
|-------------------------------------|----------------------------------------|
| AddHost=example\.com:192.168.10.11 | --add-host example.com:192.168.10.11 |
| ContainersConfModule=/etc/nvd\.conf | --module=/etc/nvd\.conf |
Expand All @@ -1042,6 +1042,7 @@ Valid options for `[Pod]` are listed below:
| PublishPort=8080:80 | --publish 8080:80 |
| ServiceName=name | Name the systemd unit `name.service` |
| ShmSize=100m | --shm-size=100m |
| StopTimeout=20 | --time=20 |
| SubGIDMap=gtest | --subgidname=gtest |
| SubUIDMap=utest | --subuidname=utest |
| UIDMap=0:10000:10 | --uidmap=0:10000:10 |
Expand Down Expand Up @@ -1210,6 +1211,12 @@ Size of /dev/shm.

This is equivalent to the Podman `--shm-size` option and generally has the form `number[unit]`

### `StopTimeout=`

Sets the time in seconds to wait for the pod to gracefully stop.
This value is equivalent to the `--time` argument in the podman `pod stop` command when the service is stopped.
After this period expires, any running containers in the pod are forcibly killed.

### `SubGIDMap=`

Create the pod in a new user namespace using the map with name in the /etc/subgid file.
Expand Down
7 changes: 6 additions & 1 deletion pkg/systemd/quadlet/quadlet.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ var (
KeyRemapUsers: true,
KeyServiceName: true,
KeyShmSize: true,
KeyStopTimeout: true,
KeySubGIDMap: true,
KeySubUIDMap: true,
KeyUIDMap: true,
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions test/e2e/quadlet/stoptimeout.pod
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions test/e2e/quadlet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
)

Expand Down