From edf8b8b9d6108bfbd93f6a7b22bdbdde4ed7906a Mon Sep 17 00:00:00 2001 From: Alex Manning Date: Fri, 3 Mar 2023 21:01:16 +0000 Subject: [PATCH] Add recurseFlattenMap heler. --- charts/zigbee2mqtt/templates/_helpers.tpl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/charts/zigbee2mqtt/templates/_helpers.tpl b/charts/zigbee2mqtt/templates/_helpers.tpl index c44c370..7b5ebe1 100644 --- a/charts/zigbee2mqtt/templates/_helpers.tpl +++ b/charts/zigbee2mqtt/templates/_helpers.tpl @@ -60,3 +60,16 @@ Create the name of the service account to use {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} + +{{- define "recurseFlattenMap" -}} +{{- $map := first . -}} +{{- $label := last . -}} +{{- range $key, $val := $map -}} + {{- $sublabel := list $label $key | join "_" | upper -}} + {{- if kindOf $val | eq "map" -}} + {{- list $val $sublabel | include "recurseFlattenMap" -}} + {{- else -}} +{{ $sublabel }}: {{ $val | quote }} +{{ end -}} +{{- end -}} +{{- end -}}