Skip to content

Commit f66511c

Browse files
authored
Merge pull request #52264 from sjhala-ccs/cnv-15170
CNV-15170: VM tasks with OpenShift Pipelines
2 parents 5e25da1 + b62a839 commit f66511c

File tree

6 files changed

+250
-0
lines changed

6 files changed

+250
-0
lines changed

_topic_maps/_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3344,6 +3344,8 @@ Topics:
33443344
File: virt-installing-virtio-drivers-on-new-windows-vm
33453345
- Name: Using virtual Trusted Platform Module devices
33463346
File: virt-using-vtpm-devices
3347+
- Name: Managing virtual machines with OpenShift Pipelines
3348+
File: virt-managing-vms-openshift-pipelines
33473349
- Name: Advanced virtual machine management
33483350
Dir: advanced_vm_management
33493351
Topics:

modules/virt-deploying-tto.adoc

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/virtual_machines/virt-managing-vms-openshift-pipelines.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="virt-deploying-tto_{context}"]
7+
= Deploying the Tekton Tasks Operator resources
8+
9+
The Tekton Tasks Operator (TTO) cluster tasks and example pipelines are not deployed by default when you install {VirtProductName}. To deploy TTO resources, enable the `deployTektonTaskResources` feature gate in the `HyperConverged` custom resource (CR).
10+
11+
.Procedure
12+
13+
. Open the `HyperConverged` CR in your default editor by running the following command:
14+
+
15+
[source,terminal]
16+
----
17+
$ oc edit hco -n openshift-cnv kubevirt-hyperconverged
18+
----
19+
20+
. Set the `spec.featureGates.deployTektonTaskResources` field to `true`.
21+
+
22+
[source,yaml]
23+
----
24+
apiVersion: hco.kubevirt.io/v1beta1
25+
kind: HyperConverged
26+
metadata:
27+
name: kubevirt-hyperconverged
28+
namespace: kubevirt-hyperconverged
29+
spec:
30+
tektonPipelinesNamespace: <user_namespace> <1>
31+
featureGates:
32+
deployTektonTaskResources: true <2>
33+
#...
34+
----
35+
<1> The namespace where the pipelines are to be run.
36+
<2> The feature gate to be enabled to deploy TTO resources.
37+
+
38+
[NOTE]
39+
====
40+
The cluster tasks and example pipelines remain available even if you disable the feature gate later.
41+
====
42+
43+
. Save your changes and exit the editor.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/virtual_machines/virt-managing-vms-openshift-pipelines.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="virt-running-tto-pipeline-cli_{context}"]
7+
= Running the example pipelines using the CLI
8+
9+
Use a `PipelineRun` resource to run the example pipelines. A `PipelineRun` object is the running instance of a pipeline. It instantiates a pipeline for execution with specific inputs, outputs, and execution parameters on a cluster. It also creates a `TaskRun` object for each task in the pipeline.
10+
11+
.Procedure
12+
13+
. To run the Windows 10 installer pipeline, create the following `PipelineRun` manifest:
14+
+
15+
[source,yaml]
16+
----
17+
apiVersion: tekton.dev/v1beta1
18+
kind: PipelineRun
19+
metadata:
20+
generateName: windows10-installer-run-
21+
labels:
22+
pipelinerun: windows10-installer-run
23+
spec:
24+
params:
25+
- name: winImageDownloadURL
26+
value: <link_to_windows_10_iso> <1>
27+
pipelineRef:
28+
name: windows10-installer
29+
taskRunSpecs:
30+
- pipelineTaskName: copy-template
31+
taskServiceAccountName: copy-template-task
32+
- pipelineTaskName: modify-vm-template
33+
taskServiceAccountName: modify-vm-template-task
34+
- pipelineTaskName: create-vm-from-template
35+
taskServiceAccountName: create-vm-from-template-task
36+
- pipelineTaskName: wait-for-vmi-status
37+
taskServiceAccountName: wait-for-vmi-status-task
38+
- pipelineTaskName: create-base-dv
39+
taskServiceAccountName: modify-data-object-task
40+
- pipelineTaskName: cleanup-vm
41+
taskServiceAccountName: cleanup-vm-task
42+
status: {}
43+
----
44+
<1> Specify the URL for the Windows 10 64-bit ISO file. The product language must be English (United States).
45+
46+
. Apply the `PipelineRun` manifest:
47+
+
48+
[source,terminal]
49+
----
50+
$ oc apply -f windows10-installer-run.yaml
51+
----
52+
53+
. To run the Windows 10 customize pipeline, create the following `PipelineRun` manifest:
54+
+
55+
[source,yaml]
56+
----
57+
apiVersion: tekton.dev/v1beta1
58+
kind: PipelineRun
59+
metadata:
60+
generateName: windows10-customize-run-
61+
labels:
62+
pipelinerun: windows10-customize-run
63+
spec:
64+
params:
65+
- name: allowReplaceGoldenTemplate
66+
value: true
67+
- name: allowReplaceCustomizationTemplate
68+
value: true
69+
pipelineRef:
70+
name: windows10-customize
71+
taskRunSpecs:
72+
- pipelineTaskName: copy-template-customize
73+
taskServiceAccountName: copy-template-task
74+
- pipelineTaskName: modify-vm-template-customize
75+
taskServiceAccountName: modify-vm-template-task
76+
- pipelineTaskName: create-vm-from-template
77+
taskServiceAccountName: create-vm-from-template-task
78+
- pipelineTaskName: wait-for-vmi-status
79+
taskServiceAccountName: wait-for-vmi-status-task
80+
- pipelineTaskName: create-base-dv
81+
taskServiceAccountName: modify-data-object-task
82+
- pipelineTaskName: cleanup-vm
83+
taskServiceAccountName: cleanup-vm-task
84+
- pipelineTaskName: copy-template-golden
85+
taskServiceAccountName: copy-template-task
86+
- pipelineTaskName: modify-vm-template-golden
87+
taskServiceAccountName: modify-vm-template-task
88+
status: {}
89+
----
90+
91+
. Apply the `PipelineRun` manifest:
92+
+
93+
[source,terminal]
94+
----
95+
$ oc apply -f windows10-customize-run.yaml
96+
----
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/virtual_machines/virt-managing-vms-openshift-pipelines.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="virt-running-tto-pipeline-web_{context}"]
7+
= Running the example pipelines using the web console
8+
9+
You can run the example pipelines from the *Pipelines* menu in the web console.
10+
11+
.Procedure
12+
13+
. Click *Pipelines* -> *Pipelines* in the side menu.
14+
15+
. Select a pipeline to open the *Pipeline details* page.
16+
17+
. From the *Actions* list, select *Start*. The *Start Pipeline* dialog is displayed.
18+
19+
. Keep the default values for the parameters and then click *Start* to run the pipeline. The *Details* tab tracks the progress of each task and displays the pipeline status.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/virtual_machines/virt-managing-vms-openshift-pipelines.adoc
4+
5+
:_content-type: REFERENCE
6+
[id="virt-supported-tekton-tasks_{context}"]
7+
= Virtual machine tasks supported by the Tekton Tasks Operator
8+
9+
The following table shows the cluster tasks that are included as part of the Tekton Tasks Operator.
10+
11+
.Virtual machine tasks supported by the Tekton Tasks Operator
12+
[cols="1,1",options="header"]
13+
|===
14+
| Task | Description
15+
16+
| `create-vm-from-template`
17+
| Create a virtual machine from a template.
18+
19+
| `copy-template`
20+
| Copy a virtual machine template.
21+
22+
| `modify-vm-template`
23+
| Modify a virtual machine template.
24+
25+
| `modify-data-object`
26+
| Create or delete data volumes or data sources.
27+
28+
| `cleanup-vm`
29+
| Run a script or a command in a virtual machine and stop or delete the virtual machine afterward.
30+
31+
| `disk-virt-customize`
32+
| Use the `virt-customize` tool to run a customization script on a target PVC.
33+
34+
| `disk-virt-sysprep`
35+
| Use the `virt-sysprep` tool to run a sysprep script on a target PVC.
36+
37+
| `wait-for-vmi-status`
38+
| Wait for a specific status of a virtual machine instance and fail or succeed based on the status.
39+
|===
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
:_content-type: ASSEMBLY
2+
[id="virt-managing-vms-openshift-pipelines"]
3+
= Managing virtual machines with OpenShift Pipelines
4+
include::_attributes/common-attributes.adoc[]
5+
:context: virt-managing-vms-openshift-pipelines
6+
7+
toc::[]
8+
9+
xref:../../cicd/pipelines/understanding-openshift-pipelines.adoc#understanding-openshift-pipelines[{pipelines-title}] is a Kubernetes-native CI/CD framework that allows developers to design and run each step of the CI/CD pipeline in its own container.
10+
11+
The Tekton Tasks Operator (TTO) integrates {VirtProductName} with {pipelines-shortname}. TTO includes cluster tasks and example pipelines that allow you to:
12+
13+
* Create and manage virtual machines (VMs), persistent volume claims (PVCs), and data volumes
14+
* Run commands in VMs
15+
* Manipulate disk images with `libguestfs` tools
16+
17+
:FeatureName: Managing virtual machines with {pipelines-title}
18+
include::snippets/technology-preview.adoc[]
19+
20+
21+
[id="prerequisites_virt-managing-vms-openshift-pipelines"]
22+
== Prerequisites
23+
24+
* You have access to an {product-title} cluster with `cluster-admin` permissions.
25+
* You have installed the OpenShift CLI (`oc`).
26+
* You have xref:../../cicd/pipelines/installing-pipelines.adoc#installing-pipelines[installed {pipelines-shortname}].
27+
28+
29+
include::modules/virt-deploying-tto.adoc[leveloffset=+1]
30+
31+
include::modules/virt-supported-tekton-tasks.adoc[leveloffset=+1]
32+
33+
34+
[id="example-pipelines_virt-managing-vms-openshift-pipelines"]
35+
== Example pipelines
36+
37+
The Tekton Tasks Operator includes the following example `Pipeline` manifests. You can run the example pipelines by using the web console or CLI.
38+
39+
Windows 10 installer pipeline:: This pipeline installs Windows 10 into a new data volume from a Windows installation image (ISO file). A custom answer file is used to run the installation process.
40+
41+
Windows 10 customize pipeline:: This pipeline clones the data volume of a basic Windows 10 installation, customizes it by installing Microsoft SQL Server Express, and then creates a new image and template.
42+
43+
include::modules/virt-running-tto-pipeline-web.adoc[leveloffset=+2]
44+
45+
include::modules/virt-running-tto-pipeline-cli.adoc[leveloffset=+2]
46+
47+
48+
[role="_additional-resources"]
49+
[id="additional-resources_virt-managing-vms-openshift-pipelines"]
50+
== Additional resources
51+
* xref:../../cicd/pipelines/creating-applications-with-cicd-pipelines.adoc#creating-applications-with-cicd-pipelines[Creating CI/CD solutions for applications using {pipelines-title}]

0 commit comments

Comments
 (0)