From 61d3fe832fd65b3207c4a5dace920c4b416b76da Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Fri, 18 Oct 2024 07:57:53 +0200 Subject: [PATCH] secrets/configmaps added --- templates/_configmaps.tpl | 28 ++++++++++++++++++++++++++++ templates/_secrets.tpl | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 templates/_configmaps.tpl create mode 100644 templates/_secrets.tpl diff --git a/templates/_configmaps.tpl b/templates/_configmaps.tpl new file mode 100644 index 0000000..cb1e596 --- /dev/null +++ b/templates/_configmaps.tpl @@ -0,0 +1,28 @@ +{{- 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 -}} \ No newline at end of file diff --git a/templates/_secrets.tpl b/templates/_secrets.tpl new file mode 100644 index 0000000..32592ac --- /dev/null +++ b/templates/_secrets.tpl @@ -0,0 +1,33 @@ +{{- define "lib.secrets" -}} +{{- $fullName := include "lib.fullname" . -}} +{{- $namespace := .Values.namespace -}} +{{- $commonLabels := include "lib.labels" . }} +{{- range $name, $values := .Values.secrets }} +{{- if $values.enabled -}} +--- +apiVersion: v1 +kind: Secret +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 }} +type: {{ $values.type | default "Opauge" }} +{{- with $values.data }} +data: + {{- toYaml . | nindent 2 }} +{{- end }} +{{- with $values.stringData }} +stringData: + {{- toYaml . | nindent 2 }} +{{- end }} +{{- end }} +{{- end -}} +{{- end -}} \ No newline at end of file