Helm: Join two lists


Since early 2019 the sprig library used by helm provides a concat function that does exactly this.

Examples

Based on these values:

oneList:
  - hello
  - world
anotherList:
  - some
  - values

Create a comma-separated from two lists

Template: {{ concat .Values.oneList .Values.anotherList | join ","}}

Result: hello,world,some,values

Loop over the results with range

Template:

{{ range $value := (concat .Values.oneList .Values.anotherList) }}
{{ $value }}
{{ end }}

Result:

hello
world
some
value
helm  k8s 

See also