mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 00:47:04 +02:00
17 lines
454 B
Smarty
17 lines
454 B
Smarty
{{/*
|
|
Returns the items in a map that have a certain key
|
|
*/}}
|
|
{{- define "bjw-s.common.lib.getMapItemsWithKey" -}}
|
|
{{- $map := .map -}}
|
|
{{- $keyToFind := .key -}}
|
|
{{- $output := dict -}}
|
|
|
|
{{- if not (empty $keyToFind) -}}
|
|
{{- range $key, $item := $map -}}
|
|
{{- if not (empty (dig $keyToFind nil $item)) -}}
|
|
{{- $_ := set $output $key $item -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- $output | toYaml -}}
|
|
{{- end }}
|