traefik-helm-chart icon indicating copy to clipboard operation
traefik-helm-chart copied to clipboard

Add possibility to bind environment variables via envFrom

Open sbaeurle opened this issue 4 years ago • 6 comments

Right now it is possible to deploy the helm chart and use ConfigMaps and Secrets outside of the Helm release to pass ENV values to traefik. (e.g. Secrets for ACME-DNS01 Challenges).

Yet you cannot pass complete configmaps via envFrom as seen in Usage of ConfigMaps. (also possible for secrets)

I suggest to add an extra configuration option in the values.yml to enable such scenarios, similar to the binding of individual env variables. (this would be very useful to e.g. dynamically enable/disable logging without the need to redeploy the chart)

Proposal: values.yml:

envFrom:
- listOfConfigMapAndSecretRefs

deployment.yml:

spec:
  ...
  template:
    ...
    containers:
      ...
      {{- with .Values.envFrom }}
      envFrom:
        {{- toYaml . | nindent 10 }}

sbaeurle avatar Apr 04 '20 13:04 sbaeurle

Hi @sbaeurle,

Seems a great improvement of the helm chart.

Could you please open a PR?

mmatur avatar Apr 07 '20 07:04 mmatur

Hi @mmatur,

will do so ;)

sbaeurle avatar Apr 16 '20 16:04 sbaeurle

Hi @mmatur,

I finally applied the changes made here to my own deployment and encountered a problem rendering the feature practically useless for configuration.

According to the Documentation of Traefik, one can only use either a configuration file, cli arguments or env variables for configuration. The options are mutually exclusive and since this chart automatically uses arguments (even after disabling the globalArguments) the env config is not loaded at all.

The feature is still perfectly usable for DNS challenge secrets, but utterly useless for configuration.

Maybe you could clarify

  1. If Traefik will support multiple static configuration sources in the future?
  2. If you see any possibility to circumvent the current usage of cli arguments in the configuration and enable ENV configuration without multiple configurations sources?

Thanks in advance

sbaeurle avatar May 01 '20 15:05 sbaeurle

@mmatur wanted to check if you had the possibility to clarify the env usage of traefik and the helm chart?

sbaeurle avatar Jun 08 '20 14:06 sbaeurle

Hi @sbaeurle,

Sorry for my later answer.

  1. If Traefik will support multiple static configuration sources in the future?

From what I know for now there is no plan to have multiple static configuration sources.

  1. If you see any possibility to circumvent the current usage of cli arguments in the configuration and enable ENV configuration without multiple configurations sources?

I don't see any possibility with he current implementation. To be able to load the configuration from the env variables instead of the CLI we probably have to do some change on the helm chart.

mmatur avatar Jun 08 '20 15:06 mmatur

okay, thanks for the clarification.

I will think of a way how to circumvent the usage of cli arguments and propose a PR if I'm able to find a solution.

sbaeurle avatar Jun 09 '20 09:06 sbaeurle