helm-charts/charts/library/common/templates/lib/configMap/_valuesToObject.tpl
2023-09-13 11:24:23 +02:00

24 lines
827 B
Smarty

{{/*
Convert configMap values to an object
*/}}
{{- define "bjw-s.common.lib.configMap.valuesToObject" -}}
{{- $rootContext := .rootContext -}}
{{- $identifier := .id -}}
{{- $objectValues := .values -}}
{{- /* Determine and inject the configMap name */ -}}
{{- $objectName := (include "bjw-s.common.lib.chart.names.fullname" $rootContext) -}}
{{- if $objectValues.nameOverride -}}
{{- $objectName = printf "%s-%s" $objectName $objectValues.nameOverride -}}
{{- else -}}
{{- if ne $identifier "main" -}}
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
{{- end -}}
{{- end -}}
{{- $_ := set $objectValues "name" $objectName -}}
{{- $_ := set $objectValues "identifier" $identifier -}}
{{- /* Return the configMap object */ -}}
{{- $objectValues | toYaml -}}
{{- end -}}