-
Notifications
You must be signed in to change notification settings - Fork 5k
Refactor kubernetes autodiscover to enable different resource based discovery #14738
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
Conversation
|
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
1 similar comment
|
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
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.
exported function NewPodEventer should have comment or be unexported
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.
exported type Eventer should have comment or be unexported
e55a7a1 to
9023690
Compare
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.
for some reason this was duplicated 🤔
|
so far this is looking good to me 👍 thank you for working on it! |
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.
receiver name no should be consistent with previous receiver name n for node
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.
receiver name no should be consistent with previous receiver name n for node
473bf23 to
64465ae
Compare
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.
This would also solve #10578 🎉
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.
can happen in a different PR but I think we should extend this setting to add_kubernetes_metadata processor. I'm unsure about the other (resource), probably not worth it until we see the need.
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.
will create follow up PR
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.
both scope and resource are new, could you update the docs?
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.
updated docs.
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.
pod.go is fairly well tested, could you add some tests for service and node too?
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.
added test cases for node and service.
libbeat/common/kubernetes/watcher.go
Outdated
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.
should the watcher refuse to start if scope != cluster? We should at least explain this in the docs if not
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.
updated the docs for the same. the watcher needs some refactor so that we can address some of these concerns and also allow it to do additional enrichment
bfe75a5 to
3e03b63
Compare
|
jenkins test this please |
exekias
left a comment
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.
This is looking great! I left a few minor comments, thank you for adding docs and tests!!
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.
❤️ Could you use cfgwarn.Deprecate deprecate here? Also, it would be nice to update our manifests to avoid this warning to new users: https://github.com/elastic/beats/tree/master/deploy/kubernetes
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.
We should make this change also in add_kubernetes_metadata
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.
will add this as part of follow up PR to add scope setting
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.
s/host/node/?
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.
s/host/node/?
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.
s/host/node/
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.
both description and here, should host be node?
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.
btw I understand that setting node scope here means that we only watch for events in our node. right?
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.
correct. it should be node. it will pin the discovery to that given node.
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.
| `scope`:: (Optional) Specify at what level autodiscovery needs to be done at. `scope` can | |
| `scope`:: (Optional) Specify at what level autodiscover needs to be done at. `scope` can |
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.
only pod and node can be discovered at node scope.
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 all these should use config.Node, right? same happens in other eventers. Maybe we can rename Host to HostDeprecated to avoid its usage?
|
could you please update the PR description? also |
abecaa4 to
ec50931
Compare
exekias
left a comment
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.
Could you please add a changelog?
ChrsMark
left a comment
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.
Thanks for addressing the last comments!
…iscovery (elastic#14738) (cherry picked from commit 1a029e5)
Manual TestingWe should check manually combinations for the following configuration options:
Here are two examples mentioned in the description of the PR:
A mix of combinations to test:
@exekias and @vjsamuel feel free to add/mention anything I might missed |
|
Thank you for contributing @vjsamuel!! |
|
I couldn't get the node resource to work, probably because of this but I can't tell for certain. All other resources worked |
|
I guess this change broke Autodiscover in Filebeat, as I state it here #16464 @odacremolbap can you check it? Thank you! |
This PR tries to move around code in a way such that each resource has its own interface implementation and the autodiscover relies on a
resourceparameter to determine what the watcher to spin up and how to create hints. We also now addscopeas a parameter to define if Beats is running either at anodelevel or at aclusterlevel.The above configuration would enable discovering service objects across the cluster.
The above configuration would allow doing pod discovery across the cluster.
closes #14044 and #10578