helm-charts/charts/library/common/templates/classes/_secret.tpl
Bernd Schorgers 433f6d132b
feat(common): Release common library 3.7.1 (#383)
Co-authored-by: Aisling McGinn <me@aisling.dev>
2025-02-11 13:23:27 +01:00

46 lines
1.3 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:
{{- 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 $stringData }}
stringData: {{- tpl $stringData $rootContext | nindent 2 }}
{{- end }}
{{- end -}}