Skip to content

Conversation

Bagautdino
Copy link

This PR extends the Helm chart for Tetragon by adding support for envFromSecrets in the export.stdout template. This allows injecting environment variables from Kubernetes secrets using the envFrom field.

The implementation checks for the presence of .Values.export.stdout.envFromSecrets, and if present, renders the corresponding envFrom entries as secretRef definitions. This is useful when multiple environment variables need to be sourced from secrets without specifying each variable explicitly.

This change is backward-compatible and does not affect existing configurations that do not use envFromSecrets.

@Bagautdino Bagautdino requested a review from a team as a code owner August 20, 2025 14:07
@Bagautdino Bagautdino requested a review from olsajiri August 20, 2025 14:07
@Bagautdino
Copy link
Author

@olsajiri

@olsajiri
Copy link
Contributor

cc @mtardy @kkourt thanks

Copy link
Contributor

@kkourt kkourt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Can you please provide an example of how this is meant to be used in the commit message? Please include both newly introduced configuration values (extraenvFrom and enfFromSecrets). Also, shouldn't we update values.yaml accordingly?

image: "{{ if .Values.export.stdout.image.override }}{{ .Values.export.stdout.image.override }}{{ else }}{{ .Values.export.stdout.image.repository }}:{{ .Values.export.stdout.image.tag }}{{ end }}"
imagePullPolicy: {{ .Values.imagePullPolicy }}
terminationMessagePolicy: FallbackToLogsOnError

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: empty newline

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this was not resolved.

Copy link
Author

@Bagautdino Bagautdino Aug 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been fixed in the latest commit. Please take a look.

032fc63

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't introduce changes that are negated at later commits. This makes history difficult to read.
Instead, please squash the changes from my feedback into the relevant original commits. (git rebase --interactive using the squash and fixup actions should help).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the extra commits earlier - I wasn’t aware of the best practice here. I’ve now squashed everything into a single commit with an updated message and examples. Hopefully the history looks clean now. Please let me know if there are any other issues I should fix. Thanks again for your guidance! @kkourt

@mtardy mtardy added the release-note/minor This PR introduces a minor user-visible change label Aug 25, 2025
@Bagautdino
Copy link
Author

Thanks @kkourt @mtardy @olsajiri !
I’ve addressed the feedback:

  • Amended the commit message to include concrete usage examples for both export.stdout.extraEnvFrom and export.stdout.envFromSecrets (see below).
  • Updated values.yaml with defaults and inline docs for both options.
  • Fixed nit.

Usage examples (also included in the commit message):

values.yaml

export:
  stdout:
    # Add specific env vars
    extraEnv:
      - name: LOG_LEVEL
        value: info

    # Pull multiple variables from ConfigMap/Secret via envFrom
    extraEnvFrom:
      - configMapRef:
          name: fluent-bit-config

    # Convenience for Secret envFrom; accepts strings or objects
    envFromSecrets:
      - opensearch-credentials              # simple form
      - name: optional-secret               # object form
        optional: true

Rendered container snippet

env:
  - name: LOG_LEVEL
    value: info
envFrom:
  - configMapRef:
      name: fluent-bit-config
  - secretRef:
      name: opensearch-credentials
  - secretRef:
      name: optional-secret
      optional: true

Motivation: I ran into this need while wiring Tetragon’s stdout exporter to ship logs to OpenSearch via Fluent Bit. I had to inject multiple credentials (e.g., OPENSEARCH_USERNAME / OPENSEARCH_PASSWORD) from a Kubernetes Secret without enumerating each key. Supporting envFrom and the envFromSecrets lets us mount the whole secret cleanly and keeps sensitive values out of plain values files.

@kkourt
Copy link
Contributor

kkourt commented Aug 27, 2025

  • Amended the commit message to include concrete usage examples for both export.stdout.extraEnvFrom and export.stdout.envFromSecrets (see below).

As far as I can see, the commit messages are still empty.

Copy link

netlify bot commented Aug 27, 2025

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit a57e57d
🔍 Latest deploy log https://app.netlify.com/projects/tetragon/deploys/68b0bc5b4b82b300098a03ea
😎 Deploy Preview https://deploy-preview-4025--tetragon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Bagautdino
Copy link
Author

  • Amended the commit message to include concrete usage examples for both export.stdout.extraEnvFrom and export.stdout.envFromSecrets (see below).

As far as I can see, the commit messages are still empty.
👌👌👌👌👌

This commit extends the Helm chart for Tetragon by adding support
for envFrom in the export.stdout template. Specifically:

- export.stdout.extraEnvFrom: allows referencing ConfigMaps/Secrets
  via envFrom.
- export.stdout.envFromSecrets: convenience for Secrets only,
  accepts strings or objects.

Usage examples:

values.yaml
-----------
export:
  stdout:
    # Add specific env vars
    extraEnv:
      - name: LOG_LEVEL
        value: info

    # Pull multiple variables from ConfigMap/Secret via envFrom
    extraEnvFrom:
      - configMapRef:
          name: fluent-bit-config

    # Convenience for Secret envFrom
    envFromSecrets:
      - opensearch-credentials
      - name: optional-secret
        optional: true

Rendered container
------------------
env:
  - name: LOG_LEVEL
    value: info
envFrom:
  - configMapRef:
      name: fluent-bit-config
  - secretRef:
      name: opensearch-credentials
  - secretRef:
      name: optional-secret
      optional: true

Signed-off-by: Bagautdino <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/minor This PR introduces a minor user-visible change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants