From d3101d65aa5da124aafc610fbb0d42feedb33326 Mon Sep 17 00:00:00 2001 From: Elias-elastisys <112404905+Elias-elastisys@users.noreply.github.com> Date: Tue, 10 Oct 2023 14:32:41 +0200 Subject: [PATCH] Added templating to coredns error to allow for consolidation (#10501) --- roles/kubernetes-apps/ansible/defaults/main.yml | 2 ++ .../ansible/templates/coredns-config.yml.j2 | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/roles/kubernetes-apps/ansible/defaults/main.yml b/roles/kubernetes-apps/ansible/defaults/main.yml index 4de1fe916..4e8b23356 100644 --- a/roles/kubernetes-apps/ansible/defaults/main.yml +++ b/roles/kubernetes-apps/ansible/defaults/main.yml @@ -27,6 +27,8 @@ coredns_default_zone_cache_block: | # answer name (.*)\.svc\.cluster\.local {1}.my.domain # } +# coredns_additional_error_config: | +# consolidate 5m ".* i/o timeout$" warning # dns_upstream_forward_extra_opts apply to coredns forward section as well as nodelocaldns upstream target forward section # dns_upstream_forward_extra_opts: diff --git a/roles/kubernetes-apps/ansible/templates/coredns-config.yml.j2 b/roles/kubernetes-apps/ansible/templates/coredns-config.yml.j2 index 7a06023e8..004ce0643 100644 --- a/roles/kubernetes-apps/ansible/templates/coredns-config.yml.j2 +++ b/roles/kubernetes-apps/ansible/templates/coredns-config.yml.j2 @@ -12,7 +12,11 @@ data: {% for block in coredns_external_zones %} {{ block['zones'] | join(' ') }} { log - errors + errors { +{% if coredns_additional_error_config is defined %} + {{ coredns_additional_error_config | indent(width=10, first=False) }} +{% endif %} + } {% if block['rewrite'] is defined and block['rewrite'] | length > 0 %} {% for rewrite_match in block['rewrite'] %} rewrite {{ rewrite_match }} @@ -31,10 +35,14 @@ data: {% endfor %} {% endif %} .:53 { - {% if coredns_additional_configs is defined %} +{% if coredns_additional_configs is defined %} {{ coredns_additional_configs | indent(width=8, first=False) }} - {% endif %} - errors +{% endif %} + errors { +{% if coredns_additional_error_config is defined %} + {{ coredns_additional_error_config | indent(width=10, first=False) }} +{% endif %} + } health { lameduck 5s }