-
Notifications
You must be signed in to change notification settings - Fork 817
feat: add web installer in artifact export func #2905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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/ | ||
|
Comment on lines
+32
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| post_tasks: | ||
| - name: Artifact | Export artifact | ||
| when: | ||
| - .pack_artifact | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what‘s this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. artifact file will store in artifact_file_path before pack , add an arg named pack_artifact gave user a choice wheather pack artifact_file or not
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when user want to make a package with multi version k8s , then user can do kk will download web-installer and make tgz only in the last cmd executed |
||
| - .artifact_file_dir | empty | not | ||
| command: | | ||
| cp kk {{ .artifact_file_dir }}/ | ||
| cd {{ .artifact_file_dir }} && tar -czvf {{ .artifact_file }} * | ||
|
Comment on lines
+39
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using block:
- name: Artifact | Copy kk binary to artifact dir
copy:
src: kk
dest: "{{ .artifact_file_dir }}/"
remote_src: yes
- name: Artifact | Create artifact archive
archive:
path: "{{ .artifact_file_dir }}/"
dest: "{{ .artifact_file }}"
format: gz |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 }} | ||
|
Comment on lines
+7
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of using block:
- name: Download web installer
get_url:
url: "{{ .download.web_installer.url }}"
dest: "{{ .artifact_file_dir }}/web-installer.tgz"
- name: Extract web installer
unarchive:
src: "{{ .artifact_file_dir }}/web-installer.tgz"
dest: "{{ .artifact_file_dir }}"
remote_src: yes
extra_opts: --no-same-owner |
||
|
|
||
| - 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" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 }} | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it may be download.artifact_file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kubekey/cmd/kk/app/options/option.go
Line 238 in 238eb2b
no , it IS artifact_file