{{ if or (empty .Values.superuserSecret.name) (empty .Values.replicationSecret.name) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "stolon.fullname" . }}
  labels:
    app: {{ template "stolon.name" . }}
    chart: {{ template "stolon.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
type: Opaque
data:
{{ if empty .Values.superuserSecret.name }}
  pg_su_password: {{ required "A valid .Values.superuserPassword entry is required!" .Values.superuserPassword | b64enc | quote }}
{{ end }}
{{ if empty .Values.replicationSecret.name }}
  pg_repl_password: {{ required "A valid .Values.replicationPassword entry is required!" .Values.replicationPassword | b64enc | quote }}
{{ end }}
{{ end }}
