diff --git a/roles/kubernetes-apps/ansible/templates/coredns-config.yml.j2 b/roles/kubernetes-apps/ansible/templates/coredns-config.yml.j2 index 8a4811937..841dc6501 100644 --- a/roles/kubernetes-apps/ansible/templates/coredns-config.yml.j2 +++ b/roles/kubernetes-apps/ansible/templates/coredns-config.yml.j2 @@ -73,7 +73,9 @@ data: max_concurrent 1000 {% if dns_upstream_forward_extra_opts is defined %} {% for optname, optvalue in dns_upstream_forward_extra_opts.items() %} - {{ optname }} {{ optvalue }} + {{ (optname ~ ' ' ~ optvalue) | trim }} + {# do not add a trailing space when optvalue == '' + workaround for: https://github.com/kubernetes/kubernetes/issues/36222 #} {% endfor %} {% endif %} } diff --git a/roles/kubernetes-apps/ansible/templates/nodelocaldns-config.yml.j2 b/roles/kubernetes-apps/ansible/templates/nodelocaldns-config.yml.j2 index 802915b3a..1a91f1179 100644 --- a/roles/kubernetes-apps/ansible/templates/nodelocaldns-config.yml.j2 +++ b/roles/kubernetes-apps/ansible/templates/nodelocaldns-config.yml.j2 @@ -85,7 +85,9 @@ data: bind {{ nodelocaldns_ip }} forward . {{ upstreamForwardTarget }}{% if dns_upstream_forward_extra_opts is defined %} { {% for optname, optvalue in dns_upstream_forward_extra_opts.items() %} - {{ optname }} {{ optvalue }} + {{ (optname ~ ' ' ~ optvalue) | trim }} + {# do not add a trailing space when optvalue == '' + workaround for: https://github.com/kubernetes/kubernetes/issues/36222 #} {% endfor %} }{% endif %} @@ -170,7 +172,9 @@ data: bind {{ nodelocaldns_ip }} forward . {{ upstreamForwardTarget }}{% if dns_upstream_forward_extra_opts is defined %} { {% for optname, optvalue in dns_upstream_forward_extra_opts.items() %} - {{ optname }} {{ optvalue }} + {{ (optname ~ ' ' ~ optvalue) | trim }} + {# do not add a trailing space when optvalue == '' + workaround for: https://github.com/kubernetes/kubernetes/issues/36222 #} {% endfor %} }{% endif %}