diff --git a/roles/kubernetes-apps/network_plugin/weave/tasks/main.yml b/roles/kubernetes-apps/network_plugin/weave/tasks/main.yml index f900e8b09..1c216fd92 100644 --- a/roles/kubernetes-apps/network_plugin/weave/tasks/main.yml +++ b/roles/kubernetes-apps/network_plugin/weave/tasks/main.yml @@ -30,8 +30,8 @@ return_content: yes run_once: true register: weave_status - retries: 10 - delay: "{{ retry_stagger | random + 3 }}" + retries: 12 + delay: 10 until: "{{ weave_status.status == 200 and 'Status: ready' in weave_status.content }}" delegate_to: "{{groups['kube-master'][0]}}" diff --git a/roles/network_plugin/weave/tasks/main.yml b/roles/network_plugin/weave/tasks/main.yml index 5edb837bb..a956b9481 100644 --- a/roles/network_plugin/weave/tasks/main.yml +++ b/roles/network_plugin/weave/tasks/main.yml @@ -1,4 +1,6 @@ --- +- include: pre-upgrade.yml + - name: Weave | Copy cni plugins from hyperkube command: "{{ docker_bin_dir }}/docker run --rm -v /opt/cni/bin:/cnibindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/cp -r /opt/cni/bin/. /cnibindir/" register: cni_task_result diff --git a/roles/network_plugin/weave/tasks/pre-upgrade.yml b/roles/network_plugin/weave/tasks/pre-upgrade.yml new file mode 100644 index 000000000..42a031f45 --- /dev/null +++ b/roles/network_plugin/weave/tasks/pre-upgrade.yml @@ -0,0 +1,39 @@ +- name: Weave pre-upgrade | Stop legacy weave + command: weave stop + failed_when: false + +- name: Weave pre-upgrade | Stop legacy systemd weave services + service: + name: "{{ item }}" + enabled: no + state: stopped + with_items: + - weaveexpose + - weaveproxy + - weave + failed_when: false + +- name: Weave pre-upgrade | Purge legacy systemd weave systemd unit files + file: + path: "{{ item }}" + state: absent + register: purged_weave_systemd_units + with_items: + - "/etc/systemd/system/weaveexpose.service" + - "/etc/systemd/system/weaveproxy.service" + - "/etc/systemd/system/weave.service" + +- name: Weave pre-upgrade | Reload systemd + command: systemctl daemon-reload + when: ansible_service_mgr == "systemd" and purged_weave_systemd_units.changed + +- name: Weave pre-upgrade | Purge legacy weave configs and binary + file: + path: "{{ item }}" + state: absent + with_items: + - "{{ bin_dir }}/weave" + - "/etc/weave.env" + +- name: Weave pre-upgrade | Purge legacy weave docker containers + shell: "docker ps -af 'name=^/weave.*' -q | xargs --no-run-if-empty docker rm -f" diff --git a/roles/network_plugin/weave/templates/weave-net.yml.j2 b/roles/network_plugin/weave/templates/weave-net.yml.j2 index 38f23c359..93b95346d 100644 --- a/roles/network_plugin/weave/templates/weave-net.yml.j2 +++ b/roles/network_plugin/weave/templates/weave-net.yml.j2 @@ -54,7 +54,7 @@ spec: value: {{ weave_expose_ip }} {% endif %} livenessProbe: - initialDelaySeconds: 30 + initialDelaySeconds: 60 httpGet: host: 127.0.0.1 path: /status