common-helm-lib/templates/_configmaps.tpl
2024-10-18 07:57:53 +02:00

28 lines
705 B
Smarty

{{- define "lib.configs" -}}
{{- $fullName := include "lib.fullname" . -}}
{{- $namespace := .Values.namespace -}}
{{- $commonLabels := include "lib.labels" . }}
{{- range $name, $values := .Values.configs }}
{{- if $values.enabled -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ $fullName }}-{{ $name }}
namespace: {{ $namespace }}
labels:
{{- $commonLabels | nindent 4 }}
{{- with $values.labels }}
{{ toYaml . | nindent 4 }}
{{- end }}
{{- with $values.annotations }}
annotations:
{{ toYaml . | nindent 4 }}
{{- end }}
{{- with $values.data }}
data:
{{- tpl (toYaml .) $ | nindent 2 }}
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}