-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Merge with AppendValues option when merging default config with hints generated config #36857
Use Merge with AppendValues option when merging default config with hints generated config #36857
Conversation
…ints generated config
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
@@ -139,7 +139,8 @@ func (l *logHints) CreateConfig(event bus.Event, options ...ucfg.Option) []*conf | |||
kubernetes.ShouldPut(tempCfg, json, jsonOpts, l.log) | |||
} | |||
// Merge config template with the configs from the annotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this now. Is not needed probably
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is still a valid comment as it describes what is merged. And then we describe why AppendValues option is used.
Co-authored-by: Andrew Gizas <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I think a changelog entry would be needed here since it fixes a user facing issue.
This pull request is now in conflicts. Could you fix it? 🙏
|
@elastic/elastic-agent-data-plane could you please review this PR as you are the code owners ? |
…ints generated config (elastic#36857) * Use Merge with AppendValues option when merging default config with hints generated config * Update filebeat/autodiscover/builder/hints/logs.go Co-authored-by: Andrew Gizas <[email protected]> * Update changelog --------- Co-authored-by: Andrew Gizas <[email protected]>
This PR is the resolution of #36838 issue where the problem is described in details.
In filebeat, when kubernetes autodisocver is used with hints enabled, processors and other array fields (paths, parsers) are not merged correctly.
The values coming from default config and the ones generated from hints should be merged by appending the hints generated values to the default config's ones in case of arrays like processors.
The
Merge
method used does not append array values by default.Instead
MergeWithOpts
andAppendValues
option should be used.