From 1c25ed669c4a4ce68245826455362c9058550878 Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Wed, 6 Nov 2019 21:11:52 +0300 Subject: [PATCH] Remove unnecessary and risky reload network for resolvconf propagation (#5322) Change-Id: I54d706f7941b4b86c4c6cd45340295577155b884 --- roles/kubernetes/preinstall/handlers/main.yml | 17 +---------------- .../preinstall/tasks/0060-resolvconf.yml | 6 +++--- .../preinstall/tasks/0100-dhclient-hooks.yml | 6 +++--- .../tasks/0110-dhclient-hooks-undo.yml | 4 ++-- 4 files changed, 9 insertions(+), 24 deletions(-) diff --git a/roles/kubernetes/preinstall/handlers/main.yml b/roles/kubernetes/preinstall/handlers/main.yml index 81d13d412..627d3fccb 100644 --- a/roles/kubernetes/preinstall/handlers/main.yml +++ b/roles/kubernetes/preinstall/handlers/main.yml @@ -1,8 +1,7 @@ --- -- name: Preinstall | restart network +- name: Preinstall | propagate resolvconf to k8s components command: /bin/true notify: - - Preinstall | reload network - Preinstall | reload kubelet - Preinstall | kube-controller configured - Preinstall | kube-apiserver configured @@ -12,20 +11,6 @@ - Preinstall | restart kube-apiserver crio/containerd when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"] - # FIXME(bogdando) https://github.com/projectcalico/felix/issues/1185 -- name: Preinstall | reload network - service: - name: >- - {% if ansible_os_family == "RedHat" -%} - network - {%- elif ansible_distribution == "Ubuntu" and ansible_distribution_release == "bionic" -%} - systemd-networkd - {%- elif ansible_os_family == "Debian" -%} - networking - {%- endif %} - state: restarted - when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"] and kube_network_plugin not in ['canal', 'calico'] - - name: Preinstall | update resolvconf for Container Linux by CoreOS command: /bin/true notify: diff --git a/roles/kubernetes/preinstall/tasks/0060-resolvconf.yml b/roles/kubernetes/preinstall/tasks/0060-resolvconf.yml index a57e567fe..38455bbef 100644 --- a/roles/kubernetes/preinstall/tasks/0060-resolvconf.yml +++ b/roles/kubernetes/preinstall/tasks/0060-resolvconf.yml @@ -18,7 +18,7 @@ create: yes backup: yes marker: "# Ansible entries {mark}" - notify: Preinstall | restart network + notify: Preinstall | propagate resolvconf to k8s components - name: Remove search/domain/nameserver options before block replace: @@ -29,7 +29,7 @@ with_nested: - "{{ [resolvconffile, base|default(''), head|default('')] | difference(['']) }}" - [ 'search ', 'nameserver ', 'domain ', 'options ' ] - notify: Preinstall | restart network + notify: Preinstall | propagate resolvconf to k8s components - name: Remove search/domain/nameserver options after block replace: @@ -41,7 +41,7 @@ with_nested: - "{{ [resolvconffile, base|default(''), head|default('')] | difference(['']) }}" - [ 'search ', 'nameserver ', 'domain ', 'options ' ] - notify: Preinstall | restart network + notify: Preinstall | propagate resolvconf to k8s components - name: get temporary resolveconf cloud init file content diff --git a/roles/kubernetes/preinstall/tasks/0100-dhclient-hooks.yml b/roles/kubernetes/preinstall/tasks/0100-dhclient-hooks.yml index 52ffb8b86..6599a21d4 100644 --- a/roles/kubernetes/preinstall/tasks/0100-dhclient-hooks.yml +++ b/roles/kubernetes/preinstall/tasks/0100-dhclient-hooks.yml @@ -11,7 +11,7 @@ insertbefore: BOF backup: yes marker: "# Ansible entries {mark}" - notify: Preinstall | restart network + notify: Preinstall | propagate resolvconf to k8s components when: dhclientconffile is defined - name: Configure dhclient hooks for resolv.conf (non-RH) @@ -20,7 +20,7 @@ dest: "{{ dhclienthookfile }}" owner: root mode: 0755 - notify: Preinstall | restart network + notify: Preinstall | propagate resolvconf to k8s components when: ansible_os_family != "RedHat" - name: Configure dhclient hooks for resolv.conf (RH-only) @@ -29,5 +29,5 @@ dest: "{{ dhclienthookfile }}" owner: root mode: 0755 - notify: Preinstall | restart network + notify: Preinstall | propagate resolvconf to k8s components when: ansible_os_family == "RedHat" diff --git a/roles/kubernetes/preinstall/tasks/0110-dhclient-hooks-undo.yml b/roles/kubernetes/preinstall/tasks/0110-dhclient-hooks-undo.yml index cf935a363..0d38571ee 100644 --- a/roles/kubernetes/preinstall/tasks/0110-dhclient-hooks-undo.yml +++ b/roles/kubernetes/preinstall/tasks/0110-dhclient-hooks-undo.yml @@ -10,11 +10,11 @@ backup: yes marker: "# Ansible entries {mark}" when: dhclientconffile is defined - notify: Preinstall | restart network + notify: Preinstall | propagate resolvconf to k8s components - name: Remove kubespray specific dhclient hook file: path: "{{ dhclienthookfile }}" state: absent when: dhclienthookfile is defined - notify: Preinstall | restart network + notify: Preinstall | propagate resolvconf to k8s components