Skip to content

opokornyy/kubevirt-tekton-tasks

 
 

Repository files navigation

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

Deployment

On Kubernetes

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-kubernetes.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.

On OKD

In order to install the KubeVirt Tekton tasks with additional OKD-specific 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-okd.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

copy-template, modify-vm-template and create-vm-from-template tasks are deprecated and will be removed in future versions. These tasks based on templates will be replaced with create-vm task with enhancements related to instance types.

Create Virtual Machines

Utilize Templates

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.

Examples

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.

Downloads a Windows Source ISO into a PVC and automatically installs Windows by using a custom Answer file into a new base DV.

Downloads a Windows Source ISO into a PVC and automatically installs Windows 11, or 2k22 with efi enabled by using a custom Answer file into a new base DV.

Applies customizations to an existing Windows 10, 11, 2k22 installation by using a custom Answer file and creates a new base DV.

Development Guide

See Getting Started for the environment setup and development workflow.

About

VM specific tasks for Tekton Pipelines

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 94.8%
  • Shell 4.3%
  • Other 0.9%