MLE-31592: support secret-backed fluent bit ENV - #189
Open
pengzhouml wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new spec.logCollection.env field to allow passing Kubernetes EnvVar entries (including Secret-backed valueFrom.secretKeyRef) into the Fluent Bit sidecar, enabling authenticated OpenTelemetry exports without embedding secrets in ConfigMaps.
Changes:
- Extends the LogCollection API/CRDs/Helm CRD templates with an
envfield ([]corev1.EnvVar). - Wires the configured env vars into the generated Fluent Bit container definition.
- Adds documentation and tests (unit + e2e) covering Secret-backed env var configuration.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/e2e/6_log_collection_test.go | Adds an e2e test that creates a Secret and verifies the Fluent Bit container references it via EnvVarSource.SecretKeyRef. |
| README.md | Links to the new Fluent Bit log-collection documentation page. |
| pkg/k8sutil/statefulset.go | Appends spec.logCollection.env into the generated Fluent Bit container’s Env. |
| pkg/k8sutil/security_context_test.go | Adds a unit test asserting env vars are applied to the Fluent Bit container. |
| docs/log-collection.md | Documents how to configure Secret-backed env vars and reference them in Fluent Bit output headers. |
| config/crd/bases/marklogic.progress.com_marklogicgroups.yaml | Adds spec.logCollection.env schema to the MarklogicGroup CRD. |
| config/crd/bases/marklogic.progress.com_marklogicclusters.yaml | Adds spec.logCollection.env schema to the MarklogicCluster CRD (cluster + group overrides). |
| charts/marklogic-operator-kubernetes/templates/marklogicgroup-crd.yaml | Mirrors the MarklogicGroup CRD schema change in the Helm chart template. |
| charts/marklogic-operator-kubernetes/templates/marklogiccluster-crd.yaml | Mirrors the MarklogicCluster CRD schema change in the Helm chart template. |
| api/v1/zz_generated.deepcopy.go | Ensures LogCollection.Env is deep-copied correctly. |
| api/v1/common_types.go | Adds Env []corev1.EnvVar to the LogCollection API type. |
Files not reviewed (1)
- api/v1/zz_generated.deepcopy.go: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| SecurityContext: getFluentBitSecurityContextOrDefault(containerParams.LogCollection.SecurityContext), | ||
| VolumeMounts: getFluentBitVolumeMount(containerParams), | ||
| } | ||
| fulentBitContainerDef.Env = append(fulentBitContainerDef.Env, containerParams.LogCollection.Env...) |
Collaborator
Author
There was a problem hiding this comment.
Sure. Will Fix this.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This test is brittle because it hard-codes the exact number and ordering of Fluent Bit env vars. If the operator adds another default env var (or reorders them), the test will fail even though the behavior being tested (merging the configured env var) still works. Prefer asserting that the required env vars exist by name rather than asserting length/indexes. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
pengzhouml
requested review from
barkhachoithani,
rwinieski,
sumanthravipati and
vitalykorolev
August 3, 2026 21:50
Co-authored-by: pengzhouml <27710236+pengzhouml@users.noreply.github.com>
rwinieski
approved these changes
Aug 4, 2026
rwinieski
left a comment
Collaborator
There was a problem hiding this comment.
Check Jenkins pipeline
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for configuring environment variables on the Fluent Bit sidecar through spec.logCollection.env.
This enables Secret-backed OpenTelemetry authentication without exposing tokens in the Fluent Bit ConfigMap. Users can reference a Secret key through a standard Kubernetes EnvVar, then use the environment variable in a Fluent Bit output header such as:
header: