Use download binary instead of copying from the container (#3786)

This commit is contained in:
Rong Zhang 2018-12-03 18:22:17 +08:00 committed by Kubernetes Prow Robot
parent ffcea384a6
commit e0781483fa
8 changed files with 97 additions and 67 deletions

View file

@ -53,6 +53,8 @@ calico_rr_version: "v0.6.1"
flannel_version: "v0.10.0" flannel_version: "v0.10.0"
flannel_cni_version: "v0.3.0" flannel_cni_version: "v0.3.0"
cni_version: "v0.6.0"
weave_version: 2.5.0 weave_version: 2.5.0
pod_infra_version: 3.1 pod_infra_version: 3.1
contiv_version: 1.2.1 contiv_version: 1.2.1
@ -62,8 +64,9 @@ multus_version: "v3.1.autoconf"
# Download URLs # Download URLs
kubeadm_download_url: "https://storage.googleapis.com/kubernetes-release/release/{{ kubeadm_version }}/bin/linux/{{ image_arch }}/kubeadm" kubeadm_download_url: "https://storage.googleapis.com/kubernetes-release/release/{{ kubeadm_version }}/bin/linux/{{ image_arch }}/kubeadm"
etcd_download_url: "https://github.com/coreos/etcd/releases/download/{{ etcd_version }}/etcd-{{ etcd_version }}-linux-amd64.tar.gz"
hyperkube_download_url: "https://storage.googleapis.com/kubernetes-release/release/{{ kube_version }}/bin/linux/amd64/hyperkube" hyperkube_download_url: "https://storage.googleapis.com/kubernetes-release/release/{{ kube_version }}/bin/linux/amd64/hyperkube"
etcd_download_url: "https://github.com/coreos/etcd/releases/download/{{ etcd_version }}/etcd-{{ etcd_version }}-linux-amd64.tar.gz"
cni_download_url: "https://github.com/containernetworking/plugins/releases/download/{{ cni_version }}/cni-plugins-{{ image_arch }}-{{ cni_version }}.tgz"
# Checksums # Checksums
hyperkube_checksums: hyperkube_checksums:
@ -104,6 +107,7 @@ kubeadm_checksums:
v1.10.0: ebbac985834289037b544523c3e2f39bb44bea938aca9d9e88ef7e880fb8472f v1.10.0: ebbac985834289037b544523c3e2f39bb44bea938aca9d9e88ef7e880fb8472f
etcd_binary_checksum: 947849dbcfa13927c81236fb76a7c01d587bbab42ab1e807184cd91b026ebed7 etcd_binary_checksum: 947849dbcfa13927c81236fb76a7c01d587bbab42ab1e807184cd91b026ebed7
cni_binary_checksum: f04339a21b8edf76d415e7f17b620e63b8f37a76b2f706671587ab6464411f2d
hyperkube_binary_checksum: "{{ hyperkube_checksums[kube_version] }}" hyperkube_binary_checksum: "{{ hyperkube_checksums[kube_version] }}"
kubeadm_binary_checksum: "{{ kubeadm_checksums[kubeadm_version] }}" kubeadm_binary_checksum: "{{ kubeadm_checksums[kubeadm_version] }}"
@ -251,6 +255,19 @@ downloads:
groups: groups:
- etcd - etcd
cni:
enabled: true
file: true
version: "{{ cni_version }}"
dest: "{{local_release_dir}}/cni-plugins-{{ image_arch }}-{{ cni_version }}.tgz"
sha256: "{{ cni_binary_checksum }}"
url: "{{ cni_download_url }}"
unarchive: false
owner: "root"
mode: "0755"
groups:
- k8s-cluster
kubeadm: kubeadm:
enabled: "{{ kubeadm_enabled }}" enabled: "{{ kubeadm_enabled }}"
file: true file: true

View file

@ -33,16 +33,20 @@
group: root group: root
changed_when: false changed_when: false
- name: Calico | Copy cni plugins from hyperkube - name: Calico | Set cni directory permissions
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/" file:
register: cni_task_result path: /opt/cni/bin
until: cni_task_result.rc == 0 state: directory
retries: 4 owner: kube
delay: "{{ retry_stagger | random + 3 }}" recurse: true
changed_when: false mode: 0755
tags:
- hyperkube - name: Calico | Copy cni plugins
- upgrade unarchive:
src: "{{ local_release_dir }}/cni-plugins-{{ image_arch }}-{{ cni_version }}.tgz"
dest: "/opt/cni/bin"
mode: 0755
remote_src: yes
- name: Calico | Copy cni plugins from calico/cni container - name: Calico | Copy cni plugins from calico/cni container
command: "{{ docker_bin_dir }}/docker run --rm -v /opt/cni/bin:/cnibindir {{ calico_cni_image_repo }}:{{ calico_cni_image_tag }} sh -c 'cp /opt/cni/bin/* /cnibindir/'" command: "{{ docker_bin_dir }}/docker run --rm -v /opt/cni/bin:/cnibindir {{ calico_cni_image_repo }}:{{ calico_cni_image_tag }} sh -c 'cp /opt/cni/bin/* /cnibindir/'"
@ -57,14 +61,6 @@
- hyperkube - hyperkube
- upgrade - upgrade
- name: Calico | Set cni directory permissions
file:
path: /opt/cni/bin
state: directory
owner: kube
recurse: true
mode: 0755
- name: Calico | wait for etcd - name: Calico | wait for etcd
uri: uri:
url: "{{ etcd_access_addresses.split(',') | first }}/health" url: "{{ etcd_access_addresses.split(',') | first }}/health"

View file

@ -54,16 +54,20 @@
when: when:
- inventory_hostname in groups['kube-master'] - inventory_hostname in groups['kube-master']
- name: Canal | Copy cni plugins from hyperkube - name: Canal | Set cni directory permissions
command: "{{ docker_bin_dir }}/docker run --rm -v /opt/cni/bin:/cnibindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/cp -rf /opt/cni/bin/. /cnibindir/" file:
register: cni_task_result path: /opt/cni/bin
until: cni_task_result.rc == 0 state: directory
retries: 4 owner: kube
delay: "{{ retry_stagger | random + 3 }}" recurse: true
changed_when: false mode: 0755
tags:
- hyperkube - name: Canal | Copy cni plugins
- upgrade unarchive:
src: "{{ local_release_dir }}/cni-plugins-{{ image_arch }}-{{ cni_version }}.tgz"
dest: "/opt/cni/bin"
mode: 0755
remote_src: yes
- name: Canal | Copy cni plugins from calico/cni - name: Canal | Copy cni plugins from calico/cni
command: "{{ docker_bin_dir }}/docker run --rm -v /opt/cni/bin:/cnibindir {{ calico_cni_image_repo }}:{{ calico_cni_image_tag }} sh -c 'cp /opt/cni/bin/* /cnibindir/'" command: "{{ docker_bin_dir }}/docker run --rm -v /opt/cni/bin:/cnibindir {{ calico_cni_image_repo }}:{{ calico_cni_image_tag }} sh -c 'cp /opt/cni/bin/* /cnibindir/'"

View file

@ -1,12 +1,4 @@
--- ---
- name: Cloud | 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 -rf /opt/cni/bin/. /cnibindir/"
register: cni_task_result
until: cni_task_result.rc == 0
retries: 4
delay: "{{ retry_stagger | random + 3 }}"
changed_when: false
- name: Cloud | Set cni directory permissions - name: Cloud | Set cni directory permissions
file: file:
path: /opt/cni/bin path: /opt/cni/bin
@ -14,3 +6,10 @@
owner: kube owner: kube
recurse: true recurse: true
mode: "u=rwX,g-rwx,o-rwx" mode: "u=rwX,g-rwx,o-rwx"
- name: Canal | Copy cni plugins
unarchive:
src: "{{ local_release_dir }}/cni-plugins-{{ image_arch }}-{{ cni_version }}.tgz"
dest: "/opt/cni/bin"
mode: 0755
remote_src: yes

View file

@ -143,14 +143,20 @@
- contiv_enable_api_proxy - contiv_enable_api_proxy
- contiv_generate_certificate - contiv_generate_certificate
- name: Contiv | Copy cni plugins from hyperkube - name: Contiv | Set cni directory permissions
command: "{{ docker_bin_dir }}/docker run --rm -v /opt/cni/bin:/cnibindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/bash -c '/bin/cp -fa /opt/cni/bin/* /cnibindir/'" file:
register: cni_task_result path: /opt/cni/bin
until: cni_task_result.rc == 0 state: directory
retries: 4 owner: kube
delay: "{{ retry_stagger | random + 3 }}" recurse: true
changed_when: false mode: 0755
tags: [hyperkube, upgrade]
- name: Contiv | Copy cni plugins
unarchive:
src: "{{ local_release_dir }}/cni-plugins-{{ image_arch }}-{{ cni_version }}.tgz"
dest: "/opt/cni/bin"
mode: 0755
remote_src: yes
- name: Contiv | Copy netctl binary from docker container - name: Contiv | Copy netctl binary from docker container
command: sh -c "{{ docker_bin_dir }}/docker rm -f netctl-binarycopy; command: sh -c "{{ docker_bin_dir }}/docker rm -f netctl-binarycopy;

View file

@ -3,16 +3,20 @@
include: annotate.yml include: annotate.yml
tags: annotate tags: annotate
- name: kube-router | Copy cni plugins from hyperkube - name: kube-roter | Set cni directory permissions
command: "{{ docker_bin_dir }}/docker run --rm -v /opt/cni/bin:/cnibindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/cp -prf /opt/cni/bin/. /cnibindir/" file:
register: cni_task_result path: /opt/cni/bin
until: cni_task_result.rc == 0 state: directory
retries: 4 owner: kube
delay: "{{ retry_stagger | random + 3 }}" recurse: true
changed_when: false mode: 0755
tags:
- hyperkube - name: kube-router | Copy cni plugins
- upgrade unarchive:
src: "{{ local_release_dir }}/cni-plugins-{{ image_arch }}-{{ cni_version }}.tgz"
dest: "/opt/cni/bin"
mode: 0755
remote_src: yes
- name: kube-router | Create manifest - name: kube-router | Create manifest
template: template:

View file

@ -1,15 +1,19 @@
--- ---
- name: Weave | Copy cni plugins from hyperkube - name: Weave | Set cni directory permissions
command: "{{ docker_bin_dir }}/docker run --rm -v /opt/cni/bin:/cnibindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/cp -rf /opt/cni/bin/. /cnibindir/" file:
register: cni_task_result path: /opt/cni/bin
until: cni_task_result.rc == 0 state: directory
retries: 4 owner: kube
delay: "{{ retry_stagger | random + 3 }}" recurse: true
changed_when: false mode: 0755
tags:
- hyperkube - name: Weave | Copy cni plugins
- upgrade unarchive:
src: "{{ local_release_dir }}/cni-plugins-{{ image_arch }}-{{ cni_version }}.tgz"
dest: "/opt/cni/bin"
mode: 0755
remote_src: yes
- name: Weave | Create manifest - name: Weave | Create manifest
template: template: