Add kubernetes composable inputs provider#21480
Conversation
There was a problem hiding this comment.
Do we have in mind how/if we will handle different resources other than Pods? Like Services and Nodes?
There was a problem hiding this comment.
Not yet, I'm only adding Pods in this PR as a first step. I will open an issue to discuss more resources
e608e99 to
9875eb9
Compare
0f75d9f to
bd3d009
Compare
|
Pinging @elastic/integrations-platforms (Team:Platforms) |
| client, err := kubernetes.GetKubernetesClient(p.config.KubeConfig) | ||
| if err != nil { | ||
| // info only; return nil (do nothing) | ||
| p.logger.Infof("Kubernetes provider skipped, unable to connect: %s", err) |
There was a problem hiding this comment.
Being that this will occur on most hosts not in Kubernetes, should this be Debugf?
There was a problem hiding this comment.
good point, I added a message for the cases where this succeeds
| composable.Providers.AddDynamicProvider("kubernetes", DynamicProviderBuilder) | ||
| } | ||
|
|
||
| type kubernertesContainerData struct { |
There was a problem hiding this comment.
This struct seems to be unused.
| // Emit all containers in the pod | ||
| p.emitContainers(pod, pod.Spec.Containers, pod.Status.ContainerStatuses) | ||
|
|
||
| // TODO deal with init containers stopping after initialization |
There was a problem hiding this comment.
Whats the TODO mean here? Does this mean that AddOrUpdate will be called for InitContainers but the Remove will never be called? That seems like it will leak then in the provider, if that is correct.
There was a problem hiding this comment.
No, right now Remove will be called when the Pod stops, so inputs won't leak.
The thing is that these containers may stop before the Pod itself, we should be able to detect this and stop them earlier.
|
Pinging @elastic/ingest-management (Team:Ingest Management) |
jsoriano
left a comment
There was a problem hiding this comment.
This is looking good, I like how providers can be implemented in the agent.
Is there a place to add the documentation?
blakerouse
left a comment
There was a problem hiding this comment.
Looks good. Seems like a good start.
| // Emit all containers in the pod | ||
| p.emitContainers(pod, pod.Spec.Containers, pod.Status.ContainerStatuses) | ||
|
|
||
| // TODO deal with init containers stopping after initialization |
|
@exekias looks good what are the remaining steps/next steps for this? |
|
Thanks for the reviews! @ph my plan was to get this in for 7.10 and open some follow up issues to discuss next steps. Does that sound good to you? |
|
I am ok to merge it as is and do followup after. |
* Add kubernetes composable inputs provider (cherry picked from commit d6ee968)
What does this PR do?
Add
kubernetesdynamic provider for Pods, this will allow to launch input configurations for discovered Pods in a Kubernetes cluster. Example config:Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.Related issues
Closes #19271