Skip to content

[Helm] Use helm templating instead of yaml anchors to propagate environment variables #1015

Open
@Nastaliss

Description

@Nastaliss

Feature Request

A yaml anchor is used to propagate environment variables to all pods :

commonEnvVars: &commonEnvVars
  <<:
    key1: value1
    ...
# and

yProvider:
  envVars:
    <<: *commonEnvVars

This means that to override or add an environment variable, a user that uses this chart as a dependency would have to either re-write their own anchors or write the envVars for every pod.

Plus, while anchors are a yaml standard and usually supported, some tools such as sops do not yet support this.
This means that secret files will have a lot of repetitions.

Describe the solution you'd like
We could instead of using native yaml anchors use a value to hold every environment variable, reusing commonEnvVars without anchors. Then in every deployment / statefulset we could expand the commonEnvVars then expand the deployment's specific envVars.

Describe alternatives you've considered
We could also have a configmap containing the common environment variables that would be envFromed but I think having both an envFrom and an env can be misleading.

Discovery, Documentation, Adoption, Migration Strategy
Updating the base values.yaml should be straightforward for users.

Do you want to work on it through a Pull Request?
Sure, I'll wait for any objection before working on this !

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions