31 lines
1.9 KiB
YAML
31 lines
1.9 KiB
YAML
|
{{- /*
|
||
|
Copyright Broadcom, Inc. All Rights Reserved.
|
||
|
SPDX-License-Identifier: APACHE-2.0
|
||
|
*/}}
|
||
|
|
||
|
{{- if (include "postgresql.v1.createTlsSecret" . ) }}
|
||
|
{{- $secretName := printf "%s-crt" (include "common.names.fullname" .) }}
|
||
|
{{- $ca := genCA "postgresql-ca" 365 }}
|
||
|
{{- $fullname := include "common.names.fullname" . }}
|
||
|
{{- $releaseNamespace := .Release.Namespace }}
|
||
|
{{- $clusterDomain := .Values.clusterDomain }}
|
||
|
{{- $primaryHeadlessServiceName := include "postgresql.v1.primary.svc.headless" . }}
|
||
|
{{- $readHeadlessServiceName := include "postgresql.v1.readReplica.svc.headless" . }}
|
||
|
{{- $altNames := list (printf "*.%s.%s.svc.%s" $fullname $releaseNamespace $clusterDomain) (printf "%s.%s.svc.%s" $fullname $releaseNamespace $clusterDomain) (printf "*.%s.%s.svc.%s" $primaryHeadlessServiceName $releaseNamespace $clusterDomain) (printf "%s.%s.svc.%s" $primaryHeadlessServiceName $releaseNamespace $clusterDomain) (printf "*.%s.%s.svc.%s" $readHeadlessServiceName $releaseNamespace $clusterDomain) (printf "%s.%s.svc.%s" $readHeadlessServiceName $releaseNamespace $clusterDomain) $fullname }}
|
||
|
{{- $cert := genSignedCert $fullname nil $altNames 365 $ca }}
|
||
|
apiVersion: v1
|
||
|
kind: Secret
|
||
|
metadata:
|
||
|
name: {{ $secretName }}
|
||
|
namespace: {{ .Release.Namespace | quote }}
|
||
|
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
|
||
|
{{- if .Values.commonAnnotations }}
|
||
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
||
|
{{- end }}
|
||
|
type: kubernetes.io/tls
|
||
|
data:
|
||
|
tls.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.crt" "defaultValue" $cert.Cert "context" $) }}
|
||
|
tls.key: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "tls.key" "defaultValue" $cert.Key "context" $) }}
|
||
|
ca.crt: {{ include "common.secrets.lookup" (dict "secret" $secretName "key" "ca.crt" "defaultValue" $ca.Cert "context" $) }}
|
||
|
{{- end }}
|