diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index c8f21df662f..b7ea2c115c2 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -371,6 +371,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Added "detect_mime_type" processor for detecting mime types {pull}22940[22940] - Added "add_network_direction" processor for determining perimeter-based network direction. {pull}23076[23076] - Added new `rate_limit` processor for enforcing rate limits on event throughput. {pull}22883[22883] +- Allow node/namespace metadata to be disabled on kubernetes metagen and ensure add_kubernetes_metadata honors host {pull}23012[23012] *Auditbeat* diff --git a/libbeat/common/kubernetes/metadata/metadata.go b/libbeat/common/kubernetes/metadata/metadata.go index e1cbd0e8629..897f6c4bc84 100644 --- a/libbeat/common/kubernetes/metadata/metadata.go +++ b/libbeat/common/kubernetes/metadata/metadata.go @@ -61,10 +61,10 @@ func GetPodMetaGen( metaConf *AddResourceMetadataConfig) MetaGen { var nodeMetaGen, namespaceMetaGen MetaGen - if nodeWatcher != nil { + if nodeWatcher != nil && metaConf.Node.Enabled() { nodeMetaGen = NewNodeMetadataGenerator(metaConf.Node, nodeWatcher.Store()) } - if namespaceWatcher != nil { + if namespaceWatcher != nil && metaConf.Namespace.Enabled() { namespaceMetaGen = NewNamespaceMetadataGenerator(metaConf.Namespace, namespaceWatcher.Store()) } metaGen := NewPodMetadataGenerator(cfg, podWatcher.Store(), nodeMetaGen, namespaceMetaGen) diff --git a/libbeat/docs/shared-autodiscover.asciidoc b/libbeat/docs/shared-autodiscover.asciidoc index 2b56db97547..6841f312a36 100644 --- a/libbeat/docs/shared-autodiscover.asciidoc +++ b/libbeat/docs/shared-autodiscover.asciidoc @@ -231,7 +231,8 @@ running configuration for a container, 60s by default. `add_resource_metadata`:: (Optional) Specify labels and annotations filters for the extra metadata coming from Node and Namespace. `add_resource_metadata` can be done for `node` or `namespace`. By default all labels will be included while annotations are not added by default. This settings are useful when labels' and annotations' - storing requires special handling to avoid overloading the storage output. + storing requires special handling to avoid overloading the storage output. The enrichment of `node` or `namespace` metadata + can be individually disabled by setting `enabled: false`. Example: ["source","yaml",subs="attributes"] diff --git a/libbeat/processors/add_kubernetes_metadata/docs/add_kubernetes_metadata.asciidoc b/libbeat/processors/add_kubernetes_metadata/docs/add_kubernetes_metadata.asciidoc index b35e7cbaf16..d4fe02fd7db 100644 --- a/libbeat/processors/add_kubernetes_metadata/docs/add_kubernetes_metadata.asciidoc +++ b/libbeat/processors/add_kubernetes_metadata/docs/add_kubernetes_metadata.asciidoc @@ -121,7 +121,8 @@ It is unset by default. `add_resource_metadata`:: (Optional) Specify labels and annotations filters for the extra metadata coming from Node and Namespace. `add_resource_metadata` can be done for `node` or `namespace`. By default all labels will be included while annotations are not added by default. This settings are useful when labels' and annotations' -storing requires special handling to avoid overloading the storage output. +storing requires special handling to avoid overloading the storage output. The enrichment of `node` or `namespace` metadata +can be individually disabled by setting `enabled: false`. Example: ["source","yaml",subs="attributes"] diff --git a/libbeat/processors/add_kubernetes_metadata/kubernetes.go b/libbeat/processors/add_kubernetes_metadata/kubernetes.go index 2ca864a5bcf..50a90b32621 100644 --- a/libbeat/processors/add_kubernetes_metadata/kubernetes.go +++ b/libbeat/processors/add_kubernetes_metadata/kubernetes.go @@ -178,7 +178,7 @@ func (k *kubernetesAnnotator) init(config kubeAnnotatorConfig, cfg *common.Confi options := kubernetes.WatchOptions{ SyncTimeout: config.SyncPeriod, - Node: "", + Node: config.Host, } if config.Namespace != "" { options.Namespace = config.Namespace