Skip to content

Commit a57e57d

Browse files
committed
feat(helm): add envFrom to export.stdout via extraEnvFrom/envFromSecrets
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]>
1 parent b0ecd1b commit a57e57d

File tree

3 files changed

+54
-5
lines changed

3 files changed

+54
-5
lines changed

install/kubernetes/tetragon/README.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/kubernetes/tetragon/templates/_container_export_stdout.tpl

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,29 @@
33
image: "{{ if .Values.export.stdout.image.override }}{{ .Values.export.stdout.image.override }}{{ else }}{{ .Values.export.stdout.image.repository }}:{{ .Values.export.stdout.image.tag }}{{ end }}"
44
imagePullPolicy: {{ .Values.imagePullPolicy }}
55
terminationMessagePolicy: FallbackToLogsOnError
6-
env: {{- toYaml .Values.export.stdout.extraEnv | nindent 4 }}
6+
{{- with .Values.export.stdout.extraEnv }}
7+
env:
8+
{{- toYaml . | nindent 4 }}
9+
{{- end }}
10+
{{- $envFrom := list }}
11+
{{- with .Values.export.stdout.extraEnvFrom }}
12+
{{- $envFrom = concat $envFrom . }}
13+
{{- end }}
14+
{{- range $item := .Values.export.stdout.envFromSecrets }}
15+
{{- if kindIs "map" $item }}
16+
{{- $sr := dict "name" ($item.name | default "") }}
17+
{{- if hasKey $item "optional" }}
18+
{{- $_ := set $sr "optional" $item.optional }}
19+
{{- end }}
20+
{{- $envFrom = append $envFrom (dict "secretRef" $sr) }}
21+
{{- else }}
22+
{{- $envFrom = append $envFrom (dict "secretRef" (dict "name" $item)) }}
23+
{{- end }}
24+
{{- end }}
25+
{{- if gt (len $envFrom) 0 }}
26+
envFrom:
27+
{{- toYaml $envFrom | nindent 4 }}
28+
{{- end }}
729
securityContext:
830
{{- toYaml .Values.export.securityContext | nindent 4 }}
931
resources:
@@ -32,4 +54,4 @@
3254
{{- with .Values.export.stdout.extraVolumeMounts }}
3355
{{- toYaml . | nindent 4 }}
3456
{{- end }}
35-
{{- end }}
57+
{{- end }}

install/kubernetes/tetragon/values.yaml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,37 @@ export:
350350
- tetragon.log
351351
# stdout specific exporter settings
352352
stdout:
353-
extraEnv: []
353+
# -- Extra environment variables to add to the export-stdout container.
354+
# Example:
354355
# extraEnv:
355-
# - name: foo
356+
# - name: FOO
356357
# value: bar
358+
# - name: SECRET_KEY
359+
# valueFrom:
360+
# secretKeyRef:
361+
# name: my-secret
362+
# key: secret-key
363+
extraEnv: []
364+
365+
# -- Extra envFrom sources to add to the export-stdout container.
366+
# This allows adding any type of envFrom source (configMapRef, secretRef, etc.).
367+
# Example:
368+
# extraEnvFrom:
369+
# - configMapRef:
370+
# name: my-config-map
371+
# - secretRef:
372+
# name: my-secret
373+
# optional: true
374+
extraEnvFrom: []
375+
376+
# -- A simplified way to add secret references to envFrom.
377+
# Can be specified either as a string (just the secret name) or as an object with additional parameters.
378+
# Example:
379+
# envFromSecrets:
380+
# - my-simple-secret
381+
# - name: my-optional-secret
382+
# optional: true
383+
envFromSecrets: []
357384

358385
# * When enabledCommand=true and commandOverride is not set, the command inserted will be hubble-export-stdout.
359386
# This supports the default for the current deployment instructions to deploy stdout-export sidecar container.

0 commit comments

Comments
 (0)