diff --git a/common/templates/_configmap.tpl b/common/templates/_configmap.tpl new file mode 100644 index 0000000000000000000000000000000000000000..ae3c9bf204563179916c03505a876ec08e549299 --- /dev/null +++ b/common/templates/_configmap.tpl @@ -0,0 +1,15 @@ +{{- define "common.configmap" -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Values.name | default "configmap" | quote }} + {{- with .Values.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- include "common.variables.labels" . | nindent 4 }} +data: + {{- (include "common.variables.configmap.data" .) | nindent 2 }} +--- +{{- end }} diff --git a/common/templates/_helpers.tpl b/common/templates/_helpers.tpl index a19106818eabcd637c140828c35519a549203f2f..c86d105293524b09987174aa715738003710930d 100644 --- a/common/templates/_helpers.tpl +++ b/common/templates/_helpers.tpl @@ -59,3 +59,14 @@ Secret data {{- end }} {{- toYaml $data -}} {{- end }} + +{{/* +ConfigMap data +*/}} +{{- define "common.variables.configmap.data" -}} +{{- $data := dict -}} +{{- range $key, $value := .Values.data -}} + {{- $data = merge $data (dict $key $value) -}} +{{- end }} +{{- toYaml $data -}} +{{- end }}