VirtualMachineClass
Scope: Cluster
Version: v1alpha2
VirtualMachineClass resource describes CPU requirements, node placement, and sizing policy for VM resources. A resource cannot be deleted as long as it is used in one of the VMs.
- 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.cpu
Required value
CPU defines the requirements for the virtual CPU model.
- spec.cpu.discovery
Create a CPU model based on intersecting CPU features for selected nodes.
- spec.cpu.discovery.nodeSelector
A selection of nodes to be used as the basis for creating a universal CPU model.
- spec.cpu.discovery.nodeSelector.matchExpressions
matchExpressions is a list of label selector requirements. The requirements are ANDed.
A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
- spec.cpu.discovery.nodeSelector.matchExpressions.key
Required value
key is the label key that the selector applies to.
- spec.cpu.discovery.nodeSelector.matchExpressions.operator
Required value
operator represents a key’s relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.
- spec.cpu.discovery.nodeSelector.matchExpressions.values
values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
- spec.cpu.discovery.nodeSelector.matchLabels
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is “key”, the operator is “In”, and the values array contains only “value”. The requirements are ANDed.
- spec.cpu.features
List of CPU instructions (features) required when type=Features. For more information about CPU features, refer to the libvirt docs.
Example:
features: - mmx - vmx - sse2
- spec.cpu.model
CPU model name. For more information about CPU models and topology, refer to the libvirt docs.
Example:
model: IvyBridge
- spec.cpu.type
Required value
CPUType defines the CPU type, the following options are supported:
Host
: Uses a virtual CPU with an instruction set closely matching the platform node’s CPU. This provides high performance and functionality, as well as compatibility with “live” migration for nodes with similar processor types. For example, VM migration between nodes with Intel and AMD processors will not work. This is also true for different CPU generations, as their instruction set is different.HostPassthrough
: Uses the platform node’s physical CPU directly, without any modifications. When using this class, the guest VM can only be transferred to a target node with a CPU exactly matching the source node’s CPU.Discovery
: Create a virtual CPU based on instruction sets of physical CPUs for a selected set of nodes.Model
: CPU model. A CPU model is a named and previously defined set of supported CPU instructions.Features
: A required set of supported instructions for the CPU.
Allowed values:
Host
,HostPassthrough
,Discovery
,Model
,Features
- spec.nodeSelector
NodeSelector defines the nodes targeted for VM scheduling.
- spec.nodeSelector.matchExpressions
A list of node selector requirements by node’s labels.
A node selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
- spec.nodeSelector.matchExpressions.key
Required value
The label key that the selector applies to.
- spec.nodeSelector.matchExpressions.operator
Required value
Represents a key’s relationship to a set of values. Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
- spec.nodeSelector.matchExpressions.values
An array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. If the operator is Gt or Lt, the values array must have a single element, which will be interpreted as an integer. This array is replaced during a strategic merge patch.
- spec.nodeSelector.matchLabels
A map of {key,value} pairs. A single {key,value} pair in the matchLabels map is equivalent to an element of matchExpressions whose key field is “key”, operator is “In”, and the value array contains only “value”. The requirements are ANDed.
- spec.sizingPolicies
- spec.sizingPolicies.coreFractions
Allowed values of the
coreFraction
parameter.- Element of the array
Allowed values:
1 <= X <= 100
- spec.sizingPolicies.cores
The policy applies for a specified range of the number of CPU cores.
- spec.sizingPolicies.cores.max
Required value
Maximum number of CPU cores.
Allowed values:
X <= 1024
Example:
max: 10
- spec.sizingPolicies.cores.min
Required value
Minimum number of CPU cores.
Allowed values:
1 <= X
Example:
min: 1
- spec.sizingPolicies.cores.step
Discretization step for the CPU core number. For example, the combination of
min=2
,max=10
, andstep=4
allows to set the number of virtual machine CPU cores to 2, 6, or 10.Allowed values:
1 <= X
Example:
step: 1
- spec.sizingPolicies.dedicatedCores
Allowed values of the
dedicatedCores
parameter. - spec.sizingPolicies.memory
Memory sizing policy.
- spec.sizingPolicies.memory.max
Maximum amount of memory.
Pattern:
^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
Example:
max: 8Gi
- spec.sizingPolicies.memory.min
Minimum amount of memory.
Pattern:
^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
Example:
min: 1Gi
- spec.sizingPolicies.memory.perCore
Amount of memory per CPU core.
- spec.sizingPolicies.memory.perCore.max
Maximum amount of memory.
Pattern:
^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
Example:
max: 8Gi
- spec.sizingPolicies.memory.perCore.min
Minimum amount of memory.
Pattern:
^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
Example:
min: 1Gi
- spec.sizingPolicies.memory.step
Memory size discretization step. For example, the combination of
min=2Gi,
max=4Giand
step=1Gi` allows to set the virtual machine memory size to 2Gi, 3Gi, or 4Gi.Pattern:
^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
Example:
step: 512Mi
- spec.tolerations
Tolerations are the same as
spec.tolerations
for pods. These tolerations will be merged with the tolerations specified in the VirtualMachine resource. VirtualMachine tolerations have a higher priority.The pod this Toleration is attached to tolerates any taint that matches the triple <key,value,effect> using the matching operator
. - spec.tolerations.effect
Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
- spec.tolerations.key
Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.
- spec.tolerations.operator
Operator represents a key’s relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.
- spec.tolerations.tolerationSeconds
TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.
- spec.tolerations.value
Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.