{{- if eq .Values.database.type "postgresql" -}}
{{- if eq .Values.postgresql.enabled false -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "sonarqube.fullname" . }}
  labels:
    app: {{ template "sonarqube.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
type: Opaque
data:
  postgres-password: {{ .Values.postgresql.postgresPassword | b64enc | quote }}
{{- end -}}
{{- end -}}
{{- if eq .Values.database.type "mysql" -}}
{{- if eq .Values.mysql.enabled false -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "sonarqube.fullname" . }}
  labels:
    app: {{ template "sonarqube.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
type: Opaque
data:
  mysql-password: {{ .Values.mysql.mysqlPassword | b64enc | quote }}
{{- end -}}
{{- end -}}

