{{- if and .Values.acme.enabled (eq .Values.acme.challengeType "dns-01") .Values.acme.dnsProvider.name (not .Values.acme.dnsProvider.existingSecretName) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "traefik.fullname" . }}-dnsprovider-config
  labels:
    app: {{ template "traefik.name" . }}
    chart: {{ template "traefik.chart" . }}
    release: {{ .Release.Name | quote }}
    heritage: {{ .Release.Service | quote }}
type: Opaque
data:
{{- range $k, $v := (index .Values.acme.dnsProvider .Values.acme.dnsProvider.name) }}
  {{- if $v }}
    {{ $k }}: {{ $v | b64enc | quote }}
  {{- end }}
{{- end }}
{{- end }}
