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 a VirtualDisk is created, only the disk size field .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 an external container registry. Only registries with enabled TLS are supported. To provide a custom Certificate Authority (CA) chain, use the
caBundle
field.- spec.dataSource.containerImage.caBundle
CA chain in Base64 format to verify the container registry.
Example:
caBundle: YWFhCg==
- spec.dataSource.containerImage.image
Required value
Path to the image in the container registry.
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
Name of the secret keeping container registry credentials, which must be located in the same namespace.
- spec.dataSource.http
Fill the image with data from an external URL. The following schemas are supported:
- HTTP
- HTTPS
For HTTPS schema, there is an option to skip the TLS verification.
- spec.dataSource.http.caBundle
CA chain in Base64 format to verify the URL.
Example:
caBundle: YWFhCg==
- spec.dataSource.http.checksum
Checksum to verify integrity and consistency of the downloaded file. The file must 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
URL of the file for creating an image. The following file formats are supported:
- qcow2
- vmdk
- vdi
- iso
- raw The file can be compressed into an archive in one of 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, or VirtualDiskSnapshot resource to create a disk.
- spec.dataSource.objectRef.kind
Required value
Kind of the existing VirtualImage, ClusterVirtualImage, or VirtualDiskSnapshot resource.
Allowed values:
ClusterVirtualImage
,VirtualImage
,VirtualDiskSnapshot
- spec.dataSource.objectRef.name
Required value
Name of the existing VirtualImage, ClusterVirtualImage, or VirtualDiskSnapshot resource.
- spec.dataSource.type
The following image sources are available for creating an image:
HTTP
: From a file published on an HTTP/HTTPS service at a given URL.ContainerImage
: From another image stored in a container registry.ObjectRef
: From an existing resource.Upload
: From data uploaded by the user via a 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
section is filled out. In this 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
StorageClass name required by the claim. For details on using StorageClass for PVC, refer to https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
When creating disks, the user can specify the required StorageClass. If not specified, 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. The following values are allowed:Immediate
: The disk will be created and becomes available for use immediately after creation.WaitForFirstConsumer
: The disk will be created when first used on the node where the virtual machine will be started.
StorageClass supports multiple storage settings:
- Creating a block device (
Block
) or file system (FileSystem
). - Multiple access (
ReadWriteMany
) or single access (ReadWriteOnce
). TheReadWriteMany
disks support multiple access, which enables a “live” migration of virtual machines. In contrast, theReadWriteOnce
disks, which can be accessed from only one node, don’t have this feature.
For known storage types, Deckhouse automatically determines the most efficient settings when creating disks (by priority, in descending order):
Block
+ReadWriteMany
FileSystem
+ReadWriteMany
Block
+ReadWriteOnce
FileSystem
+ReadWriteOnce