fix: Change offline package directory. (#2392)

Signed-off-by: joyceliu <joyceliu@yunify.com>
Co-authored-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
liujian 2024-09-05 12:24:10 +08:00 committed by GitHub
parent 658023cc8c
commit 7eba91a70e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 32 additions and 4 deletions

View File

@ -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 *

View File

@ -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

View File

@ -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 "")

View File

@ -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