Common values for aliased chart dependencies

Viewed 195

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?

2 Answers

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

You could use yaml anchors and aliases.

    mysql: &mysql
      somename: Overriden
      somename2: NotOverriden
    a:
      <<: *mysql
      somename: A
    b:
      <<: *mysql
      somename: B
Related