{{- if and .Values.postgresql.enabled (not .Values.postgresql.existingSecret) (eq .Values.postgresql.password "") }}
  {{- fail "postgresql.password is required when postgresql.enabled is true and postgresql.existingSecret is not set" }}
{{- end }}
{{- if and .Values.postgresql.enabled (not .Values.postgresql.existingSecret) -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "supersync.postgresql.fullname" . }}
  labels:
    {{- include "supersync.labels" . | nindent 4 }}
type: Opaque
stringData:
  POSTGRES_PASSWORD: {{ .Values.postgresql.password | quote }}
{{- end }}
