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