apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: elasticsearch-metrics-apiserver-secrets
  namespace: {{ .Release.Namespace }}
spec:
  refreshInterval: 5m
  secretStoreRef:
    name: mki-cluster-secret-store
    kind: ClusterSecretStore
  dataFrom: 
    - extract:
{{- if .Values.metadata }}
       key: {{ printf "platform/%s/%s/%s/o11y/%s" (.Values.metadata.environment) (.Values.metadata.csp) (.Values.metadata.region) (.Values.o11yUser) }}
       decodingStrategy: None
  target:
    name: elasticsearch-metrics-apiserver-secrets
    creationPolicy: Owner
{{- end }}