{{- if not .Values.existingSecret }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "postgresql.fullname" . }}
  labels:
    app: {{ template "postgresql.name" . }}
    chart: {{ template "postgresql.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
type: Opaque
data:
  {{ if .Values.postgresPassword }}
  postgres-password:  {{ .Values.postgresPassword | b64enc | quote }}
  {{ else }}
  postgres-password: {{ randAlphaNum 10 | b64enc | quote }}
  {{ end }}
{{- end }}
