---
# CloudFlare provider for ExternalDNS
apiVersion: apps/v1
kind: Deployment
metadata:
  name: external-dns
  namespace: externaldns
spec:
  selector:
    matchLabels:
      app: external-dns
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: external-dns
    spec:
      serviceAccountName: external-dns
      containers:
        - name: external-dns
          image: registry.k8s.io/external-dns/external-dns:v0.13.4
          args:
            - --source=service
            - --source=ingress
            - --txt-owner-id={{ .cluster.externalDns.ownerId }}
            - --provider=cloudflare
            - --domain-filter=payne.io
            #- --exclude-domains=internal.${DOMAIN}
            - --cloudflare-dns-records-per-page=5000
            - --publish-internal-services
            - --no-cloudflare-proxied
            - --log-level=debug
          env:
            - name: CF_API_TOKEN
              valueFrom:
                secretKeyRef:
                  name: cloudflare-api-token
                  key: api-token