{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}

{{- $secretName := coalesce .Values.externalDatabase.dataflow.existingSecret .Values.externalDatabase.existingPasswordSecret -}}
{{- if and (not .Values.mariadb.enabled) (not $secretName) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ printf "%s-externaldb" (include "scdf.server.fullname" .) }}
  labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
  namespace: {{ include "common.names.namespace" . | quote }}
  {{- if .Values.commonAnnotations }}
  annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  {{- end }}
type: Opaque
data:
  datasource-password: {{ .Values.externalDatabase.dataflow.password | b64enc | quote }}
{{- end }}
