From b9fe3010364fdfd3ab3ef19e63b4836c365f930c Mon Sep 17 00:00:00 2001 From: Kay Yan Date: Fri, 2 Dec 2022 14:37:54 +0800 Subject: [PATCH] add-check-for-resolv-to-avoid-coredns-crash (#9502) --- roles/kubernetes/preinstall/tasks/0040-set_facts.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/roles/kubernetes/preinstall/tasks/0040-set_facts.yml b/roles/kubernetes/preinstall/tasks/0040-set_facts.yml index 08deb1c86..3ae8412ba 100644 --- a/roles/kubernetes/preinstall/tasks/0040-set_facts.yml +++ b/roles/kubernetes/preinstall/tasks/0040-set_facts.yml @@ -75,6 +75,16 @@ when: resolvconf_stat.stat.exists is defined and resolvconf_stat.stat.exists +- name: Stop if /etc/resolv.conf not configured nameservers + assert: + that: configured_nameservers|length>0 + fail_msg: "nameserver should not empty in /etc/resolv.conf" + when: + - not ignore_assert_errors + - configured_nameservers is defined + - not (upstream_dns_servers is defined and upstream_dns_servers|length > 0) + - not (disable_host_nameservers | default(false)) + - name: NetworkManager | Check if host has NetworkManager # noqa 303 Should we use service_facts for this? command: systemctl is-active --quiet NetworkManager.service