diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-12-03 14:50:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-03 14:50:47 +0100 |
commit | f0f148c494711f679e75cff5542af75715978dbb (patch) | |
tree | 8d0d7320dc3c427350d1aa945f5cf9ada0748ed5 /pkg/systemd/generate/pods.go | |
parent | 0c6f1c4fb13e22ca8e97dd93fba9160d7ef573a1 (diff) | |
parent | c9ad1da51c6b1aa7eb531a2f9951aa853bdea109 (diff) | |
download | podman-f0f148c494711f679e75cff5542af75715978dbb.tar.gz podman-f0f148c494711f679e75cff5542af75715978dbb.tar.bz2 podman-f0f148c494711f679e75cff5542af75715978dbb.zip |
Merge pull request #12484 from machacekondra/restartSec
Add restart-sec option to systemd generate command
Diffstat (limited to 'pkg/systemd/generate/pods.go')
-rw-r--r-- | pkg/systemd/generate/pods.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/systemd/generate/pods.go b/pkg/systemd/generate/pods.go index 48252c737..f2d04dadc 100644 --- a/pkg/systemd/generate/pods.go +++ b/pkg/systemd/generate/pods.go @@ -30,6 +30,8 @@ type podInfo struct { StopTimeout uint // RestartPolicy of the systemd unit (e.g., no, on-failure, always). RestartPolicy string + // RestartSec of the systemd unit. Configures the time to sleep before restarting a service. + RestartSec uint // PIDFile of the service. Required for forking services. Must point to the // PID of the associated conmon process. PIDFile string @@ -89,6 +91,9 @@ Before={{{{- range $index, $value := .RequiredServices -}}}}{{{{if $index}}}} {{ [Service] Environment={{{{.EnvVariable}}}}=%n Restart={{{{.RestartPolicy}}}} +{{{{- if .RestartSec}}}} +RestartSec={{{{.RestartSec}}}} +{{{{- end}}}} TimeoutStopSec={{{{.TimeoutStopSec}}}} {{{{- if .ExecStartPre1}}}} ExecStartPre={{{{.ExecStartPre1}}}} @@ -242,6 +247,10 @@ func executePodTemplate(info *podInfo, options entities.GenerateSystemdOptions) info.RestartPolicy = *options.RestartPolicy } + if options.RestartSec != nil { + info.RestartSec = *options.RestartSec + } + // Make sure the executable is set. if info.Executable == "" { executable, err := os.Executable() |