Skip to content

Commit

Permalink
Use default configuration in kubernetes metadata enrichers (#17020)
Browse files Browse the repository at this point in the history
Fix issues caused by dedotting not being enabled by default.
  • Loading branch information
jsoriano authored Mar 16, 2020
1 parent 1a70200 commit c3c9f34
Show file tree
Hide file tree
Showing 5 changed files with 6 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 @@ -11,6 +11,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
*Affecting all Beats*

- Fix an issue that could cause redundant configuration reloads. {pull}16440[16440]
- Fix metadata enrichers to use default config for kubernetes module. {pull}17020[17020]

*Auditbeat*

Expand Down
2 changes: 1 addition & 1 deletion libbeat/common/kubernetes/metadata/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type AddResourceMetadataConfig struct {
Namespace *common.Config `config:"namespace"`
}

func defaultConfig() Config {
func DefaultConfig() Config {
return Config{
IncludeCreatorMetadata: true,
LabelsDedot: true,
Expand Down
2 changes: 1 addition & 1 deletion libbeat/common/kubernetes/metadata/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type Resource struct {

// NewResourceMetadataGenerator creates a metadata generator for a generic resource
func NewResourceMetadataGenerator(cfg *common.Config) *Resource {
config := defaultConfig()
config := DefaultConfig()
config.Unmarshal(cfg)

return &Resource{
Expand Down
2 changes: 1 addition & 1 deletion libbeat/common/kubernetes/metadata/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func TestResource_Generate(t *testing.T) {
},
}

cfg := defaultConfig()
cfg := DefaultConfig()
metagen := &Resource{
config: &cfg,
}
Expand Down
4 changes: 2 additions & 2 deletions metricbeat/module/kubernetes/util/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func NewResourceMetadataEnricher(
return &nilEnricher{}
}

metaConfig := metadata.Config{}
metaConfig := metadata.DefaultConfig()
if err := base.Module().UnpackConfig(&metaConfig); err != nil {
logp.Err("Error initializing Kubernetes metadata enricher: %s", err)
return &nilEnricher{}
Expand Down Expand Up @@ -201,7 +201,7 @@ func NewContainerMetadataEnricher(
return &nilEnricher{}
}

metaConfig := metadata.Config{}
metaConfig := metadata.DefaultConfig()
if err := base.Module().UnpackConfig(&metaConfig); err != nil {
logp.Err("Error initializing Kubernetes metadata enricher: %s", err)
return &nilEnricher{}
Expand Down

0 comments on commit c3c9f34

Please sign in to comment.