-
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
[Elastic Agent] Add docker composable dynamic provider. #20842
Conversation
Pinging @elastic/ingest-management (Team:Ingest Management) |
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.
Nice. How similar is this code from our Beats autodiscovery code?
I really like that this allows us to start playing around with it.
|
||
if err := watcher.Start(); err != nil { | ||
// warn only; return nil (do nothing) | ||
c.logger.Warnf("Failed starting docker provider: %s", err) |
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.
On the Beats code based we tried no to use Warn
as it is this strange middleground between info and error. Is user interaction needed or not? Is it a bug or not? I would suggest to move this to the Info level and phrase it more something like: Docker provider not started as docker not available (if we can make this distinction).
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.
Done!
This is very, very similar. Because the docker code was so well encapsulated in
|
cc @exekias You might want to watch this :) |
Nice job! Maybe this means we don't really need to refactor current providers #19271? I see it's possible to pass the config for the provider, how would that look in the YAML? |
@exekias I think creating the new providers in Agent will be the most amount of work, but if most of the watcher logic is in For configuring it looks like:
|
} | ||
|
||
// Run runs the environment context provider. | ||
func (c *dynamicProvider) Run(comm composable.DynamicProviderComm) error { |
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.
Nit: I would call it Start
instead of Run
as it is non blocking, but we change that later.
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.
Its not called Start
because there is no Stop
. It is stopped only by the cancelling of the passed context. It is up to the provider on how it wants to implement. Example is the local_dynamic
provider it just reads the config and returns, as it does need a goroutine to always be running.
"id": container.ID, | ||
"name": container.Name, | ||
"image": container.Image, | ||
"labels": processorLabelMap, |
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 revisit later on what the default info is that we ship, if we potentially should reduce 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.
Works for me.
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.
@blakerouse Could you follow up with an issue? I'm pretty sure we will forget otherwise :-D
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.
Filed #21135
* Add docker provider. * Add changelog. * Update docker start message to info. (cherry picked from commit f017e24)
…ne-2.0 * upstream/master: (44 commits) Update users.asciidoc (elastic#20802) (elastic#21108) Fix docker provider builder. (elastic#21118) [Elastic Agent] Add docker composable dynamic provider. (elastic#20842) Add new modules/filesets from rsa2elk for 7.10 (elastic#20820) Fix broken links to external websites (elastic#21061) [docs] typo in the command line (elastic#20799) [Filebeat] add panos type and sub_type (elastic#20912) Move the `compute_vm_scalset` to a light metricset and map the cloud metadata (elastic#21038) [Filebeat] Add support for Cloudtrail digest files (elastic#21086) Add metrics collection from cost explorer into aws/billing metricset (elastic#20527) Add vendoring to Google Cloud Functions again (elastic#21070) [Elastic Agent] Add fleet.host.id for sending to endpoint. (elastic#21042) Do not need Google credentials before using it (elastic#21072) [Filebeat][New Module] Zoom webhook module (elastic#20414) Add support for GMT timezone offset in decode_cef (elastic#20993) Filebeat: Fix random error on harvester close (elastic#21048) Add ingress controller dashboards (elastic#21052) Fix loggers in composable module. (elastic#21047) [Ingest Manager] Increase kibana client timeout to 5 minutes (elastic#21037) Add changelog. (elastic#21041) ...
What does this PR do?
Adds a
docker
composable dynamic provider.Why is it important?
Support generating inputs from discovered docker containers.
Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
Using the following configuration results in the
inputs
results in a new input per container.Related issues