{{- if and .Values.externalSecrets.enabled .Values.externalSecrets.manageEDPInstallSecrets (eq .Values.global.dockerRegistry.type "harbor" "dockerhub" "nexus" "ghcr") }}
{{- $secretStore := include "edp-install.secretStoreName" . }}
{{- $awsSecretName := .Values.externalSecrets.manageEDPInstallSecretsName }}
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: regcred
spec:
  target:
    template:
      metadata:
        labels:
          app.edp.epam.com/secret-type: registry
          app.edp.epam.com/integration-secret: "true"
      type: kubernetes.io/dockerconfigjson
      data:
        .dockerconfigjson: "{{ `{{ .secretValue }}` }}"
  refreshInterval: 1h
  secretStoreRef:
    kind: SecretStore
    name: {{ $secretStore }}
  data:
  - secretKey: secretValue
    remoteRef:
      key: {{ $awsSecretName }}
      property: regcred
{{- end }}
