[bitnami/common] new macro to merge a list of values with rendering (#18889)

This commit is contained in:
Cyril Jouve
2023-09-04 11:36:53 +02:00
committed by GitHub
parent 8a42abfaec
commit 0fb66f2c6f
11 changed files with 27 additions and 13 deletions

View File

@@ -23,4 +23,4 @@ name: common
sources:
- https://github.com/bitnami/charts
type: library
version: 2.9.2
version: 2.10.0

View File

@@ -22,3 +22,17 @@ Usage:
{{- $value }}
{{- end }}
{{- end -}}
{{/*
Merge a list of values that contains template after rendering them.
Merge precedence is consistent with http://masterminds.github.io/sprig/dicts.html#merge-mustmerge
Usage:
{{ include "common.tplvalues.merge" ( dict "values" (list .Values.path.to.the.Value1 .Values.path.to.the.Value2) "context" $ ) }}
*/}}
{{- define "common.tplvalues.merge" -}}
{{- $dst := dict -}}
{{- range .values -}}
{{- $dst = include "common.tplvalues.render" (dict "value" . "context" $.context "scope" $.scope) | fromYaml | merge $dst -}}
{{- end -}}
{{ $dst | toYaml }}
{{- end -}}