. {
    errors
    health :18080
{% if mdns %}
    mdns {{ cluster }}.{{ domain }} {{ ctlplanes if 'bootstrap' in name else '0' }} {{ cluster }}
{% endif %}
    hosts {{ cluster }}.{{ domain }} {
        {% if  sno %}
        {{ api_ip }} {{ cluster }}-sno {{ cluster }}-sno.{{ cluster }}.{{ domain }} api-int.{{ cluster }}.{{ domain }} api.{{ cluster }}.{{ domain }}
        {% else %}
        {{ api_ip }} api-int.{{ cluster }}.{{ domain }} api.{{ cluster }}.{{ domain }}
        {% endif %}
        fallthrough
    }
{% set apps_ip = ingress_ip if ingress_ip != None else api_ip %}
{% set apps_type = 'AAAA' if ':' in apps_ip else 'A' %}
    template IN {{ apps_type }} apps.{{ cluster }}.{{ domain }} {
       answer "{% raw %}{{ .Name }}{% endraw %} {{ apps_type }} {{ apps_ip }}"
    }
    template IN {{ 'A' if apps_type == 'AAAA' else 'AAAA' }} apps.{{ cluster }}.{{ domain }} {
       rcode NOERROR
    }
    forward . {{ coredns_nameserver or "NAMESERVER" }}
    cache 30
    reload
}
