VirtualMachineClass
Scope: Cluster
Version: v1alpha2
VirtualMachineClass resource describes a 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 CPU model based on an intersection CPU features for selected nodes.
- spec.cpu.discovery.nodeSelector
A selection of nodes on the basis of which a universal CPU model will be created.
- 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
A list of CPU instructions (features) required when type=Features. More information about features here
Example:
features: - mmx - vmx - sse2
- spec.cpu.model
The name of CPU model. More information about models here
Example:
model: IvyBridge
- spec.cpu.type
Required value
CPUType defines cpu type, the following options are supported:
Host
- a virtual CPU is used that is as close as possible to the platform node’s CPU in terms of instruction set. 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 generations of processors, as their instruction set is different.HostPassthrough
- uses the physical CPU of the platform node directly without any modifications. When using this class, the guest VM can only be transferred to a target node that has a CPU that exactly matches the CPU of the source node.Discovery
- create a CPU model based on an intersecton CPU features for selected nodes.Model
- CPU model name. A CPU model is a named and previously defined set of supported CPU instructions.Features
- the required set of supported instructions for the CPU.
Allowed values:
Host
,HostPassthrough
,Discovery
,Model
,Features
- spec.nodeSelector
NodeSelector defines selects the nodes that are targeted to 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} 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.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 cpu core count.
Allowed values:
X <= 1024
Example:
max: 10
- spec.sizingPolicies.cores.min
Required value
Minimum cpu core count.
Allowed values:
1 <= X
Example:
min: 1
- spec.sizingPolicies.cores.step
Cpu cores count discretization step. I.e. min=2, max=10, step=4 allows to set 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. I.e. min=2Gi, max=4Gi, step=1Gi allows to set 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
in the Pod. These tolerations will be merged with tolerations specified in VirtualMachine resource. VirtualMachine tolerations have 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.