From 6bf2a80dcd7dfc110098a0dbcb09acafa19e3927 Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Mon, 26 Sep 2016 12:02:19 +0300 Subject: [PATCH] Copy hyperkube CNI plugins when using weave --- roles/network_plugin/weave/tasks/main.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/roles/network_plugin/weave/tasks/main.yml b/roles/network_plugin/weave/tasks/main.yml index eb56d8c9b..25a9837db 100644 --- a/roles/network_plugin/weave/tasks/main.yml +++ b/roles/network_plugin/weave/tasks/main.yml @@ -9,6 +9,26 @@ notify: - restart docker +- name: Weave | Determine hyperkube cni to use depending of the version of kube + set_fact: + use_hyperkube_cni: > + {%- if kube_version | version_compare('v1.3.4','>=') -%} + true + {%- elif kube_version | version_compare('v1.3.4','<') -%} + false + {%- else -%} + {{ ErrorCannotRecognizeVersion }} + {%- endif -%} + +- name: Weave | Copy cni plugins from hyperkube + command: "/usr/bin/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 + until: cni_task_result.rc == 0 + retries: 4 + delay: "{{ retry_stagger | random + 3 }}" + changed_when: false + when: "{{ use_hyperkube_cni|bool }}" + - name: Weave | Install weave command: rsync -piu "{{ local_release_dir }}/weave/bin/weave" "{{ bin_dir }}/weave" changed_when: false