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

Pass additionalArguments through tpl similarly to volume names

Open Xitric opened this issue 2 years ago • 0 comments

Welcome!

  • [X] Yes, I've searched similar issues on GitHub and didn't find any.
  • [X] Yes, I've searched similar issues on the Traefik community forum and didn't find any.

What did you expect to see?

We use this Traefik Helm chart as a subchart in our own "wrapper" chart, which adds additional resources required to integrate Traefik with our cloud provider (pulling certificates from key vaults, integrating with API gateways etc.). This configuration involves a series of additionalArguments some of which are static, and some of which rely on outputs from other parts of our pipelines. We would like to keep as much configuration as possible inside the values.yaml file of our wrapper chart. Currently, we can only include our static configuration here.

However, since additionalArguments is an array, when we specify the dynamic arguments in the helm install command, they overwrite the static arguments in our values.yaml file. We think it could be a great addition if additionalArgument values were passed through the tpl function similarly to what is currently done to the names of volumes:

https://github.com/traefik/traefik-helm-chart/blob/f24ac3c53579e0889b53a29f23a76d359ad54803/traefik/templates/_podtemplate.tpl#L304-L305

With such an addition, it would enable us to provide more abstract configuration to our wrapper Helm chart, and then leave the values.yaml file to construct all the dynamic arguments via templating - leaving the static arguments as is.

So something along the lines of:

{{- $root := . }}
{{- with .Values.additionalArguments }}
{{- range . }}
- {{ tpl . $root | quote }}
{{- end }}
{{- end }}

Then our values.yaml file could contain arguments like this:

additionalArguments:
    - "--api.dashboard=false"
    - "--entrypoints.websecure.forwardedheaders.trustedips={{.Values.applicationGateway.subnet.addressPrefix}}"
    - "--providers.file.filename=/config/traefik.toml"

and we could install it with helm install traefik custom-traefik --set applicationGateway.subnet.addressPrefix=$OUTPUT_FROM_PIPELINE.

What is your take on this, and is it something that could be considered within the scope of this Helm chart? It would certainly make it easier to extend with such "wrapper" charts.

Xitric avatar Apr 26 '22 11:04 Xitric