extraEnv in gitlab _helpers.tpl does not allow "valueFrom"

Summary

While I do not consider this to be a Bug I think that this could be improved.

On the template helper: gitlab/charts/gitlab/templates/_helpers.tpl

there is the block:

{{/*
Returns the extraEnv keys and values to inject into containers.

Global values will override any chart-specific values.
*/}}
{{- define "gitlab.extraEnv" -}}
{{- $allExtraEnv := merge (default (dict) .Values.extraEnv) .Values.global.extraEnv -}}
{{- range $key, $value := $allExtraEnv }}
- name: {{ $key }}
  value: {{ $value | quote }}
{{- end -}}
{{- end -}}

This block does now allow for:

      - name: SECRET_PASSWORD
        valueFrom:
          secretKeyRef:
            name: mysecret
            key: password

Maybe it is possible to update the helper block to something like:

{{- define "gitlab.extraEnv" -}}
{{ tpl (default "" .Values.extraEnv) . }}
{{- end -}}

then we can declare those the same way as we do extraContainers, in favor of consistency.

Steps to reproduce

Try to declare extra environment variables for gitaly with values from kubernetes secrets.

Configuration used

(Please provide a sanitized version of the configuration used wrapped in a code block (```yaml))

    gitlab:
      gitaly:
        extraEnv
          - name: MYVAR
            valueFrom:
              secretKeyRef:
                name: mysecret
                key: mykey

Current behavior

Fails to render the template

Expected behavior

The template is rendered correclty

Versions

  • Chart: 4.1.4