This commit is contained in:
zuoxuesong-worker 2025-12-25 07:49:09 +00:00 committed by GitHub
commit 9a16666210
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 125 additions and 15 deletions

View File

@ -16,4 +16,26 @@
roles:
- download
- copy
- role: download/web-installer
when:
- .download.web_installer.download_web_installer
pre_tasks:
- name: Artifact | Set artifact file dir
when:
- .artifact_file | empty | not
set_fact:
artifact_file_dir: >-
{{ .artifact_file | dir }}/artifact
- name: Artifact | Create artifact dir
when:
- .artifact_file_dir | empty | not
command: >-
mkdir -p {{ .artifact_file_dir }}/kubekey/kubekey/
post_tasks:
- name: Artifact | Export artifact
when:
- .pack_artifact
- .artifact_file_dir | empty | not
command: |
cp kk {{ .artifact_file_dir }}/
cd {{ .artifact_file_dir }} && tar -czvf {{ .artifact_file }} *

View File

@ -1,15 +1,4 @@
---
- name: Copy | Set artifact file dir
when:
- .artifact_file | empty | not
set_fact:
artifact_file_dir: >-
{{ .artifact_file | dir }}/artifact
- name: Copy | Create artifact file dir
command: >-
mkdir -p {{ .artifact_file_dir }}/kubekey/kubekey/
- name: Artifact | Copy required binaries and images
when: .artifact_file_dir | empty | not
block:
@ -23,6 +12,3 @@
tags: ["kubernetes", "image_registry"]
- include_tasks: iso.yaml
- name: Export artifact
command: |
cd {{ .artifact_file_dir }} && tar -czvf {{ .artifact_file }} *

View File

@ -217,6 +217,10 @@ download:
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
web_installer:
download_web_installer: false
url: >-
https://kubekey.pek3b.qingstor.com/github.com/kubesphere/web-installer/releases/latest/download/web-installer.tgz
iso_url:
base_path: >-
{{- if .download.zone | eq "cn" -}}

View File

@ -0,0 +1,26 @@
- hosts:
- kube_control_plane[0]
vars_files:
- vars/kubesphere.yaml
tasks:
- name: Copy KubeSphere Helm package to remote host
copy:
src: ks-core.tgz
dest: /etc/kubesphere/ks-core.tgz
- name: Generate values file from schema
run_once: true
copy:
content: >-
{{ index . "ks-core" | toYaml }}
dest: >-
/etc/kubesphere/value.yaml
- name: Deploy or upgrade KubeSphere using Helm
command: |
helm upgrade --install --wait --create-namespace --namespace kubesphere-system -f /etc/kubesphere/value.yaml \
ks-core /etc/kubesphere/ks-core.tgz --reset-values \
--set telemetry.posthog.storage.type=pvc,telemetry.posthog.storage.pvc.resources.requests.storage=10Gi
- name: Output KubeSphere console access information
result:
address: http://{{ .internal_ipv4 }}:30880
user: admin
password: P@88w0rd

View File

@ -0,0 +1,26 @@
- hosts:
- kube_control_plane[0]
vars_files:
- vars/kubesphere.yaml
tasks:
- name: Copy KubeSphere Helm package to remote host
copy:
src: ks-core.tgz
dest: /etc/kubesphere/ks-core.tgz
- name: Generate values file from schema
run_once: true
copy:
content: >-
{{ index . "ks-core" | toYaml }}
dest: >-
/etc/kubesphere/value.yaml
- name: Deploy or upgrade KubeSphere using Helm
command: |
helm upgrade --install --wait --create-namespace --namespace kubesphere-system -f /etc/kubesphere/value.yaml \
ks-core /etc/kubesphere/ks-core.tgz --reset-values \
--set telemetry.posthog.storage.type=pvc,telemetry.posthog.storage.pvc.resources.requests.storage=10Gi
- name: Output KubeSphere console access information
result:
address: http://{{ .internal_ipv4 }}:30880
user: admin
password: P@88w0rd

View File

@ -0,0 +1,29 @@
---
- name: WebInstaller | Download web installer
when:
- .download.web_installer.download_web_installer
- .download.web_installer.url | empty | not
- .artifact_file_dir | empty | not
command: |
curl -L -o {{ .artifact_file_dir }}/web-installer.tgz {{ .download.web_installer.url }}
tar -xzf "{{ .artifact_file_dir }}/web-installer.tgz" --no-same-owner -C {{ .artifact_file_dir }}
- name: WebInstaller | Set Ks Core
when:
- .download.kse_chart_version | empty | not
block:
- name: WebInstaller | Download ks core chart
command: |
helm pull oci://hub.kubesphere.com.cn/kse/ks-core --version {{ .download.kse_chart_version }} -d {{ .artifact_file_dir }}/kubesphere/playbooks/files/
mv {{ .artifact_file_dir }}/kubesphere/playbooks/files/ks-core-{{ .download.kse_chart_version }}.tgz {{ .artifact_file_dir }}/kubesphere/playbooks/files/ks-core.tgz
- name: WebInstaller | Set ks core install task
copy:
src: "install-{{ .download.kse_chart_version }}.yaml"
dest: "{{ .artifact_file_dir }}/kubesphere/playbooks/install.yaml"
- name: WebInstaller | Init config json
when:
- .artifact_file_dir | empty | not
template:
src: config.json
dest: "{{ .artifact_file_dir }}/schema/config.json"

View File

@ -0,0 +1,17 @@
{
"kubernetes.json": {
"kubernetes": {
"kube_version": "{{ .kubernetes.kube_version }}",
"control_plane_endpoint": {
"host": "lb.kubesphere.local",
"port": 6443,
"type": "local"
}
},
"cri": {
{{- if .cri.container_manager | empty | not }}
"container_manager": "{{ .cri.container_manager }}"
{{- end }}
}
}
}