From 32853720d14213053226fcb50422cf92dd2c738b Mon Sep 17 00:00:00 2001 From: Ben Oukhanov Date: Mon, 16 Dec 2024 17:32:07 +0200 Subject: [PATCH] docs(CNV-53188): improve disk-uploader usage guidance Add more details to explain an usage of EXPORT_SOURCE_KIND. Also, Add an example of the Secret object, that will be referenced by SECRET_NAME. Signed-off-by: Ben Oukhanov --- configs/disk-uploader.yaml | 1 + release/tasks/disk-uploader/README.md | 21 ++++++++++++++++++- .../tasks/disk-uploader/disk-uploader.yaml | 2 +- .../taskruns/disk-uploader-secret.yaml | 9 ++++++++ .../disk-uploader-taskrun-resolver.yaml | 4 ++++ .../examples/disk-uploader-taskrun.yaml | 4 ++++ templates/disk-uploader/generate-task.yaml | 9 ++++++++ .../manifests/disk-uploader.yaml | 2 +- templates/disk-uploader/readmes/README.md | 7 +++++++ 9 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 release/tasks/disk-uploader/examples/taskruns/disk-uploader-secret.yaml diff --git a/configs/disk-uploader.yaml b/configs/disk-uploader.yaml index 0a5b91dae..959d89d66 100644 --- a/configs/disk-uploader.yaml +++ b/configs/disk-uploader.yaml @@ -1,4 +1,5 @@ task_name: disk-uploader +secret_task_name: disk-uploader-secret task_category: disk-uploader main_image: quay.io/kubevirt/tekton-tasks nice_name: disk uploader diff --git a/release/tasks/disk-uploader/README.md b/release/tasks/disk-uploader/README.md index 136d326c8..d9cc30aaf 100644 --- a/release/tasks/disk-uploader/README.md +++ b/release/tasks/disk-uploader/README.md @@ -12,7 +12,7 @@ When user runs [KubeVirt Tekton Tasks](https://github.com/kubevirt/kubevirt-tekt ### Parameters -- **EXPORT_SOURCE_KIND**: The name of the export source kind +- **EXPORT_SOURCE_KIND**: Specify the export source kind (vm, vmsnapshot, pvc) - **EXPORT_SOURCE_NAME**: The name of the export source - **VOLUME_NAME**: The volume name (If source kind is PVC, then volume name is equal to source name) - **IMAGE_DESTINATION**: Destination of the image in container registry @@ -21,6 +21,21 @@ When user runs [KubeVirt Tekton Tasks](https://github.com/kubevirt/kubevirt-tekt ### Usage +Secret of the task run: +``` +apiVersion: v1 +data: + accessKeyId: + secretKey: +kind: Secret +metadata: + name: disk-uploader-credentials +type: Opaque + +``` + +Get `ACCESS_KEY_ID` or `SECRET_KEY` by running: `echo -n "" | base64`. + Task run using resolver: ``` apiVersion: tekton.dev/v1 @@ -37,6 +52,10 @@ spec: value: example-dv - name: IMAGE_DESTINATION value: quay.io/kubevirt/example-vm-exported:latest + - name: PUSH_TIMEOUT + value: 120 + - name: SECRET_NAME + value: disk-uploader-credentials taskRef: params: - name: catalog diff --git a/release/tasks/disk-uploader/disk-uploader.yaml b/release/tasks/disk-uploader/disk-uploader.yaml index d01f04d17..a85d84b0b 100644 --- a/release/tasks/disk-uploader/disk-uploader.yaml +++ b/release/tasks/disk-uploader/disk-uploader.yaml @@ -24,7 +24,7 @@ spec: to be used in multiple Kubernetes clusters. params: - name: EXPORT_SOURCE_KIND - description: The name of the export source kind + description: Specify the export source kind (vm, vmsnapshot, pvc) type: string - name: EXPORT_SOURCE_NAME description: The name of the export source diff --git a/release/tasks/disk-uploader/examples/taskruns/disk-uploader-secret.yaml b/release/tasks/disk-uploader/examples/taskruns/disk-uploader-secret.yaml new file mode 100644 index 000000000..22443ffdf --- /dev/null +++ b/release/tasks/disk-uploader/examples/taskruns/disk-uploader-secret.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: v1 +kind: Secret +metadata: + name: disk-uploader-credentials +type: Opaque +data: + accessKeyId: "" + secretKey: "" diff --git a/release/tasks/disk-uploader/examples/taskruns/disk-uploader-taskrun-resolver.yaml b/release/tasks/disk-uploader/examples/taskruns/disk-uploader-taskrun-resolver.yaml index 258392788..87fe58068 100644 --- a/release/tasks/disk-uploader/examples/taskruns/disk-uploader-taskrun-resolver.yaml +++ b/release/tasks/disk-uploader/examples/taskruns/disk-uploader-taskrun-resolver.yaml @@ -25,3 +25,7 @@ spec: value: example-dv - name: IMAGE_DESTINATION value: quay.io/kubevirt/example-vm-exported:latest + - name: PUSH_TIMEOUT + value: 120 + - name: SECRET_NAME + value: disk-uploader-credentials diff --git a/templates/disk-uploader/examples/disk-uploader-taskrun.yaml b/templates/disk-uploader/examples/disk-uploader-taskrun.yaml index 63b709085..b7f0a32e4 100644 --- a/templates/disk-uploader/examples/disk-uploader-taskrun.yaml +++ b/templates/disk-uploader/examples/disk-uploader-taskrun.yaml @@ -25,3 +25,7 @@ spec: value: example-dv - name: IMAGE_DESTINATION value: quay.io/kubevirt/example-vm-exported:latest + - name: PUSH_TIMEOUT + value: 120 + - name: SECRET_NAME + value: disk-uploader-credentials diff --git a/templates/disk-uploader/generate-task.yaml b/templates/disk-uploader/generate-task.yaml index bfaad69ed..c553784d2 100644 --- a/templates/disk-uploader/generate-task.yaml +++ b/templates/disk-uploader/generate-task.yaml @@ -36,6 +36,13 @@ mode: "{{ default_file_mode }}" with_items: - { taskrun_with_flavor_name: "{{ task_name }}-taskrun-resolver"} + - name: Generate example secret of the task + template: + src: "{{ examples_templates_dir }}/{{ secret_task_name }}.yaml" + dest: "{{ examples_taskruns_output_dir }}/{{ item.secret_task_with_flavor_name }}.yaml" + mode: "{{ default_file_mode }}" + with_items: + - { secret_task_with_flavor_name: "{{ secret_task_name }}"} - name: Generate README template: src: "{{ readmes_templates_dir }}/README.md" @@ -46,6 +53,8 @@ task_yaml: "{{ lookup('file', task_path) | from_yaml }}" task_run_resolver_path: "{{ examples_taskruns_output_dir }}/{{ task_name }}-taskrun-resolver.yaml" task_run_resolver_yaml: "{{ lookup('file', task_run_resolver_path) | from_yaml }}" + secret_task_path: "{{ examples_taskruns_output_dir }}/{{ secret_task_name }}.yaml" + secret_task_yaml: "{{ lookup('file', secret_task_path) | from_yaml }}" - name: "Delete readme tmp directory" file: path: "{{ readme_output_dir_tmp }}" diff --git a/templates/disk-uploader/manifests/disk-uploader.yaml b/templates/disk-uploader/manifests/disk-uploader.yaml index 15494d5ee..426226d50 100644 --- a/templates/disk-uploader/manifests/disk-uploader.yaml +++ b/templates/disk-uploader/manifests/disk-uploader.yaml @@ -24,7 +24,7 @@ spec: to be used in multiple Kubernetes clusters. params: - name: EXPORT_SOURCE_KIND - description: The name of the export source kind + description: Specify the export source kind (vm, vmsnapshot, pvc) type: string - name: EXPORT_SOURCE_NAME description: The name of the export source diff --git a/templates/disk-uploader/readmes/README.md b/templates/disk-uploader/readmes/README.md index f91ee3957..4054c618d 100644 --- a/templates/disk-uploader/readmes/README.md +++ b/templates/disk-uploader/readmes/README.md @@ -18,6 +18,13 @@ When user runs [KubeVirt Tekton Tasks](https://github.com/kubevirt/kubevirt-tekt ### Usage +Secret of the task run: +``` +{{ secret_task_yaml | to_nice_yaml }} +``` + +Get `ACCESS_KEY_ID` or `SECRET_KEY` by running: `echo -n "" | base64`. + Task run using resolver: ``` {{ task_run_resolver_yaml | to_nice_yaml }}