---
apiVersion: v1
kind: ConfigMap
metadata:
  name: coredns-custom
  namespace: kube-system
data:
  # Custom server block for internal domains. All internal domains should
  # resolve to the cluster proxy.
  internal.server: |
    {{ .cloud.internalDomain }} {
      errors
      cache 30
      reload
      template IN A {
        match (.*)\.{{ .cloud.internalDomain | strings.ReplaceAll "." "\\." }}\.
        answer "{{`{{"{{ .Name }}"}}`}} 60 IN A {{ .cluster.loadBalancerIp }}"
      }
      template IN AAAA {
        match (.*)\.{{ .cloud.internalDomain | strings.ReplaceAll "." "\\." }}\.
        rcode NXDOMAIN
      }
    }
  # Custom override to set external resolvers.
  external.override: |
    forward . {{ .cloud.dns.externalResolver }} {
      max_concurrent 1000
    }
