diff options
author | Di Xu <di.xu@arm.com> | 2018-01-04 18:21:20 +0800 |
---|---|---|
committer | Di Xu <di.xu@arm.com> | 2018-02-13 16:34:50 +0800 |
commit | 098208121bba3ef6d576976c2e975c56f89ae901 (patch) | |
tree | d89ab21e9b44cd9c9fadb64649cd7f9c114d125b /deploy/adapters/ansible/kubernetes/roles/2flannel/handlers | |
parent | 5dd3af7fd00971a96d91397f9754e6455abb660d (diff) |
add a multus with 2 fannel interfaces installation
Support deploying multus multiple flannel CNI plugins by setting
environment "kube_network_plugin" to "2flannel".
Change-Id: I23a3d42452b4a5e0858a18934f508649f5961e7a
Signed-off-by: Di Xu <di.xu@arm.com>
Diffstat (limited to 'deploy/adapters/ansible/kubernetes/roles/2flannel/handlers')
-rw-r--r-- | deploy/adapters/ansible/kubernetes/roles/2flannel/handlers/main.yml | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/deploy/adapters/ansible/kubernetes/roles/2flannel/handlers/main.yml b/deploy/adapters/ansible/kubernetes/roles/2flannel/handlers/main.yml new file mode 100644 index 00000000..44ead00e --- /dev/null +++ b/deploy/adapters/ansible/kubernetes/roles/2flannel/handlers/main.yml @@ -0,0 +1,61 @@ +--- +- name: 2Flannel | delete default docker bridge + command: ip link delete docker0 + failed_when: false + notify: 2Flannel | restart docker + +- name: 2Flannel | delete 2flannel interface + command: ip link delete flannel0 && ip link delete flannel1 + failed_when: false + +# special cases for atomic because it defaults to live-restore: true +# So we disable live-restore to pickup the new flannel IP. After +# we enable it, we have to restart docker again to pickup the new +# setting and restore the original behavior +- name: 2Flannel | restart docker + command: /bin/true + notify: + - 2Flannel | reload systemd + - 2Flannel | reload docker.socket + - 2Flannel | configure docker live-restore true (atomic) + - 2Flannel | reload docker + - 2Flannel | pause while Docker restarts + - 2Flannel | wait for docker + +- name: 2Flannel | reload systemd + shell: systemctl daemon-reload + +- name: 2Flannel | reload docker.socket + service: + name: docker.socket + state: restarted + when: ansible_os_family in ['CoreOS', 'Container Linux by CoreOS'] + +- name: 2Flannel | configure docker live-restore true (atomic) + replace: + name: /etc/docker/daemon.json + regexp: '"live-restore":.*true' + replace: '"live-restore": false' + when: is_atomic + +- name: 2Flannel | reload docker + service: + name: docker + state: restarted + +- name: 2Flannel | pause while Docker restarts + pause: + seconds: 10 + prompt: "Waiting for docker restart" + +- name: 2Flannel | wait for docker + command: "{{ docker_bin_dir }}/docker images" + register: docker_ready + retries: 10 + delay: 5 + until: docker_ready.rc == 0 + +- name: 2Flannel | reload kubelet + service: + name: kubelet + state: restarted |