diff options
author | Valentin Rothberg <vrothberg@redhat.com> | 2022-09-07 11:45:30 +0200 |
---|---|---|
committer | Valentin Rothberg <vrothberg@redhat.com> | 2022-09-09 13:02:05 +0200 |
commit | aad29e759c78b415a3b0393d7aba2bddbbc0cd3e (patch) | |
tree | 86597d8d17a5bab7ee0417166c448249f86954eb /pkg/specgenutil | |
parent | 6d8bafe57a65970ead17a83cb1983629b3a2aedb (diff) | |
download | podman-aad29e759c78b415a3b0393d7aba2bddbbc0cd3e.tar.gz podman-aad29e759c78b415a3b0393d7aba2bddbbc0cd3e.tar.bz2 podman-aad29e759c78b415a3b0393d7aba2bddbbc0cd3e.zip |
health check: add on-failure actions
For systems that have extreme robustness requirements (edge devices,
particularly those in difficult to access environments), it is important
that applications continue running in all circumstances. When the
application fails, Podman must restart it automatically to provide this
robustness. Otherwise, these devices may require customer IT to
physically gain access to restart, which can be prohibitively difficult.
Add a new `--on-failure` flag that supports four actions:
- **none**: Take no action.
- **kill**: Kill the container.
- **restart**: Restart the container. Do not combine the `restart`
action with the `--restart` flag. When running inside of
a systemd unit, consider using the `kill` or `stop`
action instead to make use of systemd's restart policy.
- **stop**: Stop the container.
To remain backwards compatible, **none** is the default action.
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Diffstat (limited to 'pkg/specgenutil')
-rw-r--r-- | pkg/specgenutil/specgen.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/specgenutil/specgen.go b/pkg/specgenutil/specgen.go index 439a13385..3189926b2 100644 --- a/pkg/specgenutil/specgen.go +++ b/pkg/specgenutil/specgen.go @@ -265,6 +265,13 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *entities.ContainerCreateOptions Test: []string{"NONE"}, } } + + onFailureAction, err := define.ParseHealthCheckOnFailureAction(c.HealthOnFailure) + if err != nil { + return err + } + s.HealthCheckOnFailureAction = onFailureAction + if err := setNamespaces(s, c); err != nil { return err } |