Download etcd and hyperkube binary.

pull/3061/head
Takashi Okamoto 2018-07-30 18:55:25 +09:00
parent bdbfa4d403
commit 359009bb05
5 changed files with 67 additions and 40 deletions

View File

@ -48,8 +48,12 @@ cilium_version: "v1.2.0"
# 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"
vault_download_url: "https://releases.hashicorp.com/vault/{{ vault_version }}/vault_{{ vault_version }}_linux_{{ image_arch }}.zip" vault_download_url: "https://releases.hashicorp.com/vault/{{ vault_version }}/vault_{{ vault_version }}_linux_{{ image_arch }}.zip"
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"
# Checksums # Checksums
etcd_checksum: b729db0732448064271ea6fdcb901773c4fe917763ca07776f22d0e5e0bd4097
hyperkube_checksum: d727f8cae3fc26b1add9b4ff0d4d9b99605544ff7fb3baeecdca394362adbfb8
kubeadm_checksum: 6b17720a65b8ff46efe92a5544f149c39a221910d89939838d75581d4e6924c0 kubeadm_checksum: 6b17720a65b8ff46efe92a5544f149c39a221910d89939838d75581d4e6924c0
vault_binary_checksum: 3c4d70ba71619a43229e65c67830e30e050eab7a81ac6b28325ff707e5914188 vault_binary_checksum: 3c4d70ba71619a43229e65c67830e30e050eab7a81ac6b28325ff707e5914188
@ -173,6 +177,19 @@ downloads:
sha256: "{{ etcd_digest_checksum|default(None) }}" sha256: "{{ etcd_digest_checksum|default(None) }}"
groups: groups:
- etcd - etcd
etcd_file:
enabled: true
file: true
version: "{{ etcd_version }}"
dest: "etcd-{{ etcd_version }}-linux-amd64.tar.gz"
sha256: "{{ etcd_checksum }}"
source_url: "{{ etcd_download_url }}"
url: "{{ etcd_download_url }}"
unarchive: true
owner: "root"
mode: "0755"
groups:
- etcd
kubeadm: kubeadm:
enabled: "{{ kubeadm_enabled }}" enabled: "{{ kubeadm_enabled }}"
file: true file: true
@ -194,6 +211,19 @@ downloads:
sha256: "{{ hyperkube_digest_checksum|default(None) }}" sha256: "{{ hyperkube_digest_checksum|default(None) }}"
groups: groups:
- k8s-cluster - k8s-cluster
hyperkube_file:
enabled: true
file: true
version: "{{ kube_version }}"
dest: "hyperkube"
sha256: "{{ hyperkube_checksum }}"
source_url: "{{ hyperkube_download_url }}"
url: "{{ hyperkube_download_url }}"
unarchive: false
owner: "root"
mode: "0755"
groups:
- k8s-cluster
cilium: cilium:
enabled: "{{ kube_network_plugin == 'cilium' }}" enabled: "{{ kube_network_plugin == 'cilium' }}"
container: true container: true

View File

@ -11,6 +11,7 @@
when: when:
- not skip_downloads|default(false) - not skip_downloads|default(false)
- item.value.enabled - item.value.enabled
- not item.value.container | item.value.container and download_container
- name: "Sync container" - name: "Sync container"
include_tasks: sync_container.yml include_tasks: sync_container.yml

View File

@ -1,13 +1,21 @@
--- ---
- name: Install | Copy etcdctl and etcd binary from docker container - name: install | Copy etcd binary from download dir
command: sh -c "{{ docker_bin_dir }}/docker rm -f etcdctl-binarycopy; shell: |
{{ docker_bin_dir }}/docker create --name etcdctl-binarycopy {{ etcd_image_repo }}:{{ etcd_image_tag }} && rsync -piu "{{ local_release_dir }}/etcd-{{ etcd_version }}-linux-amd64/etcd" "{{ bin_dir }}/etcd"
{{ docker_bin_dir }}/docker cp etcdctl-binarycopy:/usr/local/bin/etcdctl {{ bin_dir }}/etcdctl && rsync -piu "{{ local_release_dir }}/etcd-{{ etcd_version }}-linux-amd64/etcdctl" "{{ bin_dir }}/etcdctl"
{{ docker_bin_dir }}/docker cp etcdctl-binarycopy:/usr/local/bin/etcd {{ bin_dir }}/etcd &&
{{ docker_bin_dir }}/docker rm -f etcdctl-binarycopy"
register: etcd_task_result
until: etcd_task_result.rc == 0
retries: 4
delay: "{{ retry_stagger | random + 3 }}"
changed_when: false changed_when: false
when: etcd_cluster_setup when: etcd_cluster_setup
- name: install | Set etcd binary permissions
file:
path: "{{ bin_dir }}/etcd"
mode: "0755"
state: file
when: etcd_cluster_setup
- name: install | Set etcdctl binary permissions
file:
path: "{{ bin_dir }}/etcdctl"
mode: "0755"
state: file
when: etcd_cluster_setup

View File

@ -9,27 +9,19 @@
- import_tasks: encrypt-at-rest.yml - import_tasks: encrypt-at-rest.yml
when: kube_encrypt_secret_data when: kube_encrypt_secret_data
- name: Compare host kubectl with hyperkube container - name: install | Copy kubectl binary from download dir
command: "{{ docker_bin_dir }}/docker run --rm -v {{ bin_dir }}:/systembindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /usr/bin/cmp /hyperkube /systembindir/kubectl" command: rsync -piu "{{ local_release_dir }}/hyperkube" "{{ bin_dir }}/kubectl"
register: kubectl_task_compare_result
until: kubectl_task_compare_result.rc in [0,1,2]
retries: 4
delay: "{{ retry_stagger | random + 3 }}"
changed_when: false changed_when: false
failed_when: "kubectl_task_compare_result.rc not in [0,1,2]"
tags: tags:
- hyperkube - hyperkube
- kubectl - kubectl
- upgrade - upgrade
- name: Copy kubectl from hyperkube container - name: install | Set kubectl binary permissions
command: "{{ docker_bin_dir }}/docker run --rm -v {{ bin_dir }}:/systembindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/cp -f /hyperkube /systembindir/kubectl" file:
when: kubectl_task_compare_result.rc != 0 path: "{{ bin_dir }}/kubectl"
register: kubectl_task_result mode: "0755"
until: kubectl_task_result.rc == 0 state: file
retries: 4
delay: "{{ retry_stagger | random + 3 }}"
changed_when: false
tags: tags:
- hyperkube - hyperkube
- kubectl - kubectl
@ -37,7 +29,7 @@
- name: Install kubectl bash completion - name: Install kubectl bash completion
shell: "{{ bin_dir }}/kubectl completion bash >/etc/bash_completion.d/kubectl.sh" shell: "{{ bin_dir }}/kubectl completion bash >/etc/bash_completion.d/kubectl.sh"
when: kubectl_task_compare_result.rc != 0 and ansible_os_family in ["Debian","RedHat"] when: ansible_os_family in ["Debian","RedHat"]
tags: tags:
- kubectl - kubectl

View File

@ -1,23 +1,19 @@
--- ---
- name: install | Compare host kubelet with hyperkube container
command: "{{ docker_bin_dir }}/docker run --rm -v {{ bin_dir }}:/systembindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /usr/bin/cmp /hyperkube /systembindir/kubelet" - name: install | Copy kubelet binary from download dir
register: kubelet_task_compare_result command: rsync -piu "{{ local_release_dir }}/hyperkube" "{{ bin_dir }}/kubelet"
until: kubelet_task_compare_result.rc in [0,1,2]
retries: 4
delay: "{{ retry_stagger | random + 3 }}"
changed_when: false changed_when: false
failed_when: "kubelet_task_compare_result.rc not in [0,1,2]" when: hyperkube_enabled
tags: tags:
- hyperkube - hyperkube
- upgrade - upgrade
- name: install | Copy kubelet from hyperkube container - name: install | Set kubelet binary permissions
command: "{{ docker_bin_dir }}/docker run --rm -v {{ bin_dir }}:/systembindir {{ hyperkube_image_repo }}:{{ hyperkube_image_tag }} /bin/cp -f /hyperkube /systembindir/kubelet" file:
when: kubelet_task_compare_result.rc != 0 path: "{{ bin_dir }}/kubelet"
register: kubelet_task_result mode: "0755"
until: kubelet_task_result.rc == 0 state: file
retries: 4 when: hyperkube_enabled
delay: "{{ retry_stagger | random + 3 }}"
tags: tags:
- hyperkube - hyperkube
- upgrade - upgrade