From 9377bcde49b7ea3e549b7a52a164d2578ca2068c Mon Sep 17 00:00:00 2001 From: Chris Mark Date: Tue, 21 Sep 2021 16:59:21 +0300 Subject: [PATCH] Remove deprecated/undocumented IncludeCreatorMetadata setting (#28006) --- CHANGELOG.next.asciidoc | 1 + libbeat/common/kubernetes/metadata/config.go | 4 ---- .../common/kubernetes/metadata/resource.go | 20 +++++++++---------- x-pack/elastic-agent/CHANGELOG.next.asciidoc | 1 + .../composable/providers/kubernetes/config.go | 4 ---- 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 92c8dc2979d9..310bfa0e02a2 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -23,6 +23,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Kubernetes autodiscover fails in node scope if node name cannot be discovered {pull}26947[26947] - Loading Kibana assets (dashboards, index templates) rely on Saved Object API. So to provide a reliable service, Beats can only import and export dasbhboards using at least Kibana 7.15. {issue}20672[20672] {pull}27220[27220] - Skip add_kubernetes_metadata processor when kubernetes metadata are already present {pull}27689[27689] +- Remove deprecated/undocumented IncludeCreatorMetadata setting from kubernetes metadata config options {pull}28006[28006] *Auditbeat* diff --git a/libbeat/common/kubernetes/metadata/config.go b/libbeat/common/kubernetes/metadata/config.go index c762c6927281..5e27eff4cf3f 100644 --- a/libbeat/common/kubernetes/metadata/config.go +++ b/libbeat/common/kubernetes/metadata/config.go @@ -28,9 +28,6 @@ type Config struct { LabelsDedot bool `config:"labels.dedot"` AnnotationsDedot bool `config:"annotations.dedot"` - - // Undocumented settings, to be deprecated in favor of `drop_fields` processor: - IncludeCreatorMetadata bool `config:"include_creator_metadata"` } // AddResourceMetadataConfig allows adding config for enriching additional resources @@ -41,7 +38,6 @@ type AddResourceMetadataConfig struct { // InitDefaults initializes the defaults for the config. func (c *Config) InitDefaults() { - c.IncludeCreatorMetadata = true c.LabelsDedot = true c.AnnotationsDedot = true } diff --git a/libbeat/common/kubernetes/metadata/resource.go b/libbeat/common/kubernetes/metadata/resource.go index a2b1a5550612..7bbd05e4b986 100644 --- a/libbeat/common/kubernetes/metadata/resource.go +++ b/libbeat/common/kubernetes/metadata/resource.go @@ -112,17 +112,15 @@ func (r *Resource) GenerateK8s(kind string, obj kubernetes.Resource, options ... } // Add controller metadata if present - if r.config.IncludeCreatorMetadata { - for _, ref := range accessor.GetOwnerReferences() { - if ref.Controller != nil && *ref.Controller { - switch ref.Kind { - // TODO grow this list as we keep adding more `state_*` metricsets - case "Deployment", - "ReplicaSet", - "StatefulSet", - "DaemonSet": - safemapstr.Put(meta, strings.ToLower(ref.Kind)+".name", ref.Name) - } + for _, ref := range accessor.GetOwnerReferences() { + if ref.Controller != nil && *ref.Controller { + switch ref.Kind { + // TODO grow this list as we keep adding more `state_*` metricsets + case "Deployment", + "ReplicaSet", + "StatefulSet", + "DaemonSet": + safemapstr.Put(meta, strings.ToLower(ref.Kind)+".name", ref.Name) } } } diff --git a/x-pack/elastic-agent/CHANGELOG.next.asciidoc b/x-pack/elastic-agent/CHANGELOG.next.asciidoc index 0f4c1e70c1a7..eb17c4d667eb 100644 --- a/x-pack/elastic-agent/CHANGELOG.next.asciidoc +++ b/x-pack/elastic-agent/CHANGELOG.next.asciidoc @@ -12,6 +12,7 @@ - Beats build for 32Bit Windows or Linux system will refuse to run on a 64bit system. {pull}25186[25186] - Remove the `--kibana-url` from `install` and `enroll` command. {pull}25529[25529] - Default to port 80 and 443 for Kibana and Fleet Server connections. {pull}25723[25723] +- Remove deprecated/undocumented IncludeCreatorMetadata setting from kubernetes metadata config options {pull}28006[28006] ==== Bugfixes - Fix rename *ConfigChange to *PolicyChange to align on changes in the UI. {pull}20779[20779] diff --git a/x-pack/elastic-agent/pkg/composable/providers/kubernetes/config.go b/x-pack/elastic-agent/pkg/composable/providers/kubernetes/config.go index 3d34db03a8b8..ddad6fd25401 100644 --- a/x-pack/elastic-agent/pkg/composable/providers/kubernetes/config.go +++ b/x-pack/elastic-agent/pkg/composable/providers/kubernetes/config.go @@ -33,9 +33,6 @@ type Config struct { LabelsDedot bool `config:"labels.dedot"` AnnotationsDedot bool `config:"annotations.dedot"` - - // Undocumented settings, to be deprecated in favor of `drop_fields` processor: - IncludeCreatorMetadata bool `config:"include_creator_metadata"` } // Resources config section for resources' config blocks @@ -55,7 +52,6 @@ func (c *Config) InitDefaults() { c.CleanupTimeout = 60 * time.Second c.SyncPeriod = 10 * time.Minute c.Scope = "node" - c.IncludeCreatorMetadata = true c.LabelsDedot = true c.AnnotationsDedot = true }