scale-catalog/library/common/templates/lib/resources/_certSecret.yaml

26 lines
815 B
YAML
Raw Normal View History

2021-05-08 10:42:35 +00:00
{{- define "common.resources.cert.secret" -}}
{{- $secretName := include "common.names.fullname" . -}}
{{- if .ObjectValues.certHolder -}}
{{- if hasKey .ObjectValues.certHolder "nameSuffix" -}}
{{- $secretName = printf "%v-%v" $secretName .ObjectValues.certHolder.nameSuffix -}}
{{ end -}}
{{ else }}
{{- $_ := set $ "ObjectValues" (dict "certHolder" .Values) -}}
{{ end -}}
{{- if eq (include "common.resources.cert.available" $ ) "true" -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ $secretName }}
labels: {{ include "common.labels" . | nindent 4 }}
type: kubernetes.io/tls
data:
tls.crt: {{ (include "common.resources.cert.publicKey" $ ) | toString | b64enc | quote }}
tls.key: {{ (include "common.resources.cert.privateKey" $ ) | toString | b64enc | quote }}
{{- end -}}
{{- end -}}