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

{{- if not .Values.backend.existingSecret }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "appsmith.backend.fullname" . }}
  namespace: {{ include "common.names.namespace" . | quote }}
  labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
    app.kubernetes.io/component: backend
  {{- if .Values.commonAnnotations }}
  annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  {{- end }}
type: Opaque
data:
  admin-password: {{ include "common.secrets.passwords.manage" (dict "secret" (include "appsmith.backend.fullname" .) "key" "admin-password" "providedValues" (list "backend.adminPassword") "context" $) }}
  encryption-salt: {{ include "common.secrets.passwords.manage" (dict "secret" (include "appsmith.backend.fullname" .) "key" "encryption-salt" "providedValues" (list "backend.encryptionSalt") "context" $) }}
  encryption-password: {{ include "common.secrets.passwords.manage" (dict "secret" (include "appsmith.backend.fullname" .) "key" "encryption-password" "providedValues" (list "backend.encryptionPassword") "context" $) }}
{{- end }}
