bjw-s / helm-charts

A collection of Helm charts
https://bernd-schorgers.github.io/helm-charts/
Apache License 2.0
566 stars 106 forks source link

Don't sort env variables #160

Closed dani-CO-CN closed 10 months ago

dani-CO-CN commented 1 year ago

Details

What steps did you take and what happened:

use the app-template with the env vars:

env:
  # -- Config dir
  DATA_FOLDER: "config"
  A_FOLDER: "sometest"

This will lead to a e.g. deployment with:

env:
  - name: A_FOLDER
    value: sometest
  - name: DATA_FOLDER
    value: config

Env var sorting breaks dependent environment variables of kubernetes.

What did you expect to happen:

Don't change the order of env vars.

Anything else you would like to add:

Additional Information:

bjw-s commented 1 year ago

Thanks for reporting this! I'll be sure to include this in an upcoming version.

bjw-s commented 1 year ago

I've just completed most of the work on the upcoming version and took another look at this. It looks like it's not something I can easily solve though :( As soon as the underlying Helm Go code touches the values it automatically sorts the keys and the original order is lost. Because in Go the order of dict keys is considered irrelevant there's no proper (default) way available to keep the ordering.

LockedThread commented 10 months ago

Hey you guys should checkout this helm issue and this medium article discussed in the helm issue

onedr0p commented 10 months ago

and this medium article discussed in the helm issue

Holy... that is one gnarly way to solve the issue. My mind is blown.

bjw-s commented 10 months ago

Yep... that is a huge find, thank you! I will add this to the next version for sure