Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion builtin/playbooks/artifact_export.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
when: .image_manifests | default list | len | lt 0
- name: Export artifact
command: |
cd {{ .work_dir }} && tar -czvf kubekey-artifact.tar.gz kubekey/
cd {{ .work_dir }}/kubekey && tar -czvf ../kubekey-artifact.tar.gz *
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@

- name: Check binaries for calicoctl
command: |
artifact_name={{ get .artifact.artifact_url.calicoctl .item | splitList "/" | last }}
artifact_name=calicoctl
artifact_path={{ .work_dir }}/kubekey/cni/{{ .calico_version }}/{{ .item }}
if [ ! -f $artifact_path/$artifact_name ]; then
mkdir -p $artifact_path
Expand Down
5 changes: 3 additions & 2 deletions builtin/roles/init/init-artifact/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
- name: Extract artifact to work_dir
tags: ["always"]
command: |
if [ ! -f "{{ .artifact_file }}" ]; then
tar -zxvf {{ .artifact_file }} -C {{ .work_dir }}
if [ -f "{{ .artifact_file }}" ]; then
mkdir -p {{ .work_dir }}/kubekey
tar -zxvf {{ .artifact_file }} -C {{ .work_dir }}/kubekey
fi
when: and .artifact_file (ne .artifact_file "")

Expand Down
27 changes: 27 additions & 0 deletions builtin/roles/install/kubernetes/tasks/install_binaries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,30 @@
dest: /etc/systemd/system/kubelet.service
- name: Register kubelet service
command: systemctl daemon-reload && systemctl enable kubelet.service

- name: Check if calicoctl is installed
ignore_errors: true
command: calicoctl --version
register: calicoctl_install_version
- name: Install calicoctl
when:
- and .calico_version (ne .calico_version "")
- |
or (.calicoctl_install_version.stderr | ne "") (.calicoctl_install_version.stdout | contains (printf "Client Version: %s" .calico_version) | not)
block:
- name: Sync calicoctl to remote
copy:
src: |
{{ .work_dir }}/kubekey/cni/{{ .calico_version }}/{{ .binary_type.stdout }}/calicoctl
dest: /usr/local/bin/calicoctl
mode: 0755
- name: Sync kubelet env to remote
template:
src: kubeadm/kubelet.env
dest: /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
- name: Sync kubelet service to remote
copy:
src: kubelet.service
dest: /etc/systemd/system/kubelet.service
- name: Register kubelet service
command: systemctl daemon-reload && systemctl enable kubelet.service
Loading