Helm: variables in values.yaml

6/20/2019

I have a need to use variables inside of values.yaml file:

app:
    version: 1.0

my_app1:
    tag: {{ .app.version }} <- version taken from appVersion. In my case tag == version

Any help will be really appreciated.

-- user2738882
kubernetes
kubernetes-helm

2 Answers

6/20/2019

If your values.yaml looks like following:

...
app:
  version: <version_string>
...

then simply put this:

app:
  version: 1.0

my_app1:
  tag: {{ .Values.app.version }
-- Shudipta Sharma
Source: StackOverflow

6/20/2019
app:
    version: 1.0

my_app1:
    tag:  {{ .Values.app.version }}

{{ .Values.app | first | default .Values.app.version }}

You can also try this EDIT - 2

{{- range $key, $value := .Values.app }}
       {{ $key }}: {{ $value }}
{{- end }}
-- Harsh Manvar
Source: StackOverflow