helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

extraEnvVars valueFrom

Open Spritekin opened this issue 10 months ago • 0 comments

Right now the deployments.yaml file process the extraEnvVars like this:

            {{- range .Values.extraEnvVars }}
            - name: {{ .name }}
              value: {{ .value | quote }}
            {{- end }}

So it only contemplates a hardcoded value. I would like to load the values from a secret like this:

    extraEnvVars:
      - name: OAUTH_CLIENT_ID
        valueFrom:
          secretKeyRef:
            name: vouch-okta
            key: OAUTH_CLIENT_ID
      - name: OAUTH_CLIENT_SECRET
        valueFrom:
          secretKeyRef:
            name: vouch-okta
            key: OAUTH_CLIENT_SECRET

However if I do this the deployment ends like this

        - name: OAUTH_CLIENT_ID
        - name: OAUTH_CLIENT_SECRET

With no values, because there is no .value in the structure.

So maybe in the deployment.yaml code the env vars should be handled as (indent 12 referencial only I haven't really counted):

            {{- if .Values.extraEnvVars }}
            {{- toYaml .Values.extraEnvVars | indent 12 }}
            {{- end }}

handling it that way allows the user setting the env vars in any way they need.

Spritekin avatar Apr 11 '24 04:04 Spritekin