KubeVirt Tekton

KubeVirt Tekton tasks operator (TTO)

Prerequisites

Deploying TTO

TTO is a Golang based operator, which takes care of deploying kubevirt-tekton-tasks and example pipelines.

TTO is shipped as a part of hyperconverged-cluster-operator or it can be deployed by the user as a stand-alone from the latest release.

Note

TTO requires Tekton to work.

Note

TTO does not deploy its resources by default.

The user has to enable deployTektonTaskResources feature gate in HCO CR to deploy all its resources

  1. apiVersion: hco.kubevirt.io/v1beta1
  2. kind: HyperConverged
  3. metadata:
  4. name: kubevirt-hyperconverged
  5. namespace: kubevirt-hyperconverged
  6. spec:
  7. featureGates:
  8. deployTektonTaskResources: true

or in TTO CR:

  1. apiVersion: tektontasks.kubevirt.io/v1alpha1
  2. kind: TektonTasks
  3. metadata:
  4. name: tektontasks
  5. namespace: kubevirt
  6. spec:
  7. featureGates:
  8. deployTektonTaskResources: true

User can use this command to enable deployTektonTaskResources feature gate in HCO CR

  1. oc patch hco kubevirt-hyperconverged --type=merge -p '{"spec":{"featureGates": {"deployTektonTaskResources": true}}}'

or in TTO CR if TTO is deployed as a stand-alone without HCO

  1. oc patch TektonTasks tektontasks --type=merge -p '{"spec":{"featureGates": {"deployTektonTaskResources": true}}}'

Once spec.featureGates.deployTektonTaskResources is set to true, TTO will not delete any cluster tasks or pipeline examples even if it is reverted back to false.

The user can set in which namespace example pipelines will be deployed by setting spec.tektonPipelinesNamespace in HCO CR:

  1. apiVersion: hco.kubevirt.io/v1beta1
  2. kind: HyperConverged
  3. metadata:
  4. name: kubevirt-hyperconverged
  5. namespace: kubevirt-hyperconverged
  6. spec:
  7. tektonPipelinesNamespace: userNamespace

or in TTO CR by setting spec.pipelines.namespace:

  1. apiVersion: tektontasks.kubevirt.io/v1alpha1
  2. kind: TektonTasks
  3. metadata:
  4. name: tektontasks
  5. namespace: kubevirt
  6. spec:
  7. pipelines:
  8. namespace: userNamespace

KubeVirt Tekton tasks

What are KubeVirt Tekton tasks?

KubeVirt-specific Tekton tasks, which are focused on:

  • Creating and managing resources (VMs, DataVolumes)
  • Executing commands in VMs
  • Manipulating disk images with libguestfs tools

Existing tasks

Create Virtual Machines

  • create-vm-from-manifest - create a VM from provided manifest.
  • create-vm-from-template - create a VM from template (works only on OpenShift).

Utilize Templates

  • copy-template - Copies the given template and creates a new one (works only on OpenShift).
  • modify-vm-template - Modifies a template with user provided data (works only on OpenShift).

Modify Data Objects

  • modify-data-object - Creates / modifies / deletes a datavolume / datasource

Generate SSH Keys

  • generate-ssh-keys - Generates a private and public key pair, and injects it into a VM.

Execute commands in Virtual Machines

  • execute-in-vm - Execute commands over SSH in a VM.
  • cleanup-vm - Execute commands and/or stop/delete VMs.

Manipulate PVCs with libguestfs tools

  • disk-virt-customize - execute virt-customize commands in PVCs.
  • disk-virt-sysprep- execute virt-sysprep commands in PVCs.

Wait for Virtual Machine Instance Status

  • wait-for-vmi-status - Waits for a VMI to be running.

Modify Windows iso

  • modify-windows-iso-file - modifies windows iso (replaces prompt bootloader with no-prompt bootloader) and replaces original iso in PVC with updated one. This helps with automated installation of Windows in EFI boot mode. By default Windows in EFI boot mode uses a prompt bootloader, which will not continue with the boot process until a key is pressed. By replacing it with the non-prompt bootloader no key press is required to boot into the Windows installer.

Example pipeline

All these tasks can be used for creating pipelines. TTO is creating multiple example pipelines, e.g.:

  • Windows bios installer - Pipeline will prepare a template and Windows datavolume vith virtio drivers installed. User has to provide a link to working Windows 10 iso file. Pipeline is suitable for Windows versions, which uses bios. More informations about pipeline can be found here

  • Windows efi installer - Pipeline will prepare a template and Windows 11/2k22 datavolume vith virtio drivers installed. User has to provide a link to working Windows 11/2k22 iso file. Pipeline is suitable for Windows versions, which requires EFI (e.g. Windows 11/2k22). More informations about pipeline can be found here

  • Windows customize - Pipeline will install sql server or vs code in windows VM. More informations about pipeline can be found here