improwised-charts/charts/mosquitto-mqtt/charts/common/templates/class/_secret.tpl

36 lines
1.0 KiB
Smarty

{{/*
This template serves as a blueprint for all secret objects that are created
within the common library.
*/}}
{{- define "tc.common.class.secret" -}}
{{- $fullName := include "tc.common.names.fullname" . -}}
{{- $secretName := $fullName -}}
{{- $values := .Values.secret -}}
{{- if hasKey . "ObjectValues" -}}
{{- with .ObjectValues.secret -}}
{{- $values = . -}}
{{- end -}}
{{ end -}}
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
{{- $secretName = printf "%v-%v" $secretName $values.nameOverride -}}
{{- end }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ $secretName }}
{{- with (merge ($values.labels | default dict) (include "tc.common.labels" $ | fromYaml)) }}
labels: {{- toYaml . | nindent 4 }}
{{- end }}
{{- with (merge ($values.annotations | default dict) (include "tc.common.annotations" $ | fromYaml)) }}
annotations:
{{- tpl ( toYaml . ) $ | nindent 4 }}
{{- end }}
stringData:
{{- with $values.data }}
{{- tpl (toYaml .) $ | nindent 2 }}
{{- end }}
{{- end }}