{{- if and .Values.externalSecrets.enabled .Values.externalSecrets.manageEDPInstallSecrets }}
{{- $secretStore := include "edp-install.secretStoreName" . }}
{{- $awsSecretName := .Values.externalSecrets.manageEDPInstallSecretsName }}
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: ci-defectdojo
spec:
  target:
    template:
      metadata:
        labels:
          app.edp.epam.com/secret-type: defectdojo
          app.edp.epam.com/integration-secret: "true"
  refreshInterval: 1h
  secretStoreRef:
    kind: SecretStore
    name: {{ $secretStore }}
  data:
  - secretKey: token
    remoteRef:
      key: {{ $awsSecretName }}
      property: ci-defectdojo.token
  - secretKey: url
    remoteRef:
      key: {{ $awsSecretName }}
      property: ci-defectdojo.url
{{- end }}
