feat: add iso download task (#2827)

feat: add iso download task



feat: add iso download and install task



feat: add iso download

Signed-off-by: xuesongzuo@yunify.com <xuesongzuo@yunify.com>
This commit is contained in:
zuoxuesong-worker 2025-10-28 10:12:09 +08:00 committed by GitHub
parent 6d6cad84a8
commit f204389956
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 57 additions and 3 deletions

View File

@ -224,3 +224,30 @@ download:
hybridnet: https://github.com/alibaba/hybridnet/releases/download/helm-chart-{{ .cni.hybridnet_version }}/hybridnet-{{ .cni.hybridnet_version }}.tgz
nfs_provisioner: https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/releases/download/nfs-subdir-external-provisioner-4.0.18/nfs-subdir-external-provisioner-{{ .storage_class.nfs_provisioner_version }}.tgz
download_image: false
download_iso: false
iso_url:
base_path: >-
{{- if .download.zone | eq "cn" -}}
https://kubekey.pek3b.qingstor.com
{{- else -}}
https://github.com
{{- end -}}
urls:
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/almalinux-9.0-rpms-amd64.iso"
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/almalinux-9.0-rpms-arm64.iso"
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/centos-8-rpms-amd64.iso"
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/centos-8-rpms-arm64.iso"
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/debian-10-debs-amd64.iso"
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/debian-10-debs-arm64.iso"
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/debian-11-debs-amd64.iso"
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/debian-11-debs-arm64.iso"
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/kylin-v10SP3-rpms-amd64.iso"
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/kylin-v10SP3-rpms-arm64.iso"
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/ubuntu-18.04-debs-amd64.iso"
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/ubuntu-18.04-debs-arm64.iso"
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/ubuntu-20.04-debs-amd64.iso"
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/ubuntu-20.04-debs-arm64.iso"
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/ubuntu-22.04-debs-amd64.iso"
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/ubuntu-22.04-debs-arm64.iso"
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/ubuntu-24.04-debs-amd64.iso"
- "{{ .download.iso_url.base_path }}/kubesphere/kubekey/releases/download/ISO-20250915/ubuntu-24.04-debs-arm64.iso"

View File

@ -0,0 +1,12 @@
---
- name: ISO | Download ISO files
when: .download.iso_url.urls | empty | not
loop: "{{ .download.iso_url.urls | toJson }}"
command: |
iso_path={{ .binary_dir }}/repository/{{ .item | splitList "/" | last }}
if [ ! -f {{ .binary_dir }}/repository/ ];then
mkdir -p {{ .binary_dir }}/repository/
fi
if [ ! -f $iso_path ]; then
curl -L -o $iso_path {{ .item }}
fi

View File

@ -20,6 +20,11 @@
- include_tasks: images.yaml
tags: ["kubernetes", "image_registry"]
- name: Artifact | Download iso file
when: .download.download_iso
block:
- include_tasks: iso.yaml
- name: Artifact | Set ownership of working directory to sudo user
tags: ["always"]
ignore_errors: true

View File

@ -41,7 +41,7 @@
when:
- .iso_name | empty
set_fact:
iso_name: "{{ .system_string | unquote | trim | lower }}-{{ .iso_type | trim }}-{{ .binary_type }}.iso"
iso_name: "{{ .system_string | replace \"\\\"\" \"\" | unquote | trim | lower }}-{{ .iso_type | trim }}-{{ .binary_type }}.iso"
- name: Repository | Copy local repository ISO file
ignore_errors: true

View File

@ -165,10 +165,20 @@ func (o *ArtifactImagesOptions) Complete(cmd *cobra.Command, args []string) (*kk
}
func setDefaultDownload(set []string) []string {
var changeDownloadImage, changeDownloadISO = true, true
for _, s := range set {
if strings.Contains(s, "download.download_image=") {
return set
changeDownloadImage = false
}
if strings.Contains(s, "download.download_iso=") {
changeDownloadISO = false
}
}
return append(set, "download.download_image=true")
if changeDownloadImage {
set = append(set, "download.download_image=true")
}
if changeDownloadISO {
set = append(set, "download.download_iso=true")
}
return set
}