Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[Metricbeat autodiscover][Provider Kubernetes] Add condition to node/namespace watchers #37181
[Metricbeat autodiscover][Provider Kubernetes] Add condition to node/namespace watchers #37181
Changes from 2 commits
510a67a
0a75329
a7b5824
0e3091a
fd9a2a4
f06aebe
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Minor suggestion since we touch this codebase: Would it make sense to use the same
Namespace
scope setting with the one used for the Pod watcher?If we watch for Pods on specific Namespace then their parent Deployments and CronJobs will be on the same Namespace as well.
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.
Now that I see this line again I realize that
metaConf.Namespace/Node
was not checked in order to initialize the watchers above because these Watchers are used for Hint's based autodiscovery anyways no matter what theadd_resource_metadata
defines.Let's take for example the
namespaceWatcher
:We want to trigger the
updater
even ifmetaConf.Namespace.Enabled()!=true
in case of having Hints enabled. Some details can be found at #25117.So I believe we need to rethink of this patch more carefully. I see 2 options here:
config.Hints.Enabled() || metaConf.Namespace.Enabled()
anyways in order to have the hints to work as expected.watch
onNamespaces
and/orNodes
.The point is that we cannot couple Hint's based autodiscovery functionality with the
add_resource_metadata
setting. That's why we had this||
in this if statement here.Most probably that's why we fetch the namespace Annotations at
beats/libbeat/autodiscover/providers/kubernetes/pod.go
Line 330 in 8effe24
A real use case would be the following:
a) the users have disabled the namespace metadata enrichment with
add_resource_metadata.namespace.enabled: false
b) but they want to have hints' based autodiscovery based on Namespace's annotations (see https://www.elastic.co/guide/en/beats/metricbeat/current/configuration-autodiscover-hints.html#_namespace_defaults)
The hints' events won't be complete because we won't have Namespace annotations at
beats/libbeat/autodiscover/providers/kubernetes/pod.go
Line 399 in 8effe24
I might miss sth here but my point is that we need to revisit this seeing the big picture and then decide accordingly. As we can see there are lot's of different pieces affected here.
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 like this option, because this way we can still stop the watchers with
hints.enabled: false
. The main problem as it is now is that we have no way to stop them.We would have to update the documentation for Autodiscover with this, as we never mention the option
hints
(only at this page).Maybe the user would have way too many options when we can already use the ones available.
Thanks, it is clear 👍
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 commited new changes so now it works like this.
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.
Also somehow related: #34717
Check failure on line 420 in libbeat/autodiscover/providers/kubernetes/pod.go
GitHub Actions / lint (windows)
Check failure on line 420 in libbeat/autodiscover/providers/kubernetes/pod.go
GitHub Actions / lint (linux)
Check failure on line 228 in libbeat/autodiscover/providers/kubernetes/service.go
GitHub Actions / lint (windows)
Check failure on line 228 in libbeat/autodiscover/providers/kubernetes/service.go
GitHub Actions / lint (linux)