Refactor kubernetes autodiscover to enable different resource based discovery#14738
Refactor kubernetes autodiscover to enable different resource based discovery#14738ChrsMark merged 12 commits intoelastic:masterfrom
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.
exported function NewPodEventer should have comment or be unexported
There was a problem hiding this comment.
exported type Eventer should have comment or be unexported
e55a7a1 to
9023690
Compare
There was a problem hiding this comment.
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.
receiver name no should be consistent with previous receiver name n for node
There was a problem hiding this comment.
receiver name no should be consistent with previous receiver name n for node
473bf23 to
64465ae
Compare
There was a problem hiding this comment.
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.
will create follow up PR
There was a problem hiding this comment.
both scope and resource are new, could you update the docs?
There was a problem hiding this comment.
pod.go is fairly well tested, could you add some tests for service and node too?
There was a problem hiding this comment.
added test cases for node and service.
libbeat/common/kubernetes/watcher.go
Outdated
There was a problem hiding this comment.
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.
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.
This is looking great! I left a few minor comments, thank you for adding docs and tests!!
There was a problem hiding this comment.
❤️ 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.
We should make this change also in add_kubernetes_metadata
There was a problem hiding this comment.
will add this as part of follow up PR to add scope setting
There was a problem hiding this comment.
both description and here, should host be node?
There was a problem hiding this comment.
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.
correct. it should be node. it will pin the discovery to that given node.
There was a problem hiding this comment.
| `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.
only pod and node can be discovered at node scope.
There was a problem hiding this comment.
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.
Could you please add a changelog?
ChrsMark
left a comment
There was a problem hiding this comment.
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