1 /* 2 * This file is part of the KubeVirt project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 * Copyright 2023 Red Hat, Inc. 17 * 18 */ 19 20 package v1beta1 21 22 import ( 23 "k8s.io/apimachinery/pkg/api/resource" 24 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 25 26 v1 "kubevirt.io/api/core/v1" 27 ) 28 29 // VirtualMachineInstancetype resource contains quantitative and resource related VirtualMachine configuration 30 // that can be used by multiple VirtualMachine resources. 31 // 32 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 33 // +genclient 34 type VirtualMachineInstancetype struct { 35 metav1.TypeMeta `json:",inline"` 36 metav1.ObjectMeta `json:"metadata,omitempty"` 37 38 // Required spec describing the instancetype 39 Spec VirtualMachineInstancetypeSpec `json:"spec"` 40 } 41 42 // VirtualMachineInstancetypeList is a list of VirtualMachineInstancetype resources. 43 // 44 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 45 type VirtualMachineInstancetypeList struct { 46 metav1.TypeMeta `json:",inline"` 47 metav1.ListMeta `json:"metadata,omitempty"` 48 Items []VirtualMachineInstancetype `json:"items"` 49 } 50 51 // VirtualMachineClusterInstancetype is a cluster scoped version of VirtualMachineInstancetype resource. 52 // 53 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 54 // +genclient 55 // +genclient:nonNamespaced 56 type VirtualMachineClusterInstancetype struct { 57 metav1.TypeMeta `json:",inline"` 58 metav1.ObjectMeta `json:"metadata,omitempty"` 59 60 // Required spec describing the instancetype 61 Spec VirtualMachineInstancetypeSpec `json:"spec"` 62 } 63 64 // VirtualMachineClusterInstancetypeList is a list of VirtualMachineClusterInstancetype resources. 65 // 66 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 67 type VirtualMachineClusterInstancetypeList struct { 68 metav1.TypeMeta `json:",inline"` 69 metav1.ListMeta `json:"metadata,omitempty"` 70 Items []VirtualMachineClusterInstancetype `json:"items"` 71 } 72 73 // VirtualMachineInstancetypeSpec is a description of the VirtualMachineInstancetype or VirtualMachineClusterInstancetype. 74 // 75 // CPU and Memory are required attributes with both requiring that their Guest attribute is defined, ensuring a number of vCPUs and amount of RAM is always provided by each instancetype. 76 type VirtualMachineInstancetypeSpec struct { 77 // NodeSelector is a selector which must be true for the vmi to fit on a node. 78 // Selector which must match a node's labels for the vmi to be scheduled on that node. 79 // More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ 80 // 81 // NodeSelector is the name of the custom node selector for the instancetype. 82 // +optional 83 NodeSelector map[string]string `json:"nodeSelector,omitempty"` 84 85 // If specified, the VMI will be dispatched by specified scheduler. 86 // If not specified, the VMI will be dispatched by default scheduler. 87 // 88 // SchedulerName is the name of the custom K8s scheduler for the instancetype. 89 // +optional 90 SchedulerName string `json:"schedulerName,omitempty"` 91 92 // Required CPU related attributes of the instancetype. 93 CPU CPUInstancetype `json:"cpu"` 94 95 // Required Memory related attributes of the instancetype. 96 Memory MemoryInstancetype `json:"memory"` 97 98 // Optionally defines any GPU devices associated with the instancetype. 99 // 100 // +optional 101 // +listType=atomic 102 GPUs []v1.GPU `json:"gpus,omitempty"` 103 104 // Optionally defines any HostDevices associated with the instancetype. 105 // 106 // +optional 107 // +listType=atomic 108 HostDevices []v1.HostDevice `json:"hostDevices,omitempty"` 109 110 // Optionally defines the IOThreadsPolicy to be used by the instancetype. 111 // 112 // +optional 113 IOThreadsPolicy *v1.IOThreadsPolicy `json:"ioThreadsPolicy,omitempty"` 114 115 // Optionally defines the LaunchSecurity to be used by the instancetype. 116 // 117 // +optional 118 LaunchSecurity *v1.LaunchSecurity `json:"launchSecurity,omitempty"` 119 120 // Optionally defines the required Annotations to be used by the instance type and applied to the VirtualMachineInstance 121 // 122 // +optional 123 Annotations map[string]string `json:"annotations,omitempty"` 124 } 125 126 // CPUInstancetype contains the CPU related configuration of a given VirtualMachineInstancetypeSpec. 127 // 128 // Guest is a required attribute and defines the number of vCPUs to be exposed to the guest by the instancetype. 129 type CPUInstancetype struct { 130 131 // Required number of vCPUs to expose to the guest. 132 // 133 // The resulting CPU topology being derived from the optional PreferredCPUTopology attribute of CPUPreferences that itself defaults to PreferSockets. 134 Guest uint32 `json:"guest"` 135 136 // Model specifies the CPU model inside the VMI. 137 // List of available models https://github.com/libvirt/libvirt/tree/master/src/cpu_map. 138 // It is possible to specify special cases like "host-passthrough" to get the same CPU as the node 139 // and "host-model" to get CPU closest to the node one. 140 // Defaults to host-model. 141 // +optional 142 Model *string `json:"model,omitempty"` 143 144 // DedicatedCPUPlacement requests the scheduler to place the VirtualMachineInstance on a node 145 // with enough dedicated pCPUs and pin the vCPUs to it. 146 // +optional 147 DedicatedCPUPlacement *bool `json:"dedicatedCPUPlacement,omitempty"` 148 149 // NUMA allows specifying settings for the guest NUMA topology 150 // +optional 151 NUMA *v1.NUMA `json:"numa,omitempty"` 152 153 // IsolateEmulatorThread requests one more dedicated pCPU to be allocated for the VMI to place 154 // the emulator thread on it. 155 // +optional 156 IsolateEmulatorThread *bool `json:"isolateEmulatorThread,omitempty"` 157 158 // Realtime instructs the virt-launcher to tune the VMI for lower latency, optional for real time workloads 159 // +optional 160 Realtime *v1.Realtime `json:"realtime,omitempty"` 161 162 // MaxSockets specifies the maximum amount of sockets that can be hotplugged 163 // +optional 164 MaxSockets *uint32 `json:"maxSockets,omitempty"` 165 } 166 167 // MemoryInstancetype contains the Memory related configuration of a given VirtualMachineInstancetypeSpec. 168 // 169 // Guest is a required attribute and defines the amount of RAM to be exposed to the guest by the instancetype. 170 type MemoryInstancetype struct { 171 172 // Required amount of memory which is visible inside the guest OS. 173 Guest resource.Quantity `json:"guest"` 174 175 // Optionally enables the use of hugepages for the VirtualMachineInstance instead of regular memory. 176 // +optional 177 Hugepages *v1.Hugepages `json:"hugepages,omitempty"` 178 // OvercommitPercent is the percentage of the guest memory which will be overcommitted. 179 // This means that the VMIs parent pod (virt-launcher) will request less 180 // physical memory by a factor specified by the OvercommitPercent. 181 // Overcommits can lead to memory exhaustion, which in turn can lead to crashes. Use carefully. 182 // Defaults to 0 183 // +optional 184 // +kubebuilder:validation:Maximum=100 185 // +kubebuilder:validation:Minimum=0 186 OvercommitPercent int `json:"overcommitPercent,omitempty"` 187 188 // MaxGuest allows to specify the maximum amount of memory which is visible inside the Guest OS. 189 // The delta between MaxGuest and Guest is the amount of memory that can be hot(un)plugged. 190 // +optional 191 MaxGuest *resource.Quantity `json:"maxGuest,omitempty"` 192 } 193 194 // VirtualMachinePreference resource contains optional preferences related to the VirtualMachine. 195 // 196 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 197 // +genclient 198 type VirtualMachinePreference struct { 199 metav1.TypeMeta `json:",inline"` 200 metav1.ObjectMeta `json:"metadata,omitempty"` 201 202 // Required spec describing the preferences 203 Spec VirtualMachinePreferenceSpec `json:"spec"` 204 } 205 206 // VirtualMachinePreferenceList is a list of VirtualMachinePreference resources. 207 // 208 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 209 type VirtualMachinePreferenceList struct { 210 metav1.TypeMeta `json:",inline"` 211 metav1.ListMeta `json:"metadata,omitempty"` 212 // +listType=set 213 Items []VirtualMachinePreference `json:"items"` 214 } 215 216 // VirtualMachineClusterPreference is a cluster scoped version of the VirtualMachinePreference resource. 217 // 218 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 219 // +genclient 220 // +genclient:nonNamespaced 221 type VirtualMachineClusterPreference struct { 222 metav1.TypeMeta `json:",inline"` 223 metav1.ObjectMeta `json:"metadata,omitempty"` 224 225 // Required spec describing the preferences 226 Spec VirtualMachinePreferenceSpec `json:"spec"` 227 } 228 229 // VirtualMachineClusterPreferenceList is a list of VirtualMachineClusterPreference resources. 230 // 231 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 232 type VirtualMachineClusterPreferenceList struct { 233 metav1.TypeMeta `json:",inline"` 234 metav1.ListMeta `json:"metadata,omitempty"` 235 // +listType=set 236 Items []VirtualMachineClusterPreference `json:"items"` 237 } 238 239 // VirtualMachinePreferenceSpec is a description of the VirtualMachinePreference or VirtualMachineClusterPreference. 240 type VirtualMachinePreferenceSpec struct { 241 242 // Clock optionally defines preferences associated with the Clock attribute of a VirtualMachineInstance DomainSpec 243 // 244 //+optional 245 Clock *ClockPreferences `json:"clock,omitempty"` 246 247 // CPU optionally defines preferences associated with the CPU attribute of a VirtualMachineInstance DomainSpec 248 // 249 //+optional 250 CPU *CPUPreferences `json:"cpu,omitempty"` 251 252 // Devices optionally defines preferences associated with the Devices attribute of a VirtualMachineInstance DomainSpec 253 // 254 //+optional 255 Devices *DevicePreferences `json:"devices,omitempty"` 256 257 // Features optionally defines preferences associated with the Features attribute of a VirtualMachineInstance DomainSpec 258 // 259 //+optional 260 Features *FeaturePreferences `json:"features,omitempty"` 261 262 // Firmware optionally defines preferences associated with the Firmware attribute of a VirtualMachineInstance DomainSpec 263 // 264 //+optional 265 Firmware *FirmwarePreferences `json:"firmware,omitempty"` 266 267 // Machine optionally defines preferences associated with the Machine attribute of a VirtualMachineInstance DomainSpec 268 // 269 //+optional 270 Machine *MachinePreferences `json:"machine,omitempty"` 271 272 // Volumes optionally defines preferences associated with the Volumes attribute of a VirtualMachineInstace DomainSpec 273 // 274 //+optional 275 Volumes *VolumePreferences `json:"volumes,omitempty"` 276 277 // Subdomain of the VirtualMachineInstance 278 // 279 //+optional 280 PreferredSubdomain *string `json:"preferredSubdomain,omitempty"` 281 282 // Grace period observed after signalling a VirtualMachineInstance to stop after which the VirtualMachineInstance is force terminated. 283 // 284 //+optional 285 PreferredTerminationGracePeriodSeconds *int64 `json:"preferredTerminationGracePeriodSeconds,omitempty"` 286 287 // Requirements defines the minium amount of instance type defined resources required by a set of preferences 288 // 289 //+optional 290 Requirements *PreferenceRequirements `json:"requirements,omitempty"` 291 292 // Optionally defines preferred Annotations to be applied to the VirtualMachineInstance 293 // 294 //+optional 295 Annotations map[string]string `json:"annotations,omitempty"` 296 297 // PreferSpreadSocketToCoreRatio defines the ratio to spread vCPUs between cores and sockets, it defaults to 2. 298 // 299 //+optional 300 PreferSpreadSocketToCoreRatio uint32 `json:"preferSpreadSocketToCoreRatio,omitempty"` 301 } 302 303 type VolumePreferences struct { 304 305 // PreffereedStorageClassName optionally defines the preferred storageClass 306 // 307 //+optional 308 PreferredStorageClassName string `json:"preferredStorageClassName,omitempty"` 309 } 310 311 // PreferredCPUTopology defines a preferred CPU topology to be exposed to the guest 312 type PreferredCPUTopology string 313 314 const ( 315 // Prefer vCPUs to be exposed as cores to the guest 316 DeprecatedPreferCores PreferredCPUTopology = "preferCores" 317 318 // Prefer vCPUs to be exposed as sockets to the guest, this is the default for the PreferredCPUTopology attribute of CPUPreferences. 319 DeprecatedPreferSockets PreferredCPUTopology = "preferSockets" 320 321 // Prefer vCPUs to be exposed as threads to the guest 322 DeprecatedPreferThreads PreferredCPUTopology = "preferThreads" 323 324 // Prefer vCPUs to be spread evenly between cores and sockets with any remaining vCPUs being presented as cores 325 DeprecatedPreferSpread PreferredCPUTopology = "preferSpread" 326 327 // Prefer vCPUs to be spread according to VirtualMachineInstanceTemplateSpec 328 // 329 // If used with VirtualMachineInstanceType it will use sockets as default 330 DeprecatedPreferAny PreferredCPUTopology = "preferAny" 331 332 // Prefer vCPUs to be exposed as cores to the guest 333 Cores PreferredCPUTopology = "cores" 334 335 // Prefer vCPUs to be exposed as sockets to the guest, this is the default for the PreferredCPUTopology attribute of CPUPreferences. 336 Sockets PreferredCPUTopology = "sockets" 337 338 // Prefer vCPUs to be exposed as threads to the guest 339 Threads PreferredCPUTopology = "threads" 340 341 // Prefer vCPUs to be spread evenly between cores and sockets with any remaining vCPUs being presented as cores 342 Spread PreferredCPUTopology = "spread" 343 344 // Prefer vCPUs to be spread according to VirtualMachineInstanceTemplateSpec 345 // 346 // If used with VirtualMachineInstanceType it will use sockets as default 347 Any PreferredCPUTopology = "any" 348 ) 349 350 // CPUPreferences contains various optional CPU preferences. 351 type CPUPreferences struct { 352 353 // PreferredCPUTopology optionally defines the preferred guest visible CPU topology, defaults to PreferSockets. 354 // 355 //+optional 356 PreferredCPUTopology *PreferredCPUTopology `json:"preferredCPUTopology,omitempty"` 357 358 // 359 //+optional 360 SpreadOptions *SpreadOptions `json:"spreadOptions,omitempty"` 361 362 // PreferredCPUFeatures optionally defines a slice of preferred CPU features. 363 // 364 //+optional 365 PreferredCPUFeatures []v1.CPUFeature `json:"preferredCPUFeatures,omitempty"` 366 } 367 368 type SpreadAcross string 369 370 const ( 371 // Spread vCPUs across sockets, cores and threads 372 SpreadAcrossSocketsCoresThreads SpreadAcross = "SocketsCoresThreads" 373 374 // Spread vCPUs across sockets and cores 375 SpreadAcrossSocketsCores SpreadAcross = "SocketsCores" 376 377 // Spread vCPUs across cores and threads 378 SpreadAcrossCoresThreads SpreadAcross = "CoresThreads" 379 ) 380 381 type SpreadOptions struct { 382 // Across optionally defines how to spread vCPUs across the guest visible topology. 383 // Default: SocketsCores 384 // 385 //+optional 386 Across *SpreadAcross `json:"across,omitempty"` 387 388 // Ratio optionally defines the ratio to spread vCPUs across the guest visible topology: 389 // 390 // CoresThreads - 1:2 - Controls the ratio of cores to threads. Only a ratio of 2 is currently accepted. 391 // SocketsCores - 1:N - Controls the ratio of socket to cores. 392 // SocketsCoresThreads - 1:N:2 - Controls the ratio of socket to cores. Each core providing 2 threads. 393 // 394 // Default: 2 395 // 396 //+optional 397 Ratio *uint32 `json:"ratio,omitempty"` 398 } 399 400 // DevicePreferences contains various optional Device preferences. 401 type DevicePreferences struct { 402 403 // PreferredAutoattachGraphicsDevice optionally defines the preferred value of AutoattachGraphicsDevice 404 // 405 // +optional 406 PreferredAutoattachGraphicsDevice *bool `json:"preferredAutoattachGraphicsDevice,omitempty"` 407 408 // PreferredAutoattachMemBalloon optionally defines the preferred value of AutoattachMemBalloon 409 // 410 // +optional 411 PreferredAutoattachMemBalloon *bool `json:"preferredAutoattachMemBalloon,omitempty"` 412 413 // PreferredAutoattachPodInterface optionally defines the preferred value of AutoattachPodInterface 414 // 415 // +optional 416 PreferredAutoattachPodInterface *bool `json:"preferredAutoattachPodInterface,omitempty"` 417 418 // PreferredAutoattachSerialConsole optionally defines the preferred value of AutoattachSerialConsole 419 // 420 // +optional 421 PreferredAutoattachSerialConsole *bool `json:"preferredAutoattachSerialConsole,omitempty"` 422 423 // PreferredAutoattachInputDevice optionally defines the preferred value of AutoattachInputDevice 424 // 425 // +optional 426 PreferredAutoattachInputDevice *bool `json:"preferredAutoattachInputDevice,omitempty"` 427 428 // PreferredDisableHotplug optionally defines the preferred value of DisableHotplug 429 // 430 // +optional 431 PreferredDisableHotplug *bool `json:"preferredDisableHotplug,omitempty"` 432 433 // PreferredVirtualGPUOptions optionally defines the preferred value of VirtualGPUOptions 434 // 435 // +optional 436 PreferredVirtualGPUOptions *v1.VGPUOptions `json:"preferredVirtualGPUOptions,omitempty"` 437 438 // PreferredSoundModel optionally defines the preferred model for Sound devices. 439 // 440 // +optional 441 PreferredSoundModel string `json:"preferredSoundModel,omitempty"` 442 443 // PreferredUseVirtioTransitional optionally defines the preferred value of UseVirtioTransitional 444 // 445 // +optional 446 PreferredUseVirtioTransitional *bool `json:"preferredUseVirtioTransitional,omitempty"` 447 448 // PreferredInputBus optionally defines the preferred bus for Input devices. 449 // 450 // +optional 451 PreferredInputBus v1.InputBus `json:"preferredInputBus,omitempty"` 452 453 // PreferredInputType optionally defines the preferred type for Input devices. 454 // 455 // +optional 456 PreferredInputType v1.InputType `json:"preferredInputType,omitempty"` 457 458 // PreferredDiskBus optionally defines the preferred bus for Disk Disk devices. 459 // 460 // +optional 461 PreferredDiskBus v1.DiskBus `json:"preferredDiskBus,omitempty"` 462 463 // PreferredLunBus optionally defines the preferred bus for Lun Disk devices. 464 // 465 // +optional 466 PreferredLunBus v1.DiskBus `json:"preferredLunBus,omitempty"` 467 468 // PreferredCdromBus optionally defines the preferred bus for Cdrom Disk devices. 469 // 470 // +optional 471 PreferredCdromBus v1.DiskBus `json:"preferredCdromBus,omitempty"` 472 473 // PreferredDedicatedIoThread optionally enables dedicated IO threads for Disk devices using the virtio bus. 474 // 475 // +optional 476 PreferredDiskDedicatedIoThread *bool `json:"preferredDiskDedicatedIoThread,omitempty"` 477 478 // PreferredCache optionally defines the DriverCache to be used by Disk devices. 479 // 480 // +optional 481 PreferredDiskCache v1.DriverCache `json:"preferredDiskCache,omitempty"` 482 483 // PreferredIo optionally defines the QEMU disk IO mode to be used by Disk devices. 484 // 485 // +optional 486 PreferredDiskIO v1.DriverIO `json:"preferredDiskIO,omitempty"` 487 488 // PreferredBlockSize optionally defines the block size of Disk devices. 489 // 490 // +optional 491 PreferredDiskBlockSize *v1.BlockSize `json:"preferredDiskBlockSize,omitempty"` 492 493 // PreferredInterfaceModel optionally defines the preferred model to be used by Interface devices. 494 // 495 // +optional 496 PreferredInterfaceModel string `json:"preferredInterfaceModel,omitempty"` 497 498 // PreferredRng optionally defines the preferred rng device to be used. 499 // 500 // +optional 501 PreferredRng *v1.Rng `json:"preferredRng,omitempty"` 502 503 // PreferredBlockMultiQueue optionally enables the vhost multiqueue feature for virtio disks. 504 // 505 // +optional 506 PreferredBlockMultiQueue *bool `json:"preferredBlockMultiQueue,omitempty"` 507 508 // PreferredNetworkInterfaceMultiQueue optionally enables the vhost multiqueue feature for virtio interfaces. 509 // 510 // +optional 511 PreferredNetworkInterfaceMultiQueue *bool `json:"preferredNetworkInterfaceMultiQueue,omitempty"` 512 513 // PreferredTPM optionally defines the preferred TPM device to be used. 514 // 515 // +optional 516 PreferredTPM *v1.TPMDevice `json:"preferredTPM,omitempty"` 517 518 // PreferredInterfaceMasquerade optionally defines the preferred masquerade configuration to use with each network interface. 519 // 520 // +optional 521 PreferredInterfaceMasquerade *v1.InterfaceMasquerade `json:"preferredInterfaceMasquerade,omitempty"` 522 } 523 524 // FeaturePreferences contains various optional defaults for Features. 525 type FeaturePreferences struct { 526 527 // PreferredAcpi optionally enables the ACPI feature 528 // 529 // +optional 530 PreferredAcpi *v1.FeatureState `json:"preferredAcpi,omitempty"` 531 532 // PreferredApic optionally enables and configures the APIC feature 533 // 534 // +optional 535 PreferredApic *v1.FeatureAPIC `json:"preferredApic,omitempty"` 536 537 // PreferredHyperv optionally enables and configures HyperV features 538 // 539 // +optional 540 PreferredHyperv *v1.FeatureHyperv `json:"preferredHyperv,omitempty"` 541 542 // PreferredKvm optionally enables and configures KVM features 543 // 544 // +optional 545 PreferredKvm *v1.FeatureKVM `json:"preferredKvm,omitempty"` 546 547 // PreferredPvspinlock optionally enables the Pvspinlock feature 548 // 549 // +optional 550 PreferredPvspinlock *v1.FeatureState `json:"preferredPvspinlock,omitempty"` 551 552 // PreferredSmm optionally enables the SMM feature 553 // 554 // +optional 555 PreferredSmm *v1.FeatureState `json:"preferredSmm,omitempty"` 556 } 557 558 // FirmwarePreferences contains various optional defaults for Firmware. 559 type FirmwarePreferences struct { 560 561 // PreferredUseBios optionally enables BIOS 562 // 563 // +optional 564 PreferredUseBios *bool `json:"preferredUseBios,omitempty"` 565 566 // PreferredUseBiosSerial optionally transmitts BIOS output over the serial. 567 // 568 // Requires PreferredUseBios to be enabled. 569 // 570 // +optional 571 PreferredUseBiosSerial *bool `json:"preferredUseBiosSerial,omitempty"` 572 573 // PreferredUseEfi optionally enables EFI 574 // 575 // +optional 576 PreferredUseEfi *bool `json:"preferredUseEfi,omitempty"` 577 578 // PreferredUseSecureBoot optionally enables SecureBoot and the OVMF roms will be swapped for SecureBoot-enabled ones. 579 // 580 // Requires PreferredUseEfi and PreferredSmm to be enabled. 581 // 582 // +optional 583 PreferredUseSecureBoot *bool `json:"preferredUseSecureBoot,omitempty"` 584 585 // PreferredEfi optionally enables EFI 586 // 587 // +optional 588 PreferredEfi *v1.EFI `json:"preferredEfi,omitempty"` 589 } 590 591 // MachinePreferences contains various optional defaults for Machine. 592 type MachinePreferences struct { 593 594 // PreferredMachineType optionally defines the preferred machine type to use. 595 // 596 // +optional 597 PreferredMachineType string `json:"preferredMachineType,omitempty"` 598 } 599 600 // ClockPreferences contains various optional defaults for Clock. 601 type ClockPreferences struct { 602 603 // ClockOffset allows specifying the UTC offset or the timezone of the guest clock. 604 // 605 // +optional 606 PreferredClockOffset *v1.ClockOffset `json:"preferredClockOffset,omitempty"` 607 608 // Timer specifies whih timers are attached to the vmi. 609 // 610 // +optional 611 PreferredTimer *v1.Timer `json:"preferredTimer,omitempty"` 612 } 613 614 type PreferenceRequirements struct { 615 616 // Required CPU related attributes of the instancetype. 617 // 618 //+optional 619 CPU *CPUPreferenceRequirement `json:"cpu,omitempty"` 620 621 // Required Memory related attributes of the instancetype. 622 // 623 //+optional 624 Memory *MemoryPreferenceRequirement `json:"memory,omitempty"` 625 } 626 627 type CPUPreferenceRequirement struct { 628 629 // Minimal number of vCPUs required by the preference. 630 Guest uint32 `json:"guest"` 631 } 632 633 type MemoryPreferenceRequirement struct { 634 635 // Minimal amount of memory required by the preference. 636 Guest resource.Quantity `json:"guest"` 637 } 638