Skip to content

Commit a2d45d5

Browse files
feat: add web installer in artifact export func
Signed-off-by: xuesongzuo@yunify.com <xuesongzuo@yunify.com> feat: add web installer in artifact export func Signed-off-by: xuesongzuo@yunify.com <xuesongzuo@yunify.com> feat: add web installer in artifact export func Signed-off-by: xuesongzuo@yunify.com <xuesongzuo@yunify.com> feat: add web installer in artifact export func Signed-off-by: xuesongzuo@yunify.com <xuesongzuo@yunify.com> feat: add web installer in artifact export func Signed-off-by: xuesongzuo@yunify.com <xuesongzuo@yunify.com> feat: add web installer in artifact export func Signed-off-by: xuesongzuo@yunify.com <xuesongzuo@yunify.com> feat: add web installer in artifact export func Signed-off-by: xuesongzuo@yunify.com <xuesongzuo@yunify.com> feat: add web installer in artifact export func Signed-off-by: xuesongzuo@yunify.com <xuesongzuo@yunify.com> feat: add web installer in artifact export func Signed-off-by: xuesongzuo@yunify.com <xuesongzuo@yunify.com> feat: add web installer in artifact export func Signed-off-by: xuesongzuo@yunify.com <xuesongzuo@yunify.com> feat: add web installer in artifact export func Signed-off-by: xuesongzuo@yunify.com <xuesongzuo@yunify.com> feat: add web installer in artifact export func Signed-off-by: xuesongzuo@yunify.com <xuesongzuo@yunify.com> feat: add web installer in artifact export func Signed-off-by: xuesongzuo@yunify.com <xuesongzuo@yunify.com>
1 parent 782575f commit a2d45d5

File tree

7 files changed

+125
-15
lines changed

7 files changed

+125
-15
lines changed

builtin/core/playbooks/artifact_export.yaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,26 @@
1616
roles:
1717
- download
1818
- copy
19-
19+
- role: download/web-installer
20+
when:
21+
- .download.web_installer.download_web_installer
22+
pre_tasks:
23+
- name: Artifact | Set artifact file dir
24+
when:
25+
- .artifact_file | empty | not
26+
set_fact:
27+
artifact_file_dir: >-
28+
{{ .artifact_file | dir }}/artifact
29+
- name: Artifact | Create artifact dir
30+
when:
31+
- .artifact_file_dir | empty | not
32+
command: >-
33+
mkdir -p {{ .artifact_file_dir }}/kubekey/kubekey/
34+
post_tasks:
35+
- name: Artifact | Export artifact
36+
when:
37+
- .pack_artifact
38+
- .artifact_file_dir | empty | not
39+
command: |
40+
cp kk {{ .artifact_file_dir }}/
41+
cd {{ .artifact_file_dir }} && tar -czvf {{ .artifact_file }} *
Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
---
2-
- name: Copy | Set artifact file dir
3-
when:
4-
- .artifact_file | empty | not
5-
set_fact:
6-
artifact_file_dir: >-
7-
{{ .artifact_file | dir }}/artifact
8-
9-
- name: Copy | Create artifact file dir
10-
command: >-
11-
mkdir -p {{ .artifact_file_dir }}/kubekey/kubekey/
12-
132
- name: Artifact | Copy required binaries and images
143
when: .artifact_file_dir | empty | not
154
block:
@@ -23,6 +12,3 @@
2312
tags: ["kubernetes", "image_registry"]
2413
- include_tasks: iso.yaml
2514

26-
- name: Export artifact
27-
command: |
28-
cd {{ .artifact_file_dir }} && tar -czvf {{ .artifact_file }} *

builtin/core/roles/defaults/vars/10-download.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ download:
217217
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
218218
download_image: false
219219
download_iso: false
220+
web_installer:
221+
download_web_installer: false
222+
url: >-
223+
https://kubekey.pek3b.qingstor.com/github.com/kubesphere/web-installer/releases/latest/download/web-installer.tgz
220224
iso_url:
221225
base_path: >-
222226
{{- if .download.zone | eq "cn" -}}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
- hosts:
2+
- kube_control_plane[0]
3+
vars_files:
4+
- vars/kubesphere.yaml
5+
tasks:
6+
- name: Copy KubeSphere Helm package to remote host
7+
copy:
8+
src: ks-core.tgz
9+
dest: /etc/kubesphere/ks-core.tgz
10+
- name: Generate values file from schema
11+
run_once: true
12+
copy:
13+
content: >-
14+
{{ index . "ks-core" | toYaml }}
15+
dest: >-
16+
/etc/kubesphere/value.yaml
17+
- name: Deploy or upgrade KubeSphere using Helm
18+
command: |
19+
helm upgrade --install --wait --create-namespace --namespace kubesphere-system -f /etc/kubesphere/value.yaml \
20+
ks-core /etc/kubesphere/ks-core.tgz --reset-values \
21+
--set telemetry.posthog.storage.type=pvc,telemetry.posthog.storage.pvc.resources.requests.storage=10Gi
22+
- name: Output KubeSphere console access information
23+
result:
24+
address: http://{{ .internal_ipv4 }}:30880
25+
user: admin
26+
password: P@88w0rd
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
- hosts:
2+
- kube_control_plane[0]
3+
vars_files:
4+
- vars/kubesphere.yaml
5+
tasks:
6+
- name: Copy KubeSphere Helm package to remote host
7+
copy:
8+
src: ks-core.tgz
9+
dest: /etc/kubesphere/ks-core.tgz
10+
- name: Generate values file from schema
11+
run_once: true
12+
copy:
13+
content: >-
14+
{{ index . "ks-core" | toYaml }}
15+
dest: >-
16+
/etc/kubesphere/value.yaml
17+
- name: Deploy or upgrade KubeSphere using Helm
18+
command: |
19+
helm upgrade --install --wait --create-namespace --namespace kubesphere-system -f /etc/kubesphere/value.yaml \
20+
ks-core /etc/kubesphere/ks-core.tgz --reset-values \
21+
--set telemetry.posthog.storage.type=pvc,telemetry.posthog.storage.pvc.resources.requests.storage=10Gi
22+
- name: Output KubeSphere console access information
23+
result:
24+
address: http://{{ .internal_ipv4 }}:30880
25+
user: admin
26+
password: P@88w0rd
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
- name: WebInstaller | Download web installer
3+
when:
4+
- .download.web_installer.download_web_installer
5+
- .download.web_installer.url | empty | not
6+
- .artifact_file_dir | empty | not
7+
command: |
8+
curl -L -o {{ .artifact_file_dir }}/web-installer.tgz {{ .download.web_installer.url }}
9+
tar -xzf "{{ .artifact_file_dir }}/web-installer.tgz" --no-same-owner -C {{ .artifact_file_dir }}
10+
11+
- name: WebInstaller | Set Ks Core
12+
when:
13+
- .download.kse_chart_version | empty | not
14+
block:
15+
- name: WebInstaller | Download ks core chart
16+
command: |
17+
helm pull oci://hub.kubesphere.com.cn/kse/ks-core --version {{ .download.kse_chart_version }} -d {{ .artifact_file_dir }}/kubesphere/playbooks/files/
18+
mv {{ .artifact_file_dir }}/kubesphere/playbooks/files/ks-core-{{ .download.kse_chart_version }}.tgz {{ .artifact_file_dir }}/kubesphere/playbooks/files/ks-core.tgz
19+
- name: WebInstaller | Set ks core install task
20+
copy:
21+
src: "install-{{ .download.kse_chart_version }}.yaml"
22+
dest: "{{ .artifact_file_dir }}/kubesphere/playbooks/install.yaml"
23+
24+
- name: WebInstaller | Init config json
25+
when:
26+
- .artifact_file_dir | empty | not
27+
template:
28+
src: config.json
29+
dest: "{{ .artifact_file_dir }}/schema/config.json"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"kubernetes.json": {
3+
"kubernetes": {
4+
"kube_version": "{{ .kubernetes.kube_version }}",
5+
"control_plane_endpoint": {
6+
"host": "lb.kubesphere.local",
7+
"port": 6443,
8+
"type": "local"
9+
}
10+
},
11+
"cri": {
12+
{{- if .cri.container_manager | empty | not }}
13+
"container_manager": "{{ .cri.container_manager }}"
14+
{{- end }}
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)