VirtualDisk
Scope: Namespaced
Version: v1alpha2
The VirtualDisk
resource describes the desired virtual machine disk configuration. A VirtualDisk
can be mounted statically in the virtual machine by specifying it in the .spec.blockDeviceRefs
disk list, or mounted on-the-fly using the VirtualMachineBlockDeviceAttachments
resource.
Once VirtualDisk
is created, only the disk size .spec.persistentVolumeClaim.size
can be changed, all other fields are immutable.
- apiVersion
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
- kind
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
- metadata
- spec
Required value
- spec.dataSource
- spec.dataSource.containerImage
Use an image stored in external container registry. Only TLS enabled registries are supported. Use caBundle field to provide custom CA chain if needed.
- spec.dataSource.containerImage.caBundle
The CA chain in base64 format to verify the container registry.
Example:
caBundle: YWFhCg==
- spec.dataSource.containerImage.image
Required value
The container registry address of an image.
Pattern:
^(?P<name>(?:(?P<domain>(?:(?:localhost|[\w-]+(?:\.[\w-]+)+)(?::\d+)?)|[\w]+:\d+)/)?(?P<image>[a-z0-9_.-]+(?:/[a-z0-9_.-]+)*))(?::(?P<tag>[\w][\w.-]{0,127}))?(?:@(?P<digest>[A-Za-z][A-Za-z0-9]*(?:[+.-_][A-Za-z][A-Za-z0-9]*)*:[0-9a-fA-F]{32,}))?$
Example:
image: registry.example.com/images/slackware:15
- spec.dataSource.containerImage.imagePullSecret
- spec.dataSource.containerImage.imagePullSecret.name
A name of the secret containing registry credentials which must be located in the same namespace.
- spec.dataSource.http
Fill the image with data from some external url. Supported schemas are:
- http
- https
For https schema there is an option to skip TLS verification.
- spec.dataSource.http.caBundle
The CA chain in base64 format to verify the url.
Example:
caBundle: YWFhCg==
- spec.dataSource.http.checksum
A checksum of the file, provided by the url, to verify if it was downloaded correctly or wasn’t changed. The file should match all specified checksums.
- spec.dataSource.http.checksum.md5
Pattern:
^[0-9a-fA-F]{32}$
Length:
32..32
Example:
md5: f3b59bed9f91e32fac1210184fcff6f5
- spec.dataSource.http.checksum.sha256
Pattern:
^[0-9a-fA-F]{64}$
Length:
64..64
Example:
sha256: 78be890d71dde316c412da2ce8332ba47b9ce7a29d573801d2777e01aa20b9b5
- spec.dataSource.http.url
Required value
The http url with an image. The following formats are supported:
- qcow2
- vmdk
- vdi
- iso
- raw these formats can also be compressed with the following formats:
- gz
- xz
Pattern:
^http[s]?:\/\/(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+$
Example:
url: https://mirror.example.com/images/slackware-15.qcow.gz
- spec.dataSource.objectRef
Use an existing
VirtualImage
,ClusterVirtualImage
orVirtualDiskSnapshot
to create a disk.- spec.dataSource.objectRef.kind
Required value
A kind of existing
VirtualImage
,ClusterVirtualImage
orVirtualDiskSnapshot
.Allowed values:
ClusterVirtualImage
,VirtualImage
,VirtualDiskSnapshot
- spec.dataSource.objectRef.name
Required value
A name of existing
VirtualImage
,ClusterVirtualImage
orVirtualDiskSnapshot
.
- spec.dataSource.type
The type of an origin of the image. Options are:
HTTP
— create an image from a file published on http/https service at a given urlContainerImage
— create the image from image stored in container registry.ObjectRef
— fill the disk from another existing resource.Upload
— fill the image with data, uploaded by user via the special interface.
Allowed values:
HTTP
,ContainerImage
,ObjectRef
,Upload
- spec.persistentVolumeClaim
Settings for creating PVCs to store the disk.
- spec.persistentVolumeClaim.size
Desired size for PVC to store the disk. If the disk is created from an image, the size must be at least as large as the original unpacked image.
This parameter can be omitted if the
.spec.dataSource
block is specified, in which case the controller will determine the disk size automatically, based on the size of the extracted image from the source specified in.spec.dataSource
.Pattern:
^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
- spec.persistentVolumeClaim.storageClassName
The name of the StorageClass required by the claim. More info — https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1
When creating disks, the user can specify the required StorageClass to create the disk, or not explicitly, in which case the default StorageClass will be used.
The disk features and virtual machine behavior depend on the selected StorageClass.
The
VolumeBindingMode
parameter in the StorageClass affects the disk creation process:Immediate
- The disk will be created and available for use immediately after creation.WaitForFirstConsumer
- The disk will be created only when it is used in a virtual machine. In this case, the disk will be created on the host where the virtual machine will be started.
StorageClass can support different storage settings:
- Creating a block device (
Block
) or file system (FileSystem
). - Multiple Access (
ReadWriteMany
) or Single Access (ReadWriteOnce
).ReadWriteMany
disks support multiple access, which enables live migration of virtual machines. In contrast,ReadWriteOnce
disks, which are limited to access from only one host, cannot provide this capability.
For known storage types, the platform will independently determine the most effective settings when creating disks (in descending order of priority):
Block
+ReadWriteMany
FileSystem
+ReadWriteMany
Block
+ReadWriteOnce
FileSystem
+ReadWriteOnce