{{- 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-nexus
spec:
  target:
    template:
      metadata:
        labels:
          app.edp.epam.com/secret-type: nexus
          app.edp.epam.com/integration-secret: "true"
  refreshInterval: 1h
  secretStoreRef:
    kind: SecretStore
    name: {{ $secretStore }}
  data:
  - secretKey: username
    remoteRef:
      key: {{ $awsSecretName }}
      property: ci-nexus.username
  - secretKey: password
    remoteRef:
      key: {{ $awsSecretName }}
      property: ci-nexus.password
  - secretKey: url
    remoteRef:
      key: {{ $awsSecretName }}
      property: ci-nexus.url
{{- end }}
