From 741c057c00de2d4724afefea3e5fe8886c23fe14 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Thu, 17 Nov 2022 18:39:17 +0100 Subject: [PATCH] containers.conf: add events_container_create_inspect_data Add an option to create a more verbose container-create event which includes a JSON payload with detailed information about the container. Jira: https://issues.redhat.com/browse/RUN-1702 Signed-off-by: Valentin Rothberg --- pkg/config/config.go | 5 +++++ pkg/config/config_test.go | 2 ++ pkg/config/containers.conf | 4 ++++ pkg/config/testdata/containers_override.conf | 1 + 4 files changed, 12 insertions(+) diff --git a/pkg/config/config.go b/pkg/config/config.go index 26c5d6e27..695a0495e 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -273,6 +273,11 @@ type EngineConfig struct { // EventsLogger determines where events should be logged. EventsLogger string `toml:"events_logger,omitempty"` + // EventsContainerCreateInspectData creates a more verbose + // container-create event which includes a JSON payload with detailed + // information about the container. + EventsContainerCreateInspectData bool `toml:"events_container_create_inspect_data,omitempty"` + // graphRoot internal stores the location of the graphroot graphRoot string diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 9c612598e..29ee501bf 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -35,6 +35,7 @@ var _ = Describe("Config", func() { gomega.Expect(defaultConfig.Engine.InfraImage).To(gomega.BeEquivalentTo("")) gomega.Expect(defaultConfig.Engine.ImageVolumeMode).To(gomega.BeEquivalentTo("bind")) gomega.Expect(defaultConfig.Engine.SSHConfig).To(gomega.ContainSubstring("/.ssh/config")) + gomega.Expect(defaultConfig.Engine.EventsContainerCreateInspectData).To(gomega.BeFalse()) path, err := defaultConfig.ImageCopyTmpDir() gomega.Expect(err).To(gomega.BeNil()) gomega.Expect(path).To(gomega.BeEquivalentTo("/var/tmp")) @@ -446,6 +447,7 @@ image_copy_tmp_dir="storage"` gomega.Expect(config.Engine.PlatformToOCIRuntime).To(gomega.Equal(PlatformToOCIRuntimeMap)) gomega.Expect(config.Engine.ImageDefaultFormat).To(gomega.Equal("v2s2")) gomega.Expect(config.Engine.EventsLogFilePath).To(gomega.BeEquivalentTo("/tmp/events.log")) + gomega.Expect(config.Engine.EventsContainerCreateInspectData).To(gomega.BeTrue()) path, err := config.ImageCopyTmpDir() gomega.Expect(err).To(gomega.BeNil()) gomega.Expect(path).To(gomega.BeEquivalentTo("/tmp/foobar")) diff --git a/pkg/config/containers.conf b/pkg/config/containers.conf index e5df17e45..570c55525 100644 --- a/pkg/config/containers.conf +++ b/pkg/config/containers.conf @@ -409,6 +409,10 @@ default_sysctls = [ # #events_logger = "journald" +# Creates a more verbose container-create event which includes a JSON payload +# with detailed information about the container. +#events_container_create_inspect_data = false + # A is a list of directories which are used to search for helper binaries. # #helper_binaries_dir = [ diff --git a/pkg/config/testdata/containers_override.conf b/pkg/config/testdata/containers_override.conf index 0a0ce6c77..a15d147bb 100644 --- a/pkg/config/testdata/containers_override.conf +++ b/pkg/config/testdata/containers_override.conf @@ -11,6 +11,7 @@ image_default_format="v2s2" image_copy_tmp_dir="/tmp/foobar" events_logfile_path = "/tmp/events.log" events_logfile_max_size="500" +events_container_create_inspect_data = true pod_exit_policy="stop" [engine.platform_to_oci_runtime]