Skip to content
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

Fluentd: Add the ability to template values for volumes, volumeMounts, and initContainers #371

Open
Boojapho opened this issue May 31, 2023 · 0 comments · May be fixed by #372
Open

Fluentd: Add the ability to template values for volumes, volumeMounts, and initContainers #371

Boojapho opened this issue May 31, 2023 · 0 comments · May be fixed by #372

Comments

@Boojapho
Copy link
Contributor

Use cases

  • I would like the ability to reuse values from the pod's container in initContainers without repeating them (e.g. image, pull policy, env).
  • I would like the ability to mount configmap files based on iterating over files in a directory. In my case, I have added a directory containing my files and a configmap generator to create the CMs. I would like to use Helm templating to create the volumes / volumeMounts instead of hand jamming the names into a values file.

Current

The helm template performs a toYaml for volumes, volumeMounts, and initcontainers. This restricts these items to literal values only.

Proposal

Use tpl to allow the values to be either literal or a Helm template. Example:

{{- with .Values.volumeMounts -}}
{{- tpl (ternary . (toYaml .) (kindIs "string" .)) $ | trim | nindent 4 -}}
{{- end -}}

This would allow literals...

volumeMounts:
- name: myvol
  mountPath: /tmp/myvol

arrays with Helm...

volumeMounts:
- name: {{ include "fluentd.myvol.name" . }}
  mountPath: /tmp/myvol

or a Helm template string...

volumeMounts: |-
  {{- range $path, $_ := $.Files.Glob "myfiles/*.conf" -}}
  - name: {{ include "fluend.myvol.name" (base $path) }}
    mountPath: /tmp/myvol
  {{ end -}}

Other

This technique could be extended to other values in the future if a use case is presented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant