Merge pull request #24359 from Honny1/startu-healthcheck-inspect

Show Startup HealthCheck configuration with `podman inspect`
This commit is contained in:
openshift-merge-bot[bot] 2024-10-24 16:25:35 +00:00 committed by GitHub
commit 2da21d1524
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 0 deletions

View File

@ -427,6 +427,8 @@ func (c *Container) generateInspectContainerConfig(spec *spec.Spec) *define.Insp
ctrConfig.StopSignal = signal.ToDockerFormat(c.config.StopSignal) ctrConfig.StopSignal = signal.ToDockerFormat(c.config.StopSignal)
// TODO: should JSON deep copy this to ensure internal pointers don't // TODO: should JSON deep copy this to ensure internal pointers don't
// leak. // leak.
ctrConfig.StartupHealthCheck = c.config.StartupHealthCheckConfig
ctrConfig.Healthcheck = c.config.HealthCheckConfig ctrConfig.Healthcheck = c.config.HealthCheckConfig
ctrConfig.HealthcheckOnFailureAction = c.config.HealthCheckOnFailureAction.String() ctrConfig.HealthcheckOnFailureAction = c.config.HealthCheckOnFailureAction.String()

View File

@ -57,6 +57,8 @@ type InspectContainerConfig struct {
Annotations map[string]string `json:"Annotations"` Annotations map[string]string `json:"Annotations"`
// Container stop signal // Container stop signal
StopSignal string `json:"StopSignal"` StopSignal string `json:"StopSignal"`
// Configured startup healthcheck for the container
StartupHealthCheck *StartupHealthCheck `json:"StartupHealthCheck,omitempty"`
// Configured healthcheck for the container // Configured healthcheck for the container
Healthcheck *manifest.Schema2HealthConfig `json:"Healthcheck,omitempty"` Healthcheck *manifest.Schema2HealthConfig `json:"Healthcheck,omitempty"`
// HealthcheckOnFailureAction defines an action to take once the container turns unhealthy. // HealthcheckOnFailureAction defines an action to take once the container turns unhealthy.

View File

@ -67,6 +67,9 @@ function _check_health {
run_podman inspect $ctrname --format "{{.Config.HealthcheckOnFailureAction}}" run_podman inspect $ctrname --format "{{.Config.HealthcheckOnFailureAction}}"
is "$output" "kill" "on-failure action is set to kill" is "$output" "kill" "on-failure action is set to kill"
run_podman inspect $ctrname --format "{{.Config.StartupHealthCheck.Test}}"
is "$output" "[CMD-SHELL /home/podman/healthcheck]" ".Config.StartupHealthCheck.Test"
current_time=$(date --iso-8601=ns) current_time=$(date --iso-8601=ns)
# We can't check for 'starting' because a 1-second interval is too # We can't check for 'starting' because a 1-second interval is too
# short; it could run healthcheck before we get to our first check. # short; it could run healthcheck before we get to our first check.