2

I have Chart.yaml as:

dependencies:
    - name: mysql
      version: "5.0.9"
      repository: "https://charts.bitnami.com/bitnami"
      alias: a
    - name: mysql
      version: "5.0.9"
      repository: "https://charts.bitnami.com/bitnami"
      alias: b

and values.yaml as

mysql:
  somename: Overriden
  somename2: NotOverriden
a:
  somename: A
b:
  somename: B

but the helm is reading only values from a: and b:. I would expect that values from mysql: are applied to both a: and b: and overridden where needed.

Is this possible at all, or is there some other way?

David Maze
  • 130,717
  • 29
  • 175
  • 215
Bojan Vukasovic
  • 2,054
  • 22
  • 43
  • With yaml file you may reference value but helm doesnt support it if you want to set value while you install chart. I suggest you to use tpl function, by this way you may create generic values with or wothout condtion.. – newuserua_ext May 06 '22 at 20:47

2 Answers2

2

You could use yaml anchors and aliases.

    mysql: &mysql
      somename: Overriden
      somename2: NotOverriden
    a:
      <<: *mysql
      somename: A
    b:
      <<: *mysql
      somename: B
GK_
  • 21
  • 3
0

Maybe I missed the question but you can use global values:

https://helm.sh/docs/chart_template_guide/subcharts_and_globals/#global-chart-values

values.yaml:

global:
  somename: A
  somename2: B

btw, in your example you can't have the same dependency twice, helm will delete the first one:

❯ helm dependency build
Getting updates for unmanaged Helm repositories...
...Successfully got an update from the "https://charts.bitnami.com/bitnami" chart repository
Saving 2 charts
Downloading mysql from repo https://charts.bitnami.com/bitnami
Already downloaded mysql from repo https://charts.bitnami.com/bitnami
Deleting outdated charts
Bguess
  • 1,700
  • 1
  • 11
  • 24
  • 1
    Tried this, but seems that dependencies also need to have "global" section in their files for this to work. Other option was that I directly write properties to values files (so without global prefix) - and this one works to some extent, but the problem here is that it is also applied to other dependencies that I don't want to. – Bojan Vukasovic May 09 '22 at 07:50
  • Isn't the point of `alias` to have the same chart multiple times? https://helm.sh/docs/topics/charts/#the-chartyaml-file Plus that log output is just the fetching of the chart; the alias(es) are relevant to the usage of the chart i.e. application of the two set of values, `a` and `b` – Darren Bishop Jun 18 '23 at 11:19