From e7e0e82f43ab8acedad889f6e8dfa8396847b2e0 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Fri, 16 Dec 2016 11:29:08 +0100 Subject: [PATCH] Fallback to default resolver if no nameservers Current design expects users to define at least one nameserver in the nameservers var to backup host OS DNS config when the K8s cluster DNS service IP is not available and hosts still have to resolve external or intranet FQDNs. Fix undefined nameservers to fallback to the default_resolver. Signed-off-by: Bogdan Dobrelya --- roles/kubernetes/preinstall/tasks/set_resolv_facts.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/kubernetes/preinstall/tasks/set_resolv_facts.yml b/roles/kubernetes/preinstall/tasks/set_resolv_facts.yml index d3a0f58e2..3d49d760b 100644 --- a/roles/kubernetes/preinstall/tasks/set_resolv_facts.yml +++ b/roles/kubernetes/preinstall/tasks/set_resolv_facts.yml @@ -70,7 +70,7 @@ {%- if skip_dnsmasq|bool and not dns_early|bool -%} {{ [ skydns_server ] + upstream_dns_servers|default([]) }} {%- elif dns_early|bool -%} - {{ upstream_dns_servers|default([default_resolver]) }} + {{ upstream_dns_servers|default([]) }} {%- else -%} {{ [ dns_server ] }} {%- endif -%} @@ -78,6 +78,6 @@ - name: generate nameservers to resolvconf set_fact: nameserverentries: - nameserver {{( dnsmasq_server + nameservers|default([])) | join(',nameserver ')}} + nameserver {{( dnsmasq_server + nameservers|default([default_resolver])) | join(',nameserver ')}} supersede_nameserver: - supersede domain-name-servers {{( dnsmasq_server + nameservers|default([])) | join(', ') }}; + supersede domain-name-servers {{( dnsmasq_server + nameservers|default([default_resolver])) | join(', ') }};