helm-charts/charts/library/common/templates/classes/_configmap.tpl
Bernd Schorgers a01a89cb13
feat(common): Release common 4.0.0 (#398)
Co-authored-by: lab-assistant[bot] <180935599+lab-assistant[bot]@users.noreply.github.com>
2025-05-16 08:55:14 +02:00

43 lines
1.3 KiB
Smarty

{{/*
This template serves as a blueprint for all configMap objects that are created
within the common library.
*/}}
{{- define "bjw-s.common.class.configMap" -}}
{{- $rootContext := .rootContext -}}
{{- $configMapObject := .object -}}
{{- $labels := merge
($configMapObject.labels | default dict)
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
-}}
{{- $annotations := merge
($configMapObject.annotations | default dict)
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
-}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ $configMapObject.name }}
{{- with $labels }}
labels:
{{- range $key, $value := . }}
{{- printf "%s: %s" $key (tpl $value $rootContext | toYaml ) | nindent 4 }}
{{- end }}
{{- end }}
{{- with $annotations }}
annotations:
{{- range $key, $value := . }}
{{- printf "%s: %s" $key (tpl $value $rootContext | toYaml ) | nindent 4 }}
{{- end }}
{{- end }}
namespace: {{ $rootContext.Release.Namespace }}
{{- with $configMapObject.data }}
data:
{{- tpl (toYaml .) $rootContext | nindent 2 }}
{{- end }}
{{- with $configMapObject.binaryData }}
binaryData:
{{- tpl (toYaml .) $rootContext | nindent 2 }}
{{- end }}
{{- end -}}