diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-09-09 15:17:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-09 15:17:19 +0200 |
commit | 7e7db23dbf163837ba3216fea09b31d2c8409fb3 (patch) | |
tree | ae14de85a086738fa1bcdb24b06506bea72b4f7b /pkg/specgen | |
parent | b239966d11cd7b5f7d8c84190c579afc093bc3bf (diff) | |
parent | aad29e759c78b415a3b0393d7aba2bddbbc0cd3e (diff) | |
download | podman-7e7db23dbf163837ba3216fea09b31d2c8409fb3.tar.gz podman-7e7db23dbf163837ba3216fea09b31d2c8409fb3.tar.bz2 podman-7e7db23dbf163837ba3216fea09b31d2c8409fb3.zip |
Merge pull request #15687 from vrothberg/RUN-1639
health check: add on-failure actions
Diffstat (limited to 'pkg/specgen')
-rw-r--r-- | pkg/specgen/generate/container_create.go | 4 | ||||
-rw-r--r-- | pkg/specgen/specgen.go | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go index 4d5ac22ad..8900d2e5d 100644 --- a/pkg/specgen/generate/container_create.go +++ b/pkg/specgen/generate/container_create.go @@ -515,6 +515,10 @@ func createContainerOptions(rt *libpod.Runtime, s *specgen.SpecGenerator, pod *l logrus.Debugf("New container has a health check") } + if s.ContainerHealthCheckConfig.HealthCheckOnFailureAction != define.HealthCheckOnFailureActionNone { + options = append(options, libpod.WithHealthCheckOnFailureAction(s.ContainerHealthCheckConfig.HealthCheckOnFailureAction)) + } + if len(s.Secrets) != 0 { manager, err := rt.SecretsManager() if err != nil { diff --git a/pkg/specgen/specgen.go b/pkg/specgen/specgen.go index 51b6736a9..34418c132 100644 --- a/pkg/specgen/specgen.go +++ b/pkg/specgen/specgen.go @@ -9,6 +9,7 @@ import ( "github.com/containers/common/libimage" nettypes "github.com/containers/common/libnetwork/types" "github.com/containers/image/v5/manifest" + "github.com/containers/podman/v4/libpod/define" "github.com/containers/storage/types" spec "github.com/opencontainers/runtime-spec/specs-go" ) @@ -533,7 +534,8 @@ type ContainerResourceConfig struct { // ContainerHealthCheckConfig describes a container healthcheck with attributes // like command, retries, interval, start period, and timeout. type ContainerHealthCheckConfig struct { - HealthConfig *manifest.Schema2HealthConfig `json:"healthconfig,omitempty"` + HealthConfig *manifest.Schema2HealthConfig `json:"healthconfig,omitempty"` + HealthCheckOnFailureAction define.HealthCheckOnFailureAction `json:"health_check_on_failure_action,omitempty"` } // SpecGenerator creates an OCI spec and Libpod configuration options to create |