{{- range .Values.externalSecrets }}
---
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
  name: {{ .name }}
  namespace: {{ .namespace }}
spec:
  refreshInterval: {{ .refreshInterval | default "1h" }}
  secretStoreRef:
    name: {{ $.Values.secretStore.name }}
    kind: {{ $.Values.secretStore.kind }}
  target:
    name: {{ .targetName }}
    creationPolicy: {{ .creationPolicy | default "Owner" }}
  data:
{{- range .data }}
    - secretKey: {{ .secretKey }}
      remoteRef:
        key: {{ .remoteKey }}
        property: {{ .property }}
{{- end }}
{{- end }}
