Skip to content

Commit ead8bdd

Browse files
committed
pkg/config: add new healthcheck_events field
Some users wish to turn of healthcheck events in Podman so add a config option to allow that. The actual logic must live in Podman. Link: https://issues.redhat.com/browse/RHEL-18987 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
1 parent 3e19fe1 commit ead8bdd

File tree

7 files changed

+41
-0
lines changed

7 files changed

+41
-0
lines changed

docs/containers.conf.5.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,17 @@ Valid values are: `file`, `journald`, and `none`.
603603
Creates a more verbose container-create event which includes a JSON payload
604604
with detailed information about the container. Set to false by default.
605605

606+
**healthcheck_events**=true|false
607+
608+
Whenever Podman should log healthcheck events.
609+
With many running healthcheck on short interval Podman will spam the event
610+
log a lot as it generates a event for each single healthcheck run. Because
611+
this event is optional and only useful to external consumers that may want
612+
to know when a healthcheck is run or failed allow users to turn it off by
613+
setting it to false.
614+
615+
Default is true.
616+
606617
**helper_binaries_dir**=["/usr/libexec/podman", ...]
607618

608619
A is a list of directories which are used to search for helper binaries.

pkg/config/config.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,13 @@ type EngineConfig struct {
318318
// graphRoot internal stores the location of the graphroot
319319
graphRoot string
320320

321+
// HealthcheckEvents is set to indicate whenever podman should log healthcheck events.
322+
// With many running healthcheck on short interval Podman will spam the event log a lot.
323+
// Because this event is optional and only useful to external consumers that may want to
324+
// know when a healthcheck is run or failed allow users to turn it off by setting it to false.
325+
// Default is true.
326+
HealthcheckEvents bool `toml:"healthcheck_events,omitempty"`
327+
321328
// HelperBinariesDir is a list of directories which are used to search for
322329
// helper binaries.
323330
HelperBinariesDir attributedstring.Slice `toml:"helper_binaries_dir,omitempty"`

pkg/config/config_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ image_copy_tmp_dir="storage"`
184184
defaultConfig, _ := defaultConfig()
185185
// prior to reading local config, shows hard coded defaults
186186
gomega.Expect(defaultConfig.Containers.HTTPProxy).To(gomega.BeTrue())
187+
gomega.Expect(defaultConfig.Engine.HealthcheckEvents).To(gomega.BeTrue())
187188

188189
err := readConfigFromFile("testdata/containers_default.conf", defaultConfig, false)
189190

@@ -306,6 +307,7 @@ image_copy_tmp_dir="storage"`
306307
gomega.Expect(defaultConfig.Engine.InfraImage).To(gomega.BeEquivalentTo("k8s.gcr.io/pause:3.4.1"))
307308
gomega.Expect(defaultConfig.Machine.Volumes.Get()).To(gomega.BeEquivalentTo(volumes))
308309
gomega.Expect(defaultConfig.Engine.PodmanshTimeout).To(gomega.BeEquivalentTo(300))
310+
gomega.Expect(defaultConfig.Engine.HealthcheckEvents).To(gomega.BeFalse())
309311
newV, err := defaultConfig.MachineVolumes()
310312
if newVolumes[0] == ":" {
311313
// $HOME is not set

pkg/config/containers.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,15 @@ default_sysctls = [
529529
# with detailed information about the container.
530530
#events_container_create_inspect_data = false
531531

532+
# Whenever Podman should log healthcheck events.
533+
# With many running healthcheck on short interval Podman will spam the event
534+
# log a lot as it generates a event for each single healthcheck run. Because
535+
# this event is optional and only useful to external consumers that may want
536+
# to know when a healthcheck is run or failed allow users to turn it off by
537+
# setting it to false. The default is true.
538+
#
539+
#healthcheck_events = true
540+
532541
# A is a list of directories which are used to search for helper binaries.
533542
#
534543
#helper_binaries_dir = [

pkg/config/containers.conf-freebsd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,15 @@ default_sysctls = [
399399
#
400400
#events_logger = "file"
401401

402+
# Whenever Podman should log healthcheck events.
403+
# With many running healthcheck on short interval Podman will spam the event
404+
# log a lot as it generates a event for each single healthcheck run. Because
405+
# this event is optional and only useful to external consumers that may want
406+
# to know when a healthcheck is run or failed allow users to turn it off by
407+
# setting it to false. The default is true.
408+
#
409+
#healthcheck_events = true
410+
402411
# A is a list of directories which are used to search for helper binaries.
403412
#
404413
#helper_binaries_dir = [

pkg/config/default.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ func defaultEngineConfig() (*EngineConfig, error) {
344344
c.VolumePluginTimeout = DefaultVolumePluginTimeout
345345
c.CompressionFormat = "gzip"
346346

347+
c.HealthcheckEvents = true
347348
c.HelperBinariesDir.Set(defaultHelperBinariesDir)
348349
if additionalHelperBinariesDir != "" {
349350
// Prioritize additionalHelperBinariesDir over defaults.

pkg/config/testdata/containers_default.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ no_pivot_root = false
212212
# namespace is set, all containers and pods are visible.
213213
#namespace = ""
214214

215+
healthcheck_events = false
216+
215217
# A is a list of directories which are used to search for helper binaries.
216218
#
217219
helper_binaries_dir = [

0 commit comments

Comments
 (0)