mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 08:57:04 +02:00
27 lines
954 B
Smarty
27 lines
954 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 -}}
|
|
{{- $override := tpl $objectValues.nameOverride $rootContext -}}
|
|
{{- if not (eq $objectName $override) -}}
|
|
{{- $objectName = printf "%s-%s" $objectName $override -}}
|
|
{{- end -}}
|
|
{{- else -}}
|
|
{{- if not (eq $objectName $identifier) -}}
|
|
{{- $objectName = printf "%s-%s" $objectName $identifier -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- $_ := set $objectValues "name" $objectName -}}
|
|
{{- $_ := set $objectValues "identifier" $identifier -}}
|
|
|
|
{{- /* Return the configMap object */ -}}
|
|
{{- $objectValues | toYaml -}}
|
|
{{- end -}}
|