From 97c14ec8b7aede79f3fffbb6299144dbf5c7e88e Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Tue, 13 Sep 2016 14:36:01 +0200 Subject: [PATCH] Add retries for copying binaries from containers Closes issue: https://github.com/kubespray/kargo/issues/479 Signed-off-by: Bogdan Dobrelya --- roles/etcd/tasks/install.yml | 4 ++++ roles/kubernetes/master/tasks/main.yml | 5 ++++- roles/network_plugin/calico/tasks/main.yml | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/roles/etcd/tasks/install.yml b/roles/etcd/tasks/install.yml index 26271943a..959133c29 100644 --- a/roles/etcd/tasks/install.yml +++ b/roles/etcd/tasks/install.yml @@ -17,6 +17,10 @@ /usr/bin/docker cp etcdctl-binarycopy:{{ etcd_container_bin_dir }}etcdctl {{ bin_dir }}/etcdctl && /usr/bin/docker rm -f etcdctl-binarycopy" when: etcd_deployment_type == "docker" + register: etcd_task_result + until: etcd_task_result.rc == 0 + retries: 4 + delay: "{{ 20 | random + 3 }}" changed_when: false #Plan B: looks nicer, but requires docker-py on all hosts: diff --git a/roles/kubernetes/master/tasks/main.yml b/roles/kubernetes/master/tasks/main.yml index 4d0933550..e8dfe08fc 100644 --- a/roles/kubernetes/master/tasks/main.yml +++ b/roles/kubernetes/master/tasks/main.yml @@ -9,8 +9,11 @@ - name: Copy kubectl from hyperkube container command: "/usr/bin/docker run --rm -v {{ bin_dir }}:/systembindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/cp /hyperkube /systembindir/kubectl" + register: kube_task_result + until: kube_task_result.rc == 0 + retries: 4 + delay: "{{ 20 | random + 3 }}" changed_when: false - register: kubectl_launcher - name: Write kube-apiserver manifest template: diff --git a/roles/network_plugin/calico/tasks/main.yml b/roles/network_plugin/calico/tasks/main.yml index abe0f690d..09c3b47d5 100644 --- a/roles/network_plugin/calico/tasks/main.yml +++ b/roles/network_plugin/calico/tasks/main.yml @@ -34,6 +34,10 @@ - name: Calico | 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: "{{ 20 | random + 3 }}" changed_when: false when: use_hyperkube_cni