Skip to content

kubevirt/kubevirt-tekton-tasks

Artifact Hub Artifact Hub

KubeVirt Tekton Tasks

Tekton Pipelines are CI/CD-style pipelines for Kubernetes. This repository provides KubeVirt-specific Tekton tasks, which focus on:

  • Creating and managing resources (VMs, DataVolumes, DataSources)
  • Executing commands in VMs
  • Manipulating disk images with libguestfs tools
  • Extracting and uploading disk images from multiple sources (VM, VMSnapshot, PVC)

Deployment

In order to install the KubeVirt Tekton tasks in the active namespace you need to apply the following manifest. You have to repeat this for every namespace in which you'd like to run the tasks.

VERSION=$(curl -s https://api.github.com/repos/kubevirt/kubevirt-tekton-tasks/releases | \
            jq '.[] | select(.prerelease==false) | .tag_name' | sort -V | tail -n1 | tr -d '"')
kubectl apply -f "https://github.com/kubevirt/kubevirt-tekton-tasks/releases/download/${VERSION}/kubevirt-tekton-tasks.yaml"

Visit RBAC permissions for running the tasks if the pipeline needs to create/access resources (VMs, PVCs, etc.) in a different namespace other than the one the pipeline runs in.

Usage

Create Virtual Machines

Modify data objects

Generate SSH Keys

Execute Commands in Virtual Machines

Manipulate PVCs with libguestfs tools

Wait for Virtual Machine Instance Status

Modify Windows iso

  • modify-windows-iso-file - modifies windows iso (replaces prompt bootloader with no-promt bootloader) and replaces original iso in PVC with updated one.

Disk Uploader

  • disk-uploader - Extracts disk image and uploads it to a container registry.

Examples

Downloads a Windows ISO file into a PVC and automatically installs Windows 10, 11 or Server 2k22, 2k25 with EFI enabled by using a custom Answer file into a new base DataVolume. Supported Windows versions: Windows 10, 11, Server 2k22, 2k25

Applies customizations to an existing Windows 10, 11, Server 2k22, 2k25 installation by using a custom Answer file and creates a new base DataVolume. Supported Windows versions: Windows 10, 11, Server 2k22, 2k25

Extracts disk image from one of the sources (VM, VMSnapshot, PVC) and uploads to the container registry.

Unit Tester Pipeline - Unmaintained

Good unit tests are detached from the operating system and can run everywhere. However, this is not always the case. Your tests may require access to entire operating system, or run as root, or need a specific kernel.

This example shows how you can run your tests in your VM of choice. The pipeline creates a VM, connects to it over SSH and runs tests inside it. It also showcases the finally construct.

For complex application server deployments it might be easier to start the server as is in a VM rather than converting it to cloud-native application.

This example shows how you can initialize/modify a PVC and deploy such application in a VM.

Virt-sysprep can be used for preparing VM images which can be then used as base images for other VMs.

This example shows how you can update an operating system and seal VM's image by using virt-customize. Then, a VM is created from such image.

Development Guide

See Getting Started for the environment setup and development workflow.