Values dependencies¶
Sometimes we need to include values from another values file. In this case we can use getValues
function.
helmwave.yml
project: "Example: values dependencies"
version: 0.38.0
repositories:
- name: bitnami
url: https://charts.bitnami.com/bitnami
.options: &options
namespace: my-namespace
wait: true
releases:
- name: nginx
<<: *options
chart: bitnami/nginx
values:
- values/common.yml
- values/nginx.yml
- name: redis
<<: *options
chart: bitnami/redis
values:
- values/common.yml
- values/redis.yml
values/common.yml
global:
podLabels:
foo: {{ now }}
values/nginx.yml
{{ $common := getValues "values/common.yml" }}
podLabels:
{{- range $key, $value := $common.global.podLabels }}
{{ $key }}: {{ $value }}
{{- end }}
values/redis.yml
{{ $common := getValues "values/common.yml" }}
master:
podLabels:
{{- range $key, $value := $common.global.podLabels }}
{{ $key }}: {{ $value }}
{{- end }}
In this example we have values-common.yml
to store some common values independently of the chart. It is defined as a
values file for each release. We use getValues
function to reference these values.
Rendered values files will look like that:
nginx/common.yml
global:
podLabels:
foo: 2024-04-29 19:06:12.13501 +0400 +04 m=+0.142733501
nginx/nginx.yml
podLabels:
foo: 2024-04-29 19:06:12.13501 +0400 +04 m=+0.142733501
redis/common.yml
global:
podLabels:
foo: 2024-04-29 19:06:12.135011 +0400 +04 m=+0.142734251
redis/redis.yml
master:
podLabels:
foo: 2024-04-29 19:06:12.135011 +0400 +04 m=+0.142734251