Add recipe for individual Logstash pipeline management via ConfigMaps#8960
Add recipe for individual Logstash pipeline management via ConfigMaps#8960
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
pebrc
left a comment
There was a problem hiding this comment.
Thanks for contributing this recipe! I have some feedback before this can be merged.
Bugs
There are a few bugs that will prevent this recipe from working (see inline comments):
- Secret name mismatch (
kafka-credentialsvskafka-pipeline-secret) - Incorrect Elasticsearch environment variable names (
ES_HOSTSshould beECK_ES_HOSTS, etc.) - Wrong option name (
cacertshould bessl_certificate_authorities)
Missing Documentation
Please update config/recipes/logstash/README.asciidoc to document this new recipe.
Architectural Concern
I'm wondering about the value proposition of this approach compared to using pipelinesRef with Secrets, which ECK manages automatically.
The existing logstash-pipeline-as-secret.yaml recipe shows:
spec:
pipelinesRef:
secretName: logstash-pipelineThis approach requires zero volume mount boilerplate – ECK handles it all.
The ConfigMap approach in this PR requires 30+ lines of manual volume/volumeMount configuration, which is error-prone (as the bugs above demonstrate) and requires the user to keep paths in sync between pipelines[].path.config and volumeMounts[].mountPath.
Questions:
- Is there a compelling reason to use ConfigMaps over Secrets here? Pipeline configs typically don't contain secrets since credentials are injected via env vars.
- If the goal is "modular, separate resources per pipeline," wouldn't multiple Secrets with
pipelinesRefachieve the same with less complexity?
If there's a strong use case for this pattern (e.g., company policies requiring ConfigMaps for non-sensitive data), please add a note in the recipe explaining when users should choose this approach over pipelinesRef.
|
Hi @pebrc and thank you for your comments. I addressed most of them and will update the README ASAP. I'll try to answer your questions as well as I can.
Reasons:
No. Again, think about a GitOps setup. Why would you store the pipeline as an encrypted, unreadable object in Git (think SOPS encryption etc.) rather than having it readable and just loading the few required secrets dynamically? The approach with Secrets leads to more complexity, not less. But I agree with the general point that we are introducing an overhead (ConfigMap + Secret) to make up for the absence of a However, to your point, having multiple ConfigMaps (or
I honestly believe the use-case is simply using the most appropriate tool for the job. This very point came up during a consulting engagement with a customer yesterday. They are heavy Kubernetes users and were pretty surprised that we don't allow for a custom CR or a ConfigMap to be used for configuring pipelines, because Secrets are a pain to work with and our current setup does not integrate well with GitOps workflows and external operators handling real Secrets (i.e. credentials etc.). |
pebrc
left a comment
There was a problem hiding this comment.
After another pass, I am still a little sceptical about this recipe.
- Recipe not runnable without Kafka
The recipe defines a Kafka input pipeline pointing at kafka-broker:9092, but the YAML doesn’t deploy Kafka. Our other Logstash recipes are self-contained: everything needed is in the file and kubectl apply -f gives a working stack. This one breaks that expectation unless Kafka is deployed separately, so I would not want to add it as a first-class recipe in its current form.
- Overlap and recipe bloat
We already cover “pipeline config from outside the spec” in several ways: logstash-pipeline-as-secret.yaml (pipelinesRef), logstash-pipeline-as-volume.yaml (one pipeline from one volume), and inline config in logstash-eck.yaml. Adding another recipe that combines multiple pipelines, multiple ConfigMaps, and manual volume wiring would overlap with these and add only incremental value imo. I would want to try to keep the recipe set small so users aren’t confused by many similar options, so I would not add this as a new standalone recipe.
- Alternative direction
I get the ConfigMap argument. For “single pipelines definition in a ConfigMap,” I’ve opened issue #9110 to add ConfigMap support to pipelinesRef. For the “multiple pipelines, each in its own ConfigMap” pattern, we’d rather document it in the Logstash docs in the pipelines as volumes section (with a short “when to use” note vs pipelinesRef) than add another recipe file.
Wdyt?
| # example: conditional output | ||
| if [pipeline_source] == "beats" { | ||
| elasticsearch { | ||
| hosts => ["${ES_HOSTS}"] |
There was a problem hiding this comment.
I tihnk this incorrect an should be ECK_ES_HOSTS?
No description provided.