{{- if .Values.postgresql.existingSecret -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ .Values.postgresql.existingSecret }}
  annotations:
    helm.sh/hook: pre-install
  labels:
    chart: {{ template "kubeapps.chart" . }}
    helm.sh/chart: {{ template "kubeapps.chart" . }}
    release: {{ .Release.Name }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
  postgresql-password: {{ randAlphaNum 10 | b64enc | quote }}
  postgresql-replication-password: {{ randAlphaNum 10 | b64enc | quote }}
{{- end -}}
