51 lines
1.8 KiB
Smarty
51 lines
1.8 KiB
Smarty
{{/* Configmap Spawwner */}}
|
|
{{/* Call this template:
|
|
{{ include "tc.v1.common.spawner.configmap" $ -}}
|
|
*/}}
|
|
|
|
{{- define "tc.v1.common.spawner.configmap" -}}
|
|
{{- $fullname := include "tc.v1.common.lib.chart.names.fullname" $ -}}
|
|
|
|
{{- range $name, $configmap := .Values.configmap -}}
|
|
|
|
{{- $enabled := (include "tc.v1.common.lib.util.enabled" (dict
|
|
"rootCtx" $ "objectData" $configmap
|
|
"name" $name "caller" "ConfigMap"
|
|
"key" "configmap")) -}}
|
|
|
|
{{- if eq $enabled "true" -}}
|
|
|
|
{{/* Create a copy of the configmap */}}
|
|
{{- $objectData := (mustDeepCopy $configmap) -}}
|
|
|
|
{{- $objectName := $name -}}
|
|
|
|
{{- $expandName := (include "tc.v1.common.lib.util.expandName" (dict
|
|
"rootCtx" $ "objectData" $objectData
|
|
"name" $name "caller" "ConfigMap"
|
|
"key" "configmap")) -}}
|
|
|
|
{{- if eq $expandName "true" -}}
|
|
{{- $objectName = (printf "%s-%s" $fullname $name) -}}
|
|
{{- end -}}
|
|
|
|
{{- include "tc.v1.common.lib.util.metaListToDict" (dict "objectData" $objectData) -}}
|
|
|
|
{{/* Perform validations */}} {{/* Configmaps have a max name length of 253 */}}
|
|
{{- include "tc.v1.common.lib.chart.names.validation" (dict "name" $objectName "length" 253) -}}
|
|
{{- include "tc.v1.common.lib.configmap.validation" (dict "objectData" $objectData) -}}
|
|
{{- include "tc.v1.common.lib.metadata.validation" (dict "objectData" $objectData "caller" "ConfigMap") -}}
|
|
|
|
{{/* Set the name of the configmap */}}
|
|
{{- $_ := set $objectData "name" $objectName -}}
|
|
{{- $_ := set $objectData "shortName" $name -}}
|
|
|
|
{{/* Call class to create the object */}}
|
|
{{- include "tc.v1.common.class.configmap" (dict "rootCtx" $ "objectData" $objectData) -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|