helm-charts/charts/library/common/templates/classes/_secret.tpl
2023-09-13 11:24:23 +02:00

39 lines
1.1 KiB
Smarty

{{/*
This template serves as a blueprint for all Secret objects that are created
within the common library.
*/}}
{{- define "bjw-s.common.class.secret" -}}
{{- $rootContext := .rootContext -}}
{{- $secretObject := .object -}}
{{- $labels := merge
($secretObject.labels | default dict)
(include "bjw-s.common.lib.metadata.allLabels" $rootContext | fromYaml)
-}}
{{- $annotations := merge
($secretObject.annotations | default dict)
(include "bjw-s.common.lib.metadata.globalAnnotations" $rootContext | fromYaml)
-}}
{{- $stringData := "" -}}
{{- with $secretObject.stringData -}}
{{- $stringData = (toYaml $secretObject.stringData) | trim -}}
{{- end -}}
---
apiVersion: v1
kind: Secret
{{- with $secretObject.type }}
type: {{ . }}
{{- end }}
metadata:
name: {{ $secretObject.name }}
{{- with $labels }}
labels: {{- toYaml . | nindent 4 -}}
{{- end }}
{{- with $annotations }}
annotations: {{- toYaml . | nindent 4 -}}
{{- end }}
{{- with $stringData }}
stringData: {{- tpl $stringData $rootContext | nindent 2 }}
{{- end }}
{{- end -}}