The Virtualization API component of the virtualization module manages custom resources of the following API groups:
-
virtualization.deckhouse.io: The main group, it includes the following custom resources:- VirtualMachine: A resource that describes the virtual machine (VM) configuration and status.
- VirtualMachineClass: A resource that describes a set of parameters for VirtualMachine resources, such as CPU and RAM specification,
NodeSelector, andTolerations. - VirtualMachinePool: A resource that declaratively manages a group of identical VMs.
- VirtualDisk: A resource that describes desired VM disk configuration.
- VirtualImage: A resource that describes:
- a VM disk image that can be used as a data source for new VirtualDisk resources.
- an ISO installation image that can be mounted directly into a VirtualMachine resource.
The full list of the main API group resources is given in the module documentation.
Virtualization-controller manages the resources of the main group.
-
subresources.virtualization.deckhouse.io: Subresources group. Subresources are additional operations or actions that can be performed on core resources (for example, VirtualMachine) via the Kubernetes API. They provide interfaces for managing specific aspects of resources without affecting the entire object. Instead of the declarative resource familiar to Kubernetes, they are endpoints for imperative operations.The group includes the following subresources:
virtualmachines/console;virtualmachines/vnc;virtualmachines/portforward;virtualmachines/addvolume;virtualmachines/removevolume;virtualmachines/freeze;virtualmachines/unfreeze;virtualmachines/addresourceclaim;virtualmachines/removeresourceclaim.
Virtualization-api manages subresources.
The Virtualization API component of the module uses KubeVirt custom resources as a backend to manage VMs, VM disks, and images.
KubeVirt is an open-source project that allows you to launch, deploy, and manage VMs using Kubernetes as an orchestration platform. It enables cooperation between traditional VMs and container workloads in the same Kubernetes cluster, providing a single control plane.
Virtualization API architecture
The following simplifications are made in the diagram:
- The diagram shows containers in different pods interacting directly with each other. In reality, they communicate via the corresponding Kubernetes Services (internal load balancers). Service names are omitted if they are obvious from the diagram context. Otherwise, the Service name is shown above the arrow.
- Pods may run multiple replicas. However, each pod is shown as a single replica in the diagram.
The Level 2 C4 architecture of the Virtualization API component of the virtualization module and its interactions with other components of Deckhouse Platform (DP) are shown in the following diagram:
Virtualization API components
Virtualization API consists of the following components:
-
Virtualization-api: A Kubernetes Extension API Server that serves requests to the
subresources.virtualization.deckhouse.ioAPI group. Virtualization-api usessubresources.kubevirt.ioAPI group subresources as a backend. Virtualization-api accesses the virt-api endpoint directly, which is a Kubernetes Extension API Server that handles requests to similarsubresources.kubevirt.ioAPI group subresources. It consists of the virtualization-api container. -
Virtualization-controller: A controller that performs the following operations:
-
Manages custom resources of the main
virtualization.deckhouse.ioAPI group. Virtualization-controller will not change the main portion of these custom resources:labels,annotations, andspec. Virtualization-controller can make the following changes to custom resources:- Adding and removing finalizers in the
metadata.finalizersattribute. - Adding and removing entries in the
metadata.ownerReferencesattribute. - Modifying the
statussubresource.
Virtualization-controller uses
kubevirt.ioAPI group custom resources as a backend. - Adding and removing finalizers in the
- Validation of
virtualization.deckhouse.ioAPI group resources using the Validating Admission Controllers mechanism. - Launching
dvcr-importer,dvcr-uploaderandpvc-importerpods to import and upload VM disks and images. For more details, see Importing and uploading VM images and disks. - Performing operations on VMs by making requests to some subresources of the
subresources.virtualization.deckhouse.ioAPI group, for examplevirtualmachines/freezeandvirtualmachines/unfreeze.
The component consists of the following containers:
- virtualization-controller: Main container that implements the controller and webhook server.
- proxy (aka kube-api-rewriter): Sidecar container that performs modification of API requests passing through it, namely renaming the metadata of custom resources. This is necessary because KubeVirt components use API groups like
*.kubevirt.io, and other components of thevirtualizationmodule use similar resources, but with API groups like*.virtualization.deckhouse.io. Kube-api-rewriter is a gateway that proxies requests between controllers that manage resources from different API groups and is an open-source project. - kube-rbac-proxy: Sidecar container with an authorization proxy based on Kubernetes RBAC that provides secure access to the metrics of the controller and the proxy sidecar container. It is an open-source project.
-
Virtualization API interactions
Virtualization-api interacts with the following components:
- Kube-apiserver: Lists VirtualMachine custom resources, which are needed to process requests to subresources.
- Virt-api: Sends requests to the KubeVirt subresources.
Requests pass through a similar proxy sidecar container that renames metadata from the
subresources.virtualization.deckhouse.ioAPI group to thesubresources.kubevirt.ioAPI group and proxies them to the virt-api endpoint (Kubernetes Extension API Server KubeVirt).
Virtualization-controller interacts with the following components:
-
Kube-apiserver:
- Sends modified virtualization module custom resources via a proxy sidecar container that renames
internal.virtualization.deckhouse.ioAPI group resource metadata tokubevirt.ioAPI group resource metadata. - Authorizes requests for metrics.
- Sends modified virtualization module custom resources via a proxy sidecar container that renames
The following external components interact with the Virtualization API component:
-
Kube-apiserver:
- Forwards requests to
subresources.virtualization.deckhouse.ioAPI group subresources. - Sends
virtualization.deckhouse.ioAPI group resource validation requests.
- Forwards requests to
-
Prometheus-main: Collects component metrics.