Skip to content

Commit

Permalink
Remove deprecated/undocumented IncludeCreatorMetadata setting (elasti…
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrsMark authored and wiwen committed Nov 1, 2021
1 parent 66d7e85 commit 3216f15
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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*

Expand Down
4 changes: 0 additions & 4 deletions libbeat/common/kubernetes/metadata/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down
20 changes: 9 additions & 11 deletions libbeat/common/kubernetes/metadata/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions x-pack/elastic-agent/CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down

0 comments on commit 3216f15

Please sign in to comment.