Skip to content

Commit 7eba91a

Browse files
authored
fix: Change offline package directory. (#2392)
Signed-off-by: joyceliu <[email protected]> Co-authored-by: joyceliu <[email protected]>
1 parent 658023c commit 7eba91a

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

builtin/playbooks/artifact_export.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
when: .image_manifests | default list | len | lt 0
1010
- name: Export artifact
1111
command: |
12-
cd {{ .work_dir }} && tar -czvf kubekey-artifact.tar.gz kubekey/
12+
cd {{ .work_dir }}/kubekey && tar -czvf ../kubekey-artifact.tar.gz *

builtin/roles/init/init-artifact/tasks/download_by_curl.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173

174174
- name: Check binaries for calicoctl
175175
command: |
176-
artifact_name={{ get .artifact.artifact_url.calicoctl .item | splitList "/" | last }}
176+
artifact_name=calicoctl
177177
artifact_path={{ .work_dir }}/kubekey/cni/{{ .calico_version }}/{{ .item }}
178178
if [ ! -f $artifact_path/$artifact_name ]; then
179179
mkdir -p $artifact_path

builtin/roles/init/init-artifact/tasks/main.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
- name: Extract artifact to work_dir
1010
tags: ["always"]
1111
command: |
12-
if [ ! -f "{{ .artifact_file }}" ]; then
13-
tar -zxvf {{ .artifact_file }} -C {{ .work_dir }}
12+
if [ -f "{{ .artifact_file }}" ]; then
13+
mkdir -p {{ .work_dir }}/kubekey
14+
tar -zxvf {{ .artifact_file }} -C {{ .work_dir }}/kubekey
1415
fi
1516
when: and .artifact_file (ne .artifact_file "")
1617

builtin/roles/install/kubernetes/tasks/install_binaries.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,30 @@
6363
dest: /etc/systemd/system/kubelet.service
6464
- name: Register kubelet service
6565
command: systemctl daemon-reload && systemctl enable kubelet.service
66+
67+
- name: Check if calicoctl is installed
68+
ignore_errors: true
69+
command: calicoctl --version
70+
register: calicoctl_install_version
71+
- name: Install calicoctl
72+
when:
73+
- and .calico_version (ne .calico_version "")
74+
- |
75+
or (.calicoctl_install_version.stderr | ne "") (.calicoctl_install_version.stdout | contains (printf "Client Version: %s" .calico_version) | not)
76+
block:
77+
- name: Sync calicoctl to remote
78+
copy:
79+
src: |
80+
{{ .work_dir }}/kubekey/cni/{{ .calico_version }}/{{ .binary_type.stdout }}/calicoctl
81+
dest: /usr/local/bin/calicoctl
82+
mode: 0755
83+
- name: Sync kubelet env to remote
84+
template:
85+
src: kubeadm/kubelet.env
86+
dest: /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
87+
- name: Sync kubelet service to remote
88+
copy:
89+
src: kubelet.service
90+
dest: /etc/systemd/system/kubelet.service
91+
- name: Register kubelet service
92+
command: systemctl daemon-reload && systemctl enable kubelet.service

0 commit comments

Comments
 (0)