Skip to content

Commit

Permalink
Allow node/namespace metadata to be disabled on kubernetes metagen an…
Browse files Browse the repository at this point in the history
…d ensure add_kubernetes_metadata honors host (#23012) (#23127)

(cherry picked from commit 20c7da2)

Co-authored-by: Vijay Samuel <[email protected]>
  • Loading branch information
ChrsMark and vjsamuel authored Dec 15, 2020
1 parent 35f1bd1 commit 0dae3d7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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*

Expand Down
4 changes: 2 additions & 2 deletions libbeat/common/kubernetes/metadata/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion libbeat/docs/shared-autodiscover.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion libbeat/processors/add_kubernetes_metadata/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0dae3d7

Please sign in to comment.