You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

182 lines
5.4 KiB

  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: nodelocaldns
  5. namespace: kube-system
  6. labels:
  7. addonmanager.kubernetes.io/mode: EnsureExists
  8. data:
  9. Corefile: |
  10. {% if nodelocaldns_external_zones is defined and nodelocaldns_external_zones | length > 0 %}
  11. {% for block in nodelocaldns_external_zones %}
  12. {{ block['zones'] | join(' ') }} {
  13. errors
  14. cache {{ block['cache'] | default(30) }}
  15. reload
  16. {% if block['rewrite'] is defined and block['rewrite'] | length > 0 %}
  17. {% for rewrite_match in block['rewrite'] %}
  18. rewrite {{ rewrite_match }}
  19. {% endfor %}
  20. {% endif %}
  21. loop
  22. bind {{ nodelocaldns_ip }}
  23. forward . {{ block['nameservers'] | join(' ') }}
  24. prometheus {% if nodelocaldns_bind_metrics_host_ip %}{$MY_HOST_IP}{% endif %}:{{ nodelocaldns_prometheus_port }}
  25. log
  26. {% if dns_etchosts | default(None) %}
  27. hosts /etc/coredns/hosts {
  28. fallthrough
  29. }
  30. {% endif %}
  31. }
  32. {% endfor %}
  33. {% endif %}
  34. {{ ([dns_domain] + old_dns_domains) | join(' ') }}:53 {
  35. errors
  36. cache {
  37. success 9984 30
  38. denial 9984 5
  39. }
  40. reload
  41. loop
  42. bind {{ nodelocaldns_ip }}
  43. forward . {{ forwardTarget }} {
  44. force_tcp
  45. }
  46. prometheus {% if nodelocaldns_bind_metrics_host_ip %}{$MY_HOST_IP}{% endif %}:{{ nodelocaldns_prometheus_port }}
  47. health {{ nodelocaldns_ip }}:{{ nodelocaldns_health_port }}
  48. {% if dns_etchosts | default(None) %}
  49. hosts /etc/coredns/hosts {
  50. fallthrough
  51. }
  52. {% endif %}
  53. }
  54. in-addr.arpa:53 {
  55. errors
  56. cache 30
  57. reload
  58. loop
  59. bind {{ nodelocaldns_ip }}
  60. forward . {{ forwardTarget }} {
  61. force_tcp
  62. }
  63. prometheus {% if nodelocaldns_bind_metrics_host_ip %}{$MY_HOST_IP}{% endif %}:{{ nodelocaldns_prometheus_port }}
  64. }
  65. ip6.arpa:53 {
  66. errors
  67. cache 30
  68. reload
  69. loop
  70. bind {{ nodelocaldns_ip }}
  71. forward . {{ forwardTarget }} {
  72. force_tcp
  73. }
  74. prometheus {% if nodelocaldns_bind_metrics_host_ip %}{$MY_HOST_IP}{% endif %}:{{ nodelocaldns_prometheus_port }}
  75. }
  76. .:53 {
  77. errors
  78. cache 30
  79. reload
  80. loop
  81. bind {{ nodelocaldns_ip }}
  82. forward . {{ upstreamForwardTarget }}{% if dns_upstream_forward_extra_opts is defined %} {
  83. {% for optname, optvalue in dns_upstream_forward_extra_opts.items() %}
  84. {{ optname }} {{ optvalue }}
  85. {% endfor %}
  86. }{% endif %}
  87. prometheus {% if nodelocaldns_bind_metrics_host_ip %}{$MY_HOST_IP}{% endif %}:{{ nodelocaldns_prometheus_port }}
  88. {% if dns_etchosts | default(None) %}
  89. hosts /etc/coredns/hosts {
  90. fallthrough
  91. }
  92. {% endif %}
  93. }
  94. {% if enable_nodelocaldns_secondary %}
  95. Corefile-second: |
  96. {% if nodelocaldns_external_zones is defined and nodelocaldns_external_zones | length > 0 %}
  97. {% for block in nodelocaldns_external_zones %}
  98. {{ block['zones'] | join(' ') }} {
  99. errors
  100. cache {{ block['cache'] | default(30) }}
  101. reload
  102. loop
  103. bind {{ nodelocaldns_ip }}
  104. forward . {{ block['nameservers'] | join(' ') }}
  105. prometheus {% if nodelocaldns_bind_metrics_host_ip %}{$MY_HOST_IP}{% endif %}:{{ nodelocaldns_secondary_prometheus_port }}
  106. log
  107. {% if dns_etchosts | default(None) %}
  108. hosts /etc/coredns/hosts {
  109. fallthrough
  110. }
  111. {% endif %}
  112. }
  113. {% endfor %}
  114. {% endif %}
  115. {{ dns_domain }}:53 {
  116. errors
  117. cache {
  118. success 9984 30
  119. denial 9984 5
  120. }
  121. reload
  122. loop
  123. bind {{ nodelocaldns_ip }}
  124. forward . {{ forwardTarget }} {
  125. force_tcp
  126. }
  127. prometheus {% if nodelocaldns_bind_metrics_host_ip %}{$MY_HOST_IP}{% endif %}:{{ nodelocaldns_secondary_prometheus_port }}
  128. health {{ nodelocaldns_ip }}:{{ nodelocaldns_second_health_port }}
  129. {% if dns_etchosts | default(None) %}
  130. hosts /etc/coredns/hosts {
  131. fallthrough
  132. }
  133. {% endif %}
  134. }
  135. in-addr.arpa:53 {
  136. errors
  137. cache 30
  138. reload
  139. loop
  140. bind {{ nodelocaldns_ip }}
  141. forward . {{ forwardTarget }} {
  142. force_tcp
  143. }
  144. prometheus {% if nodelocaldns_bind_metrics_host_ip %}{$MY_HOST_IP}{% endif %}:{{ nodelocaldns_secondary_prometheus_port }}
  145. }
  146. ip6.arpa:53 {
  147. errors
  148. cache 30
  149. reload
  150. loop
  151. bind {{ nodelocaldns_ip }}
  152. forward . {{ forwardTarget }} {
  153. force_tcp
  154. }
  155. prometheus {% if nodelocaldns_bind_metrics_host_ip %}{$MY_HOST_IP}{% endif %}:{{ nodelocaldns_secondary_prometheus_port }}
  156. }
  157. .:53 {
  158. errors
  159. cache 30
  160. reload
  161. loop
  162. bind {{ nodelocaldns_ip }}
  163. forward . {{ upstreamForwardTarget }}{% if dns_upstream_forward_extra_opts is defined %} {
  164. {% for optname, optvalue in dns_upstream_forward_extra_opts.items() %}
  165. {{ optname }} {{ optvalue }}
  166. {% endfor %}
  167. }{% endif %}
  168. prometheus {% if nodelocaldns_bind_metrics_host_ip %}{$MY_HOST_IP}{% endif %}:{{ nodelocaldns_secondary_prometheus_port }}
  169. {% if dns_etchosts | default(None) %}
  170. hosts /etc/coredns/hosts {
  171. fallthrough
  172. }
  173. {% endif %}
  174. }
  175. {% endif %}
  176. {% if dns_etchosts | default(None) %}
  177. hosts: |
  178. {{ dns_etchosts | indent(width=4, first=False) }}
  179. {% endif %}