diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index d7ffeb21132d..7516a29cb4f7 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -1346,13 +1346,13 @@ } } }, - "/apis/instancetype.kubevirt.io/v1alpha1/": { + "/apis/instancetype.kubevirt.io/v1alpha2/": { "get": { "description": "Get KubeVirt API Resources", "produces": [ "application/json" ], - "operationId": "getAPIResources-instancetype.kubevirt.io-v1alpha1", + "operationId": "getAPIResources-instancetype.kubevirt.io-v1alpha2", "responses": { "200": { "description": "OK", @@ -1372,7 +1372,7 @@ } } }, - "/apis/instancetype.kubevirt.io/v1alpha1/namespaces/{namespace:[a-z0-9][a-z0-9\\-]*}/virtualmachineinstancetypes": { + "/apis/instancetype.kubevirt.io/v1alpha2/namespaces/{namespace:[a-z0-9][a-z0-9\\-]*}/virtualmachineinstancetypes": { "get": { "description": "Get a list of VirtualMachineInstancetype objects.", "produces": [ @@ -1451,7 +1451,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineInstancetypeList" + "$ref": "#/definitions/v1alpha2.VirtualMachineInstancetypeList" } }, "401": { @@ -1479,7 +1479,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineInstancetype" } }, { @@ -1495,19 +1495,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineInstancetype" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineInstancetype" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineInstancetype" } }, "401": { @@ -1599,7 +1599,7 @@ } } }, - "/apis/instancetype.kubevirt.io/v1alpha1/namespaces/{namespace:[a-z0-9][a-z0-9\\-]*}/virtualmachineinstancetypes/{name:[a-z0-9][a-z0-9\\-]*}": { + "/apis/instancetype.kubevirt.io/v1alpha2/namespaces/{namespace:[a-z0-9][a-z0-9\\-]*}/virtualmachineinstancetypes/{name:[a-z0-9][a-z0-9\\-]*}": { "get": { "description": "Get a VirtualMachineInstancetype object.", "produces": [ @@ -1628,7 +1628,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineInstancetype" } }, "401": { @@ -1656,7 +1656,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineInstancetype" } } ], @@ -1664,13 +1664,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineInstancetype" } }, "201": { "description": "Create", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineInstancetype" } }, "401": { @@ -1762,7 +1762,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineInstancetype" } }, "401": { @@ -1792,7 +1792,7 @@ } ] }, - "/apis/instancetype.kubevirt.io/v1alpha1/namespaces/{namespace:[a-z0-9][a-z0-9\\-]*}/virtualmachinepreferences": { + "/apis/instancetype.kubevirt.io/v1alpha2/namespaces/{namespace:[a-z0-9][a-z0-9\\-]*}/virtualmachinepreferences": { "get": { "description": "Get a list of VirtualMachinePreference objects.", "produces": [ @@ -1871,7 +1871,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachinePreferenceList" + "$ref": "#/definitions/v1alpha2.VirtualMachinePreferenceList" } }, "401": { @@ -1899,7 +1899,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachinePreference" + "$ref": "#/definitions/v1alpha2.VirtualMachinePreference" } }, { @@ -1915,19 +1915,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachinePreference" + "$ref": "#/definitions/v1alpha2.VirtualMachinePreference" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachinePreference" + "$ref": "#/definitions/v1alpha2.VirtualMachinePreference" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachinePreference" + "$ref": "#/definitions/v1alpha2.VirtualMachinePreference" } }, "401": { @@ -2019,7 +2019,7 @@ } } }, - "/apis/instancetype.kubevirt.io/v1alpha1/namespaces/{namespace:[a-z0-9][a-z0-9\\-]*}/virtualmachinepreferences/{name:[a-z0-9][a-z0-9\\-]*}": { + "/apis/instancetype.kubevirt.io/v1alpha2/namespaces/{namespace:[a-z0-9][a-z0-9\\-]*}/virtualmachinepreferences/{name:[a-z0-9][a-z0-9\\-]*}": { "get": { "description": "Get a VirtualMachinePreference object.", "produces": [ @@ -2048,7 +2048,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachinePreference" + "$ref": "#/definitions/v1alpha2.VirtualMachinePreference" } }, "401": { @@ -2076,7 +2076,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachinePreference" + "$ref": "#/definitions/v1alpha2.VirtualMachinePreference" } } ], @@ -2084,13 +2084,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachinePreference" + "$ref": "#/definitions/v1alpha2.VirtualMachinePreference" } }, "201": { "description": "Create", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachinePreference" + "$ref": "#/definitions/v1alpha2.VirtualMachinePreference" } }, "401": { @@ -2182,7 +2182,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachinePreference" + "$ref": "#/definitions/v1alpha2.VirtualMachinePreference" } }, "401": { @@ -2212,7 +2212,7 @@ } ] }, - "/apis/instancetype.kubevirt.io/v1alpha1/virtualmachineclusterinstancetypes": { + "/apis/instancetype.kubevirt.io/v1alpha2/virtualmachineclusterinstancetypes": { "get": { "description": "Get a list of VirtualMachineClusterInstancetype objects.", "produces": [ @@ -2283,7 +2283,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterInstancetypeList" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterInstancetypeList" } }, "401": { @@ -2311,7 +2311,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterInstancetype" } } ], @@ -2319,19 +2319,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterInstancetype" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterInstancetype" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterInstancetype" } }, "401": { @@ -2423,7 +2423,7 @@ } } }, - "/apis/instancetype.kubevirt.io/v1alpha1/virtualmachineclusterinstancetypes/{name:[a-z0-9][a-z0-9\\-]*}": { + "/apis/instancetype.kubevirt.io/v1alpha2/virtualmachineclusterinstancetypes/{name:[a-z0-9][a-z0-9\\-]*}": { "get": { "description": "Get a VirtualMachineClusterInstancetype object.", "produces": [ @@ -2452,7 +2452,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterInstancetype" } }, "401": { @@ -2480,7 +2480,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterInstancetype" } } ], @@ -2488,13 +2488,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterInstancetype" } }, "201": { "description": "Create", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterInstancetype" } }, "401": { @@ -2586,7 +2586,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterInstancetype" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterInstancetype" } }, "401": { @@ -2608,7 +2608,7 @@ } ] }, - "/apis/instancetype.kubevirt.io/v1alpha1/virtualmachineclusterpreferences": { + "/apis/instancetype.kubevirt.io/v1alpha2/virtualmachineclusterpreferences": { "get": { "description": "Get a list of VirtualMachineClusterPreference objects.", "produces": [ @@ -2679,7 +2679,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterPreferenceList" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterPreferenceList" } }, "401": { @@ -2707,7 +2707,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterPreference" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterPreference" } } ], @@ -2715,19 +2715,19 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterPreference" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterPreference" } }, "201": { "description": "Created", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterPreference" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterPreference" } }, "202": { "description": "Accepted", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterPreference" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterPreference" } }, "401": { @@ -2819,7 +2819,7 @@ } } }, - "/apis/instancetype.kubevirt.io/v1alpha1/virtualmachineclusterpreferences/{name:[a-z0-9][a-z0-9\\-]*}": { + "/apis/instancetype.kubevirt.io/v1alpha2/virtualmachineclusterpreferences/{name:[a-z0-9][a-z0-9\\-]*}": { "get": { "description": "Get a VirtualMachineClusterPreference object.", "produces": [ @@ -2848,7 +2848,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterPreference" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterPreference" } }, "401": { @@ -2876,7 +2876,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterPreference" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterPreference" } } ], @@ -2884,13 +2884,13 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterPreference" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterPreference" } }, "201": { "description": "Create", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterPreference" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterPreference" } }, "401": { @@ -2982,7 +2982,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterPreference" + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterPreference" } }, "401": { @@ -3004,7 +3004,7 @@ } ] }, - "/apis/instancetype.kubevirt.io/v1alpha1/virtualmachineinstancetypes": { + "/apis/instancetype.kubevirt.io/v1alpha2/virtualmachineinstancetypes": { "get": { "description": "Get a list of all VirtualMachineInstancetype objects.", "produces": [ @@ -3017,7 +3017,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachineInstancetypeList" + "$ref": "#/definitions/v1alpha2.VirtualMachineInstancetypeList" } }, "401": { @@ -3087,7 +3087,7 @@ } ] }, - "/apis/instancetype.kubevirt.io/v1alpha1/virtualmachinepreferences": { + "/apis/instancetype.kubevirt.io/v1alpha2/virtualmachinepreferences": { "get": { "description": "Get a list of all VirtualMachinePreference objects.", "produces": [ @@ -3100,7 +3100,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1alpha1.VirtualMachinePreferenceList" + "$ref": "#/definitions/v1alpha2.VirtualMachinePreferenceList" } }, "401": { @@ -3170,7 +3170,7 @@ } ] }, - "/apis/instancetype.kubevirt.io/v1alpha1/watch/namespaces/{namespace:[a-z0-9][a-z0-9\\-]*}/virtualmachineinstancetypes": { + "/apis/instancetype.kubevirt.io/v1alpha2/watch/namespaces/{namespace:[a-z0-9][a-z0-9\\-]*}/virtualmachineinstancetypes": { "get": { "description": "Watch a VirtualMachineInstancetype object.", "produces": [ @@ -3259,7 +3259,7 @@ } ] }, - "/apis/instancetype.kubevirt.io/v1alpha1/watch/namespaces/{namespace:[a-z0-9][a-z0-9\\-]*}/virtualmachinepreferences": { + "/apis/instancetype.kubevirt.io/v1alpha2/watch/namespaces/{namespace:[a-z0-9][a-z0-9\\-]*}/virtualmachinepreferences": { "get": { "description": "Watch a VirtualMachinePreference object.", "produces": [ @@ -3348,7 +3348,7 @@ } ] }, - "/apis/instancetype.kubevirt.io/v1alpha1/watch/virtualmachineclusterinstancetypes": { + "/apis/instancetype.kubevirt.io/v1alpha2/watch/virtualmachineclusterinstancetypes": { "get": { "description": "Watch a VirtualMachineClusterInstancetypeList object.", "produces": [ @@ -3429,7 +3429,7 @@ } ] }, - "/apis/instancetype.kubevirt.io/v1alpha1/watch/virtualmachineclusterpreferences": { + "/apis/instancetype.kubevirt.io/v1alpha2/watch/virtualmachineclusterpreferences": { "get": { "description": "Watch a VirtualMachineClusterPreferenceList object.", "produces": [ @@ -3510,7 +3510,7 @@ } ] }, - "/apis/instancetype.kubevirt.io/v1alpha1/watch/virtualmachineinstancetypes": { + "/apis/instancetype.kubevirt.io/v1alpha2/watch/virtualmachineinstancetypes": { "get": { "description": "Watch a VirtualMachineInstancetypeList object.", "produces": [ @@ -3591,7 +3591,7 @@ } ] }, - "/apis/instancetype.kubevirt.io/v1alpha1/watch/virtualmachinepreferences": { + "/apis/instancetype.kubevirt.io/v1alpha2/watch/virtualmachinepreferences": { "get": { "description": "Watch a VirtualMachinePreferenceList object.", "produces": [ @@ -19470,64 +19470,6 @@ } } }, - "v1alpha1.CPUInstancetype": { - "description": "CPUInstancetype contains the CPU related configuration of a given VirtualMachineInstancetypeSpec.\n\nGuest is a required attribute and defines the number of vCPUs to be exposed to the guest by the instancetype.", - "type": "object", - "required": [ - "guest" - ], - "properties": { - "dedicatedCPUPlacement": { - "description": "DedicatedCPUPlacement requests the scheduler to place the VirtualMachineInstance on a node with enough dedicated pCPUs and pin the vCPUs to it.", - "type": "boolean" - }, - "guest": { - "description": "Required number of vCPUs to expose to the guest.\n\nThe resulting CPU topology being derived from the optional PreferredCPUTopology attribute of CPUPreferences that itself defaults to PreferCores.", - "type": "integer", - "format": "int64" - }, - "isolateEmulatorThread": { - "description": "IsolateEmulatorThread requests one more dedicated pCPU to be allocated for the VMI to place the emulator thread on it.", - "type": "boolean" - }, - "model": { - "description": "Model specifies the CPU model inside the VMI. List of available models https://github.com/libvirt/libvirt/tree/master/src/cpu_map. It is possible to specify special cases like \"host-passthrough\" to get the same CPU as the node and \"host-model\" to get CPU closest to the node one. Defaults to host-model.", - "type": "string" - }, - "numa": { - "description": "NUMA allows specifying settings for the guest NUMA topology", - "$ref": "#/definitions/v1.NUMA" - }, - "realtime": { - "description": "Realtime instructs the virt-launcher to tune the VMI for lower latency, optional for real time workloads", - "$ref": "#/definitions/v1.Realtime" - } - } - }, - "v1alpha1.CPUPreferences": { - "description": "CPUPreferences contains various optional CPU preferences.", - "type": "object", - "properties": { - "preferredCPUTopology": { - "description": "PreferredCPUTopology optionally defines the preferred guest visible CPU topology, defaults to PreferSockets.", - "type": "string" - } - } - }, - "v1alpha1.ClockPreferences": { - "description": "ClockPreferences contains various optional defaults for Clock.", - "type": "object", - "properties": { - "preferredClockOffset": { - "description": "ClockOffset allows specifying the UTC offset or the timezone of the guest clock.", - "$ref": "#/definitions/v1.ClockOffset" - }, - "preferredTimer": { - "description": "Timer specifies whih timers are attached to the vmi.", - "$ref": "#/definitions/v1.Timer" - } - } - }, "v1alpha1.Condition": { "description": "Condition defines conditions", "type": "object", @@ -19562,104 +19504,6 @@ } } }, - "v1alpha1.DevicePreferences": { - "description": "DevicePreferences contains various optional Device preferences.", - "type": "object", - "properties": { - "preferredAutoattachGraphicsDevice": { - "description": "PreferredAutoattachGraphicsDevice optionally defines the preferred value of AutoattachGraphicsDevice", - "type": "boolean" - }, - "preferredAutoattachInputDevice": { - "description": "PreferredAutoattachInputDevice optionally defines the preferred value of AutoattachInputDevice", - "type": "boolean" - }, - "preferredAutoattachMemBalloon": { - "description": "PreferredAutoattachMemBalloon optionally defines the preferred value of AutoattachMemBalloon", - "type": "boolean" - }, - "preferredAutoattachPodInterface": { - "description": "PreferredAutoattachPodInterface optionally defines the preferred value of AutoattachPodInterface", - "type": "boolean" - }, - "preferredAutoattachSerialConsole": { - "description": "PreferredAutoattachSerialConsole optionally defines the preferred value of AutoattachSerialConsole", - "type": "boolean" - }, - "preferredBlockMultiQueue": { - "description": "PreferredBlockMultiQueue optionally enables the vhost multiqueue feature for virtio disks.", - "type": "boolean" - }, - "preferredCdromBus": { - "description": "PreferredCdromBus optionally defines the preferred bus for Cdrom Disk devices.", - "type": "string" - }, - "preferredDisableHotplug": { - "description": "PreferredDisableHotplug optionally defines the preferred value of DisableHotplug", - "type": "boolean" - }, - "preferredDiskBlockSize": { - "description": "PreferredBlockSize optionally defines the block size of Disk devices.", - "$ref": "#/definitions/v1.BlockSize" - }, - "preferredDiskBus": { - "description": "PreferredDiskBus optionally defines the preferred bus for Disk Disk devices.", - "type": "string" - }, - "preferredDiskCache": { - "description": "PreferredCache optionally defines the DriverCache to be used by Disk devices.", - "type": "string" - }, - "preferredDiskDedicatedIoThread": { - "description": "PreferredDedicatedIoThread optionally enables dedicated IO threads for Disk devices.", - "type": "boolean" - }, - "preferredDiskIO": { - "description": "PreferredIo optionally defines the QEMU disk IO mode to be used by Disk devices.", - "type": "string" - }, - "preferredInputBus": { - "description": "PreferredInputBus optionally defines the preferred bus for Input devices.", - "type": "string" - }, - "preferredInputType": { - "description": "PreferredInputType optionally defines the preferred type for Input devices.", - "type": "string" - }, - "preferredInterfaceModel": { - "description": "PreferredInterfaceModel optionally defines the preferred model to be used by Interface devices.", - "type": "string" - }, - "preferredLunBus": { - "description": "PreferredLunBus optionally defines the preferred bus for Lun Disk devices.", - "type": "string" - }, - "preferredNetworkInterfaceMultiQueue": { - "description": "PreferredNetworkInterfaceMultiQueue optionally enables the vhost multiqueue feature for virtio interfaces.", - "type": "boolean" - }, - "preferredRng": { - "description": "PreferredRng optionally defines the preferred rng device to be used.", - "$ref": "#/definitions/v1.Rng" - }, - "preferredSoundModel": { - "description": "PreferredSoundModel optionally defines the preferred model for Sound devices.", - "type": "string" - }, - "preferredTPM": { - "description": "PreferredTPM optionally defines the preferred TPM device to be used.", - "$ref": "#/definitions/v1.TPMDevice" - }, - "preferredUseVirtioTransitional": { - "description": "PreferredUseVirtioTransitional optionally defines the preferred value of UseVirtioTransitional", - "type": "boolean" - }, - "preferredVirtualGPUOptions": { - "description": "PreferredVirtualGPUOptions optionally defines the preferred value of VirtualGPUOptions", - "$ref": "#/definitions/v1.VGPUOptions" - } - } - }, "v1alpha1.Error": { "description": "Error is the last error encountered during the snapshot/restore", "type": "object", @@ -19672,85 +19516,6 @@ } } }, - "v1alpha1.FeaturePreferences": { - "description": "FeaturePreferences contains various optional defaults for Features.", - "type": "object", - "properties": { - "preferredAcpi": { - "description": "PreferredAcpi optionally enables the ACPI feature", - "$ref": "#/definitions/v1.FeatureState" - }, - "preferredApic": { - "description": "PreferredApic optionally enables and configures the APIC feature", - "$ref": "#/definitions/v1.FeatureAPIC" - }, - "preferredHyperv": { - "description": "PreferredHyperv optionally enables and configures HyperV features", - "$ref": "#/definitions/v1.FeatureHyperv" - }, - "preferredKvm": { - "description": "PreferredKvm optionally enables and configures KVM features", - "$ref": "#/definitions/v1.FeatureKVM" - }, - "preferredPvspinlock": { - "description": "PreferredPvspinlock optionally enables the Pvspinlock feature", - "$ref": "#/definitions/v1.FeatureState" - }, - "preferredSmm": { - "description": "PreferredSmm optionally enables the SMM feature", - "$ref": "#/definitions/v1.FeatureState" - } - } - }, - "v1alpha1.FirmwarePreferences": { - "description": "FirmwarePreferences contains various optional defaults for Firmware.", - "type": "object", - "properties": { - "preferredUseBios": { - "description": "PreferredUseBios optionally enables BIOS", - "type": "boolean" - }, - "preferredUseBiosSerial": { - "description": "PreferredUseBiosSerial optionally transmitts BIOS output over the serial.\n\nRequires PreferredUseBios to be enabled.", - "type": "boolean" - }, - "preferredUseEfi": { - "description": "PreferredUseEfi optionally enables EFI", - "type": "boolean" - }, - "preferredUseSecureBoot": { - "description": "PreferredUseSecureBoot optionally enables SecureBoot and the OVMF roms will be swapped for SecureBoot-enabled ones.\n\nRequires PreferredUseEfi and PreferredSmm to be enabled.", - "type": "boolean" - } - } - }, - "v1alpha1.MachinePreferences": { - "description": "MachinePreferences contains various optional defaults for Machine.", - "type": "object", - "properties": { - "preferredMachineType": { - "description": "PreferredMachineType optionally defines the preferred machine type to use.", - "type": "string" - } - } - }, - "v1alpha1.MemoryInstancetype": { - "description": "MemoryInstancetype contains the Memory related configuration of a given VirtualMachineInstancetypeSpec.\n\nGuest is a required attribute and defines the amount of RAM to be exposed to the guest by the instancetype.", - "type": "object", - "required": [ - "guest" - ], - "properties": { - "guest": { - "description": "Required amount of memory which is visible inside the guest OS.", - "$ref": "#/definitions/k8s.io.apimachinery.pkg.api.resource.Quantity" - }, - "hugepages": { - "description": "Optionally enables the use of hugepages for the VirtualMachineInstance instead of regular memory.", - "$ref": "#/definitions/v1.Hugepages" - } - } - }, "v1alpha1.MigrationPolicy": { "description": "MigrationPolicy holds migration policy (i.e. configurations) to apply to a VM or group of VMs", "type": "object", @@ -20008,8 +19773,8 @@ } } }, - "v1alpha1.VirtualMachineClusterInstancetype": { - "description": "VirtualMachineClusterInstancetype is a cluster scoped version of VirtualMachineInstancetype resource.", + "v1alpha1.VirtualMachineExport": { + "description": "VirtualMachineExport defines the operation of exporting a VM source", "type": "object", "required": [ "spec" @@ -20027,127 +19792,26 @@ "$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta" }, "spec": { - "description": "Required spec describing the instancetype", - "$ref": "#/definitions/v1alpha1.VirtualMachineInstancetypeSpec" + "$ref": "#/definitions/v1alpha1.VirtualMachineExportSpec" + }, + "status": { + "$ref": "#/definitions/v1alpha1.VirtualMachineExportStatus" } } }, - "v1alpha1.VirtualMachineClusterInstancetypeList": { - "description": "VirtualMachineClusterInstancetypeList is a list of VirtualMachineClusterInstancetype resources.", + "v1alpha1.VirtualMachineExportLink": { + "description": "VirtualMachineExportLink contains a list of volumes available for export, as well as the URLs to obtain these volumes", "type": "object", "required": [ - "items" + "cert" ], "properties": { - "apiVersion": { - "description": "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", + "cert": { + "description": "Cert is the public CA certificate base64 encoded", "type": "string" }, - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterInstancetype" - } - }, - "kind": { - "description": "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", - "type": "string" - }, - "metadata": { - "$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta" - } - } - }, - "v1alpha1.VirtualMachineClusterPreference": { - "description": "VirtualMachineClusterPreference is a cluster scoped version of the VirtualMachinePreference resource.", - "type": "object", - "required": [ - "spec" - ], - "properties": { - "apiVersion": { - "description": "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", - "type": "string" - }, - "kind": { - "description": "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", - "type": "string" - }, - "metadata": { - "$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta" - }, - "spec": { - "description": "Required spec describing the preferences", - "$ref": "#/definitions/v1alpha1.VirtualMachinePreferenceSpec" - } - } - }, - "v1alpha1.VirtualMachineClusterPreferenceList": { - "description": "VirtualMachineClusterPreferenceList is a list of VirtualMachineClusterPreference resources.", - "type": "object", - "required": [ - "items" - ], - "properties": { - "apiVersion": { - "description": "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", - "type": "string" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1.VirtualMachineClusterPreference" - }, - "x-kubernetes-list-type": "set" - }, - "kind": { - "description": "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", - "type": "string" - }, - "metadata": { - "$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta" - } - } - }, - "v1alpha1.VirtualMachineExport": { - "description": "VirtualMachineExport defines the operation of exporting a VM source", - "type": "object", - "required": [ - "spec" - ], - "properties": { - "apiVersion": { - "description": "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", - "type": "string" - }, - "kind": { - "description": "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", - "type": "string" - }, - "metadata": { - "$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta" - }, - "spec": { - "$ref": "#/definitions/v1alpha1.VirtualMachineExportSpec" - }, - "status": { - "$ref": "#/definitions/v1alpha1.VirtualMachineExportStatus" - } - } - }, - "v1alpha1.VirtualMachineExportLink": { - "description": "VirtualMachineExportLink contains a list of volumes available for export, as well as the URLs to obtain these volumes", - "type": "object", - "required": [ - "cert" - ], - "properties": { - "cert": { - "description": "Cert is the public CA certificate base64 encoded", - "type": "string" - }, - "volumes": { - "description": "Volumes is a list of available volumes to export", + "volumes": { + "description": "Volumes is a list of available volumes to export", "type": "array", "items": { "$ref": "#/definitions/v1alpha1.VirtualMachineExportVolume" @@ -20284,98 +19948,6 @@ } } }, - "v1alpha1.VirtualMachineInstancetype": { - "description": "VirtualMachineInstancetype resource contains quantitative and resource related VirtualMachine configuration that can be used by multiple VirtualMachine resources.", - "type": "object", - "required": [ - "spec" - ], - "properties": { - "apiVersion": { - "description": "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", - "type": "string" - }, - "kind": { - "description": "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", - "type": "string" - }, - "metadata": { - "$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta" - }, - "spec": { - "description": "Required spec describing the instancetype", - "$ref": "#/definitions/v1alpha1.VirtualMachineInstancetypeSpec" - } - } - }, - "v1alpha1.VirtualMachineInstancetypeList": { - "description": "VirtualMachineInstancetypeList is a list of VirtualMachineInstancetype resources.", - "type": "object", - "required": [ - "items" - ], - "properties": { - "apiVersion": { - "description": "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", - "type": "string" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1.VirtualMachineInstancetype" - } - }, - "kind": { - "description": "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", - "type": "string" - }, - "metadata": { - "$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta" - } - } - }, - "v1alpha1.VirtualMachineInstancetypeSpec": { - "description": "VirtualMachineInstancetypeSpec is a description of the VirtualMachineInstancetype or VirtualMachineClusterInstancetype.\n\nCPU 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.", - "type": "object", - "required": [ - "cpu", - "memory" - ], - "properties": { - "cpu": { - "description": "Required CPU related attributes of the instancetype.", - "$ref": "#/definitions/v1alpha1.CPUInstancetype" - }, - "gpus": { - "description": "Optionally defines any GPU devices associated with the instancetype.", - "type": "array", - "items": { - "$ref": "#/definitions/v1.GPU" - }, - "x-kubernetes-list-type": "atomic" - }, - "hostDevices": { - "description": "Optionally defines any HostDevices associated with the instancetype.", - "type": "array", - "items": { - "$ref": "#/definitions/v1.HostDevice" - }, - "x-kubernetes-list-type": "atomic" - }, - "ioThreadsPolicy": { - "description": "Optionally defines the IOThreadsPolicy to be used by the instancetype.", - "type": "string" - }, - "launchSecurity": { - "description": "Optionally defines the LaunchSecurity to be used by the instancetype.", - "$ref": "#/definitions/v1.LaunchSecurity" - }, - "memory": { - "description": "Required Memory related attributes of the instancetype.", - "$ref": "#/definitions/v1alpha1.MemoryInstancetype" - } - } - }, "v1alpha1.VirtualMachinePool": { "description": "VirtualMachinePool resource contains a VirtualMachine configuration that can be used to replicate multiple VirtualMachine resources.", "type": "object", @@ -20508,87 +20080,6 @@ } } }, - "v1alpha1.VirtualMachinePreference": { - "description": "VirtualMachinePreference resource contains optional preferences related to the VirtualMachine.", - "type": "object", - "required": [ - "spec" - ], - "properties": { - "apiVersion": { - "description": "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", - "type": "string" - }, - "kind": { - "description": "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", - "type": "string" - }, - "metadata": { - "$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta" - }, - "spec": { - "description": "Required spec describing the preferences", - "$ref": "#/definitions/v1alpha1.VirtualMachinePreferenceSpec" - } - } - }, - "v1alpha1.VirtualMachinePreferenceList": { - "description": "VirtualMachinePreferenceList is a list of VirtualMachinePreference resources.", - "type": "object", - "required": [ - "items" - ], - "properties": { - "apiVersion": { - "description": "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", - "type": "string" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/v1alpha1.VirtualMachinePreference" - }, - "x-kubernetes-list-type": "set" - }, - "kind": { - "description": "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", - "type": "string" - }, - "metadata": { - "$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta" - } - } - }, - "v1alpha1.VirtualMachinePreferenceSpec": { - "description": "VirtualMachinePreferenceSpec is a description of the VirtualMachinePreference or VirtualMachineClusterPreference.", - "type": "object", - "properties": { - "clock": { - "description": "Clock optionally defines preferences associated with the Clock attribute of a VirtualMachineInstance DomainSpec", - "$ref": "#/definitions/v1alpha1.ClockPreferences" - }, - "cpu": { - "description": "CPU optionally defines preferences associated with the CPU attribute of a VirtualMachineInstance DomainSpec", - "$ref": "#/definitions/v1alpha1.CPUPreferences" - }, - "devices": { - "description": "Devices optionally defines preferences associated with the Devices attribute of a VirtualMachineInstance DomainSpec", - "$ref": "#/definitions/v1alpha1.DevicePreferences" - }, - "features": { - "description": "Features optionally defines preferences associated with the Features attribute of a VirtualMachineInstance DomainSpec", - "$ref": "#/definitions/v1alpha1.FeaturePreferences" - }, - "firmware": { - "description": "Firmware optionally defines preferences associated with the Firmware attribute of a VirtualMachineInstance DomainSpec", - "$ref": "#/definitions/v1alpha1.FirmwarePreferences" - }, - "machine": { - "description": "Machine optionally defines preferences associated with the Machine attribute of a VirtualMachineInstance DomainSpec", - "$ref": "#/definitions/v1alpha1.MachinePreferences" - } - } - }, "v1alpha1.VirtualMachineRestore": { "description": "VirtualMachineRestore defines the operation of restoring a VM", "type": "object", @@ -20979,6 +20470,515 @@ } } }, + "v1alpha2.CPUInstancetype": { + "description": "CPUInstancetype contains the CPU related configuration of a given VirtualMachineInstancetypeSpec.\n\nGuest is a required attribute and defines the number of vCPUs to be exposed to the guest by the instancetype.", + "type": "object", + "required": [ + "guest" + ], + "properties": { + "dedicatedCPUPlacement": { + "description": "DedicatedCPUPlacement requests the scheduler to place the VirtualMachineInstance on a node with enough dedicated pCPUs and pin the vCPUs to it.", + "type": "boolean" + }, + "guest": { + "description": "Required number of vCPUs to expose to the guest.\n\nThe resulting CPU topology being derived from the optional PreferredCPUTopology attribute of CPUPreferences that itself defaults to PreferCores.", + "type": "integer", + "format": "int64" + }, + "isolateEmulatorThread": { + "description": "IsolateEmulatorThread requests one more dedicated pCPU to be allocated for the VMI to place the emulator thread on it.", + "type": "boolean" + }, + "model": { + "description": "Model specifies the CPU model inside the VMI. List of available models https://github.com/libvirt/libvirt/tree/master/src/cpu_map. It is possible to specify special cases like \"host-passthrough\" to get the same CPU as the node and \"host-model\" to get CPU closest to the node one. Defaults to host-model.", + "type": "string" + }, + "numa": { + "description": "NUMA allows specifying settings for the guest NUMA topology", + "$ref": "#/definitions/v1.NUMA" + }, + "realtime": { + "description": "Realtime instructs the virt-launcher to tune the VMI for lower latency, optional for real time workloads", + "$ref": "#/definitions/v1.Realtime" + } + } + }, + "v1alpha2.CPUPreferences": { + "description": "CPUPreferences contains various optional CPU preferences.", + "type": "object", + "properties": { + "preferredCPUTopology": { + "description": "PreferredCPUTopology optionally defines the preferred guest visible CPU topology, defaults to PreferSockets.", + "type": "string" + } + } + }, + "v1alpha2.ClockPreferences": { + "description": "ClockPreferences contains various optional defaults for Clock.", + "type": "object", + "properties": { + "preferredClockOffset": { + "description": "ClockOffset allows specifying the UTC offset or the timezone of the guest clock.", + "$ref": "#/definitions/v1.ClockOffset" + }, + "preferredTimer": { + "description": "Timer specifies whih timers are attached to the vmi.", + "$ref": "#/definitions/v1.Timer" + } + } + }, + "v1alpha2.DevicePreferences": { + "description": "DevicePreferences contains various optional Device preferences.", + "type": "object", + "properties": { + "preferredAutoattachGraphicsDevice": { + "description": "PreferredAutoattachGraphicsDevice optionally defines the preferred value of AutoattachGraphicsDevice", + "type": "boolean" + }, + "preferredAutoattachInputDevice": { + "description": "PreferredAutoattachInputDevice optionally defines the preferred value of AutoattachInputDevice", + "type": "boolean" + }, + "preferredAutoattachMemBalloon": { + "description": "PreferredAutoattachMemBalloon optionally defines the preferred value of AutoattachMemBalloon", + "type": "boolean" + }, + "preferredAutoattachPodInterface": { + "description": "PreferredAutoattachPodInterface optionally defines the preferred value of AutoattachPodInterface", + "type": "boolean" + }, + "preferredAutoattachSerialConsole": { + "description": "PreferredAutoattachSerialConsole optionally defines the preferred value of AutoattachSerialConsole", + "type": "boolean" + }, + "preferredBlockMultiQueue": { + "description": "PreferredBlockMultiQueue optionally enables the vhost multiqueue feature for virtio disks.", + "type": "boolean" + }, + "preferredCdromBus": { + "description": "PreferredCdromBus optionally defines the preferred bus for Cdrom Disk devices.", + "type": "string" + }, + "preferredDisableHotplug": { + "description": "PreferredDisableHotplug optionally defines the preferred value of DisableHotplug", + "type": "boolean" + }, + "preferredDiskBlockSize": { + "description": "PreferredBlockSize optionally defines the block size of Disk devices.", + "$ref": "#/definitions/v1.BlockSize" + }, + "preferredDiskBus": { + "description": "PreferredDiskBus optionally defines the preferred bus for Disk Disk devices.", + "type": "string" + }, + "preferredDiskCache": { + "description": "PreferredCache optionally defines the DriverCache to be used by Disk devices.", + "type": "string" + }, + "preferredDiskDedicatedIoThread": { + "description": "PreferredDedicatedIoThread optionally enables dedicated IO threads for Disk devices.", + "type": "boolean" + }, + "preferredDiskIO": { + "description": "PreferredIo optionally defines the QEMU disk IO mode to be used by Disk devices.", + "type": "string" + }, + "preferredInputBus": { + "description": "PreferredInputBus optionally defines the preferred bus for Input devices.", + "type": "string" + }, + "preferredInputType": { + "description": "PreferredInputType optionally defines the preferred type for Input devices.", + "type": "string" + }, + "preferredInterfaceModel": { + "description": "PreferredInterfaceModel optionally defines the preferred model to be used by Interface devices.", + "type": "string" + }, + "preferredLunBus": { + "description": "PreferredLunBus optionally defines the preferred bus for Lun Disk devices.", + "type": "string" + }, + "preferredNetworkInterfaceMultiQueue": { + "description": "PreferredNetworkInterfaceMultiQueue optionally enables the vhost multiqueue feature for virtio interfaces.", + "type": "boolean" + }, + "preferredRng": { + "description": "PreferredRng optionally defines the preferred rng device to be used.", + "$ref": "#/definitions/v1.Rng" + }, + "preferredSoundModel": { + "description": "PreferredSoundModel optionally defines the preferred model for Sound devices.", + "type": "string" + }, + "preferredTPM": { + "description": "PreferredTPM optionally defines the preferred TPM device to be used.", + "$ref": "#/definitions/v1.TPMDevice" + }, + "preferredUseVirtioTransitional": { + "description": "PreferredUseVirtioTransitional optionally defines the preferred value of UseVirtioTransitional", + "type": "boolean" + }, + "preferredVirtualGPUOptions": { + "description": "PreferredVirtualGPUOptions optionally defines the preferred value of VirtualGPUOptions", + "$ref": "#/definitions/v1.VGPUOptions" + } + } + }, + "v1alpha2.FeaturePreferences": { + "description": "FeaturePreferences contains various optional defaults for Features.", + "type": "object", + "properties": { + "preferredAcpi": { + "description": "PreferredAcpi optionally enables the ACPI feature", + "$ref": "#/definitions/v1.FeatureState" + }, + "preferredApic": { + "description": "PreferredApic optionally enables and configures the APIC feature", + "$ref": "#/definitions/v1.FeatureAPIC" + }, + "preferredHyperv": { + "description": "PreferredHyperv optionally enables and configures HyperV features", + "$ref": "#/definitions/v1.FeatureHyperv" + }, + "preferredKvm": { + "description": "PreferredKvm optionally enables and configures KVM features", + "$ref": "#/definitions/v1.FeatureKVM" + }, + "preferredPvspinlock": { + "description": "PreferredPvspinlock optionally enables the Pvspinlock feature", + "$ref": "#/definitions/v1.FeatureState" + }, + "preferredSmm": { + "description": "PreferredSmm optionally enables the SMM feature", + "$ref": "#/definitions/v1.FeatureState" + } + } + }, + "v1alpha2.FirmwarePreferences": { + "description": "FirmwarePreferences contains various optional defaults for Firmware.", + "type": "object", + "properties": { + "preferredUseBios": { + "description": "PreferredUseBios optionally enables BIOS", + "type": "boolean" + }, + "preferredUseBiosSerial": { + "description": "PreferredUseBiosSerial optionally transmitts BIOS output over the serial.\n\nRequires PreferredUseBios to be enabled.", + "type": "boolean" + }, + "preferredUseEfi": { + "description": "PreferredUseEfi optionally enables EFI", + "type": "boolean" + }, + "preferredUseSecureBoot": { + "description": "PreferredUseSecureBoot optionally enables SecureBoot and the OVMF roms will be swapped for SecureBoot-enabled ones.\n\nRequires PreferredUseEfi and PreferredSmm to be enabled.", + "type": "boolean" + } + } + }, + "v1alpha2.MachinePreferences": { + "description": "MachinePreferences contains various optional defaults for Machine.", + "type": "object", + "properties": { + "preferredMachineType": { + "description": "PreferredMachineType optionally defines the preferred machine type to use.", + "type": "string" + } + } + }, + "v1alpha2.MemoryInstancetype": { + "description": "MemoryInstancetype contains the Memory related configuration of a given VirtualMachineInstancetypeSpec.\n\nGuest is a required attribute and defines the amount of RAM to be exposed to the guest by the instancetype.", + "type": "object", + "required": [ + "guest" + ], + "properties": { + "guest": { + "description": "Required amount of memory which is visible inside the guest OS.", + "$ref": "#/definitions/k8s.io.apimachinery.pkg.api.resource.Quantity" + }, + "hugepages": { + "description": "Optionally enables the use of hugepages for the VirtualMachineInstance instead of regular memory.", + "$ref": "#/definitions/v1.Hugepages" + } + } + }, + "v1alpha2.VirtualMachineClusterInstancetype": { + "description": "VirtualMachineClusterInstancetype is a cluster scoped version of VirtualMachineInstancetype resource.", + "type": "object", + "required": [ + "spec" + ], + "properties": { + "apiVersion": { + "description": "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", + "type": "string" + }, + "kind": { + "description": "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", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Required spec describing the instancetype", + "$ref": "#/definitions/v1alpha2.VirtualMachineInstancetypeSpec" + } + } + }, + "v1alpha2.VirtualMachineClusterInstancetypeList": { + "description": "VirtualMachineClusterInstancetypeList is a list of VirtualMachineClusterInstancetype resources.", + "type": "object", + "required": [ + "items" + ], + "properties": { + "apiVersion": { + "description": "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", + "type": "string" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterInstancetype" + } + }, + "kind": { + "description": "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", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta" + } + } + }, + "v1alpha2.VirtualMachineClusterPreference": { + "description": "VirtualMachineClusterPreference is a cluster scoped version of the VirtualMachinePreference resource.", + "type": "object", + "required": [ + "spec" + ], + "properties": { + "apiVersion": { + "description": "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", + "type": "string" + }, + "kind": { + "description": "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", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Required spec describing the preferences", + "$ref": "#/definitions/v1alpha2.VirtualMachinePreferenceSpec" + } + } + }, + "v1alpha2.VirtualMachineClusterPreferenceList": { + "description": "VirtualMachineClusterPreferenceList is a list of VirtualMachineClusterPreference resources.", + "type": "object", + "required": [ + "items" + ], + "properties": { + "apiVersion": { + "description": "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", + "type": "string" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/v1alpha2.VirtualMachineClusterPreference" + }, + "x-kubernetes-list-type": "set" + }, + "kind": { + "description": "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", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta" + } + } + }, + "v1alpha2.VirtualMachineInstancetype": { + "description": "VirtualMachineInstancetype resource contains quantitative and resource related VirtualMachine configuration that can be used by multiple VirtualMachine resources.", + "type": "object", + "required": [ + "spec" + ], + "properties": { + "apiVersion": { + "description": "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", + "type": "string" + }, + "kind": { + "description": "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", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Required spec describing the instancetype", + "$ref": "#/definitions/v1alpha2.VirtualMachineInstancetypeSpec" + } + } + }, + "v1alpha2.VirtualMachineInstancetypeList": { + "description": "VirtualMachineInstancetypeList is a list of VirtualMachineInstancetype resources.", + "type": "object", + "required": [ + "items" + ], + "properties": { + "apiVersion": { + "description": "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", + "type": "string" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/v1alpha2.VirtualMachineInstancetype" + } + }, + "kind": { + "description": "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", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta" + } + } + }, + "v1alpha2.VirtualMachineInstancetypeSpec": { + "description": "VirtualMachineInstancetypeSpec is a description of the VirtualMachineInstancetype or VirtualMachineClusterInstancetype.\n\nCPU 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.", + "type": "object", + "required": [ + "cpu", + "memory" + ], + "properties": { + "cpu": { + "description": "Required CPU related attributes of the instancetype.", + "$ref": "#/definitions/v1alpha2.CPUInstancetype" + }, + "gpus": { + "description": "Optionally defines any GPU devices associated with the instancetype.", + "type": "array", + "items": { + "$ref": "#/definitions/v1.GPU" + }, + "x-kubernetes-list-type": "atomic" + }, + "hostDevices": { + "description": "Optionally defines any HostDevices associated with the instancetype.", + "type": "array", + "items": { + "$ref": "#/definitions/v1.HostDevice" + }, + "x-kubernetes-list-type": "atomic" + }, + "ioThreadsPolicy": { + "description": "Optionally defines the IOThreadsPolicy to be used by the instancetype.", + "type": "string" + }, + "launchSecurity": { + "description": "Optionally defines the LaunchSecurity to be used by the instancetype.", + "$ref": "#/definitions/v1.LaunchSecurity" + }, + "memory": { + "description": "Required Memory related attributes of the instancetype.", + "$ref": "#/definitions/v1alpha2.MemoryInstancetype" + } + } + }, + "v1alpha2.VirtualMachinePreference": { + "description": "VirtualMachinePreference resource contains optional preferences related to the VirtualMachine.", + "type": "object", + "required": [ + "spec" + ], + "properties": { + "apiVersion": { + "description": "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", + "type": "string" + }, + "kind": { + "description": "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", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Required spec describing the preferences", + "$ref": "#/definitions/v1alpha2.VirtualMachinePreferenceSpec" + } + } + }, + "v1alpha2.VirtualMachinePreferenceList": { + "description": "VirtualMachinePreferenceList is a list of VirtualMachinePreference resources.", + "type": "object", + "required": [ + "items" + ], + "properties": { + "apiVersion": { + "description": "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", + "type": "string" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/v1alpha2.VirtualMachinePreference" + }, + "x-kubernetes-list-type": "set" + }, + "kind": { + "description": "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", + "type": "string" + }, + "metadata": { + "$ref": "#/definitions/k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta" + } + } + }, + "v1alpha2.VirtualMachinePreferenceSpec": { + "description": "VirtualMachinePreferenceSpec is a description of the VirtualMachinePreference or VirtualMachineClusterPreference.", + "type": "object", + "properties": { + "clock": { + "description": "Clock optionally defines preferences associated with the Clock attribute of a VirtualMachineInstance DomainSpec", + "$ref": "#/definitions/v1alpha2.ClockPreferences" + }, + "cpu": { + "description": "CPU optionally defines preferences associated with the CPU attribute of a VirtualMachineInstance DomainSpec", + "$ref": "#/definitions/v1alpha2.CPUPreferences" + }, + "devices": { + "description": "Devices optionally defines preferences associated with the Devices attribute of a VirtualMachineInstance DomainSpec", + "$ref": "#/definitions/v1alpha2.DevicePreferences" + }, + "features": { + "description": "Features optionally defines preferences associated with the Features attribute of a VirtualMachineInstance DomainSpec", + "$ref": "#/definitions/v1alpha2.FeaturePreferences" + }, + "firmware": { + "description": "Firmware optionally defines preferences associated with the Firmware attribute of a VirtualMachineInstance DomainSpec", + "$ref": "#/definitions/v1alpha2.FirmwarePreferences" + }, + "machine": { + "description": "Machine optionally defines preferences associated with the Machine attribute of a VirtualMachineInstance DomainSpec", + "$ref": "#/definitions/v1alpha2.MachinePreferences" + } + } + }, "v1beta1.DataVolumeBlankImage": { "description": "DataVolumeBlankImage provides the parameters to create a new raw blank image for the PVC", "type": "object" diff --git a/examples/clarge.yaml b/examples/clarge.yaml index 2ee5ea9ef446..eb95cb5877de 100644 --- a/examples/clarge.yaml +++ b/examples/clarge.yaml @@ -1,5 +1,5 @@ --- -apiVersion: instancetype.kubevirt.io/v1alpha1 +apiVersion: instancetype.kubevirt.io/v1alpha2 kind: VirtualMachineInstancetype metadata: name: clarge diff --git a/examples/cluster-csmall.yaml b/examples/cluster-csmall.yaml index fd45e341373f..c1a0f3bd0577 100644 --- a/examples/cluster-csmall.yaml +++ b/examples/cluster-csmall.yaml @@ -1,5 +1,5 @@ --- -apiVersion: instancetype.kubevirt.io/v1alpha1 +apiVersion: instancetype.kubevirt.io/v1alpha2 kind: VirtualMachineClusterInstancetype metadata: name: cluster-csmall diff --git a/examples/csmall.yaml b/examples/csmall.yaml index ad0fe3a24d97..d38c2960e8f5 100644 --- a/examples/csmall.yaml +++ b/examples/csmall.yaml @@ -1,5 +1,5 @@ --- -apiVersion: instancetype.kubevirt.io/v1alpha1 +apiVersion: instancetype.kubevirt.io/v1alpha2 kind: VirtualMachineInstancetype metadata: name: csmall diff --git a/examples/virtio.yaml b/examples/virtio.yaml index 3b0c3e2f70b0..d2991a2ed081 100644 --- a/examples/virtio.yaml +++ b/examples/virtio.yaml @@ -1,5 +1,5 @@ --- -apiVersion: instancetype.kubevirt.io/v1alpha1 +apiVersion: instancetype.kubevirt.io/v1alpha2 kind: VirtualMachinePreference metadata: name: virtio diff --git a/examples/windows.yaml b/examples/windows.yaml index 8961a5eec453..052878fb8f26 100644 --- a/examples/windows.yaml +++ b/examples/windows.yaml @@ -1,5 +1,5 @@ --- -apiVersion: instancetype.kubevirt.io/v1alpha1 +apiVersion: instancetype.kubevirt.io/v1alpha2 kind: VirtualMachinePreference metadata: name: windows diff --git a/pkg/instancetype/BUILD.bazel b/pkg/instancetype/BUILD.bazel index feba5f0560b2..1f25bf7decde 100644 --- a/pkg/instancetype/BUILD.bazel +++ b/pkg/instancetype/BUILD.bazel @@ -9,7 +9,7 @@ go_library( "//pkg/util/types:go_default_library", "//staging/src/kubevirt.io/api/core/v1:go_default_library", "//staging/src/kubevirt.io/api/instancetype:go_default_library", - "//staging/src/kubevirt.io/api/instancetype/v1alpha1:go_default_library", + "//staging/src/kubevirt.io/api/instancetype/v1alpha2:go_default_library", "//staging/src/kubevirt.io/client-go/kubecli:go_default_library", "//staging/src/kubevirt.io/client-go/log:go_default_library", "//vendor/k8s.io/api/apps/v1:go_default_library", @@ -33,10 +33,10 @@ go_test( ":go_default_library", "//staging/src/kubevirt.io/api/core/v1:go_default_library", "//staging/src/kubevirt.io/api/instancetype:go_default_library", - "//staging/src/kubevirt.io/api/instancetype/v1alpha1:go_default_library", + "//staging/src/kubevirt.io/api/instancetype/v1alpha2:go_default_library", "//staging/src/kubevirt.io/client-go/api:go_default_library", "//staging/src/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/fake:go_default_library", - "//staging/src/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/instancetype/v1alpha1:go_default_library", + "//staging/src/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/instancetype/v1alpha2:go_default_library", "//staging/src/kubevirt.io/client-go/kubecli:go_default_library", "//staging/src/kubevirt.io/client-go/testutils:go_default_library", "//vendor/github.com/golang/mock/gomock:go_default_library", diff --git a/pkg/instancetype/instancetype.go b/pkg/instancetype/instancetype.go index 365099f138c0..091d59c9bdae 100644 --- a/pkg/instancetype/instancetype.go +++ b/pkg/instancetype/instancetype.go @@ -19,7 +19,7 @@ import ( v1 "kubevirt.io/api/core/v1" virtv1 "kubevirt.io/api/core/v1" apiinstancetype "kubevirt.io/api/instancetype" - instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" + instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" "kubevirt.io/client-go/kubecli" "kubevirt.io/client-go/log" @@ -27,9 +27,9 @@ import ( ) type Methods interface { - FindInstancetypeSpec(vm *virtv1.VirtualMachine) (*instancetypev1alpha1.VirtualMachineInstancetypeSpec, error) - ApplyToVmi(field *k8sfield.Path, instancetypespec *instancetypev1alpha1.VirtualMachineInstancetypeSpec, prefernceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) Conflicts - FindPreferenceSpec(vm *virtv1.VirtualMachine) (*instancetypev1alpha1.VirtualMachinePreferenceSpec, error) + FindInstancetypeSpec(vm *virtv1.VirtualMachine) (*instancetypev1alpha2.VirtualMachineInstancetypeSpec, error) + ApplyToVmi(field *k8sfield.Path, instancetypespec *instancetypev1alpha2.VirtualMachineInstancetypeSpec, prefernceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) Conflicts + FindPreferenceSpec(vm *virtv1.VirtualMachine) (*instancetypev1alpha2.VirtualMachinePreferenceSpec, error) StoreControllerRevisions(vm *virtv1.VirtualMachine) error } @@ -59,14 +59,14 @@ func GetRevisionName(vmName, resourceName string, resourceUID types.UID, resourc return fmt.Sprintf("%s-%s-%s-%d", vmName, resourceName, resourceUID, resourceGeneration) } -func CreateInstancetypeControllerRevision(vm *virtv1.VirtualMachine, revisionName string, instancetypeApiVersion string, instancetypeSpec *instancetypev1alpha1.VirtualMachineInstancetypeSpec) (*appsv1.ControllerRevision, error) { +func CreateInstancetypeControllerRevision(vm *virtv1.VirtualMachine, revisionName string, instancetypeApiVersion string, instancetypeSpec *instancetypev1alpha2.VirtualMachineInstancetypeSpec) (*appsv1.ControllerRevision, error) { instancetypeSpecPatch, err := json.Marshal(*instancetypeSpec) if err != nil { return nil, err } - specRevision := instancetypev1alpha1.VirtualMachineInstancetypeSpecRevision{ + specRevision := instancetypev1alpha2.VirtualMachineInstancetypeSpecRevision{ APIVersion: instancetypeApiVersion, Spec: instancetypeSpecPatch, } @@ -87,7 +87,7 @@ func CreateInstancetypeControllerRevision(vm *virtv1.VirtualMachine, revisionNam } -func (m *methods) checkForInstancetypeConflicts(instancetypeSpec *instancetypev1alpha1.VirtualMachineInstancetypeSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) error { +func (m *methods) checkForInstancetypeConflicts(instancetypeSpec *instancetypev1alpha2.VirtualMachineInstancetypeSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) error { // Apply the instancetype to a copy of the VMISpec as we don't want to persist any changes here in the VM being passed around vmiSpecCopy := vmiSpec.DeepCopy() conflicts := m.ApplyToVmi(k8sfield.NewPath("spec", "template", "spec"), instancetypeSpec, nil, vmiSpecCopy) @@ -161,14 +161,14 @@ func (m *methods) storeInstancetypeRevision(vm *virtv1.VirtualMachine) (*appsv1. return storedRevision, nil } -func CreatePreferenceControllerRevision(vm *virtv1.VirtualMachine, revisionName string, preferenceApiVersion string, preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec) (*appsv1.ControllerRevision, error) { +func CreatePreferenceControllerRevision(vm *virtv1.VirtualMachine, revisionName string, preferenceApiVersion string, preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec) (*appsv1.ControllerRevision, error) { preferenceSpecPatch, err := json.Marshal(*preferenceSpec) if err != nil { return nil, err } - specRevision := instancetypev1alpha1.VirtualMachinePreferenceSpecRevision{ + specRevision := instancetypev1alpha2.VirtualMachinePreferenceSpecRevision{ APIVersion: preferenceApiVersion, Spec: preferenceSpecPatch, } @@ -328,7 +328,7 @@ func storeRevision(revision *appsv1.ControllerRevision, clientset kubecli.Kubevi return foundRevision, nil } -func (m *methods) ApplyToVmi(field *k8sfield.Path, instancetypeSpec *instancetypev1alpha1.VirtualMachineInstancetypeSpec, preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) Conflicts { +func (m *methods) ApplyToVmi(field *k8sfield.Path, instancetypeSpec *instancetypev1alpha2.VirtualMachineInstancetypeSpec, preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) Conflicts { var conflicts Conflicts if instancetypeSpec != nil { @@ -352,11 +352,11 @@ func (m *methods) ApplyToVmi(field *k8sfield.Path, instancetypeSpec *instancetyp return conflicts } -func (m *methods) FindPreferenceSpec(vm *virtv1.VirtualMachine) (*instancetypev1alpha1.VirtualMachinePreferenceSpec, error) { +func (m *methods) FindPreferenceSpec(vm *virtv1.VirtualMachine) (*instancetypev1alpha2.VirtualMachinePreferenceSpec, error) { var err error - var preference *instancetypev1alpha1.VirtualMachinePreference - var clusterPreference *instancetypev1alpha1.VirtualMachineClusterPreference + var preference *instancetypev1alpha2.VirtualMachinePreference + var clusterPreference *instancetypev1alpha2.VirtualMachineClusterPreference if vm.Spec.Preference == nil { return nil, nil @@ -390,21 +390,21 @@ func (m *methods) FindPreferenceSpec(vm *virtv1.VirtualMachine) (*instancetypev1 return nil, nil } -func (m *methods) getPreferenceSpecRevision(revisionName string, namespace string) (*instancetypev1alpha1.VirtualMachinePreferenceSpec, error) { +func (m *methods) getPreferenceSpecRevision(revisionName string, namespace string) (*instancetypev1alpha2.VirtualMachinePreferenceSpec, error) { revision, err := m.clientset.AppsV1().ControllerRevisions(namespace).Get(context.Background(), revisionName, metav1.GetOptions{}) if err != nil { return nil, err } - preferenceSpecRevision := instancetypev1alpha1.VirtualMachinePreferenceSpecRevision{} + preferenceSpecRevision := instancetypev1alpha2.VirtualMachinePreferenceSpecRevision{} err = json.Unmarshal(revision.Data.Raw, &preferenceSpecRevision) if err != nil { return nil, err } // For now we only support a single version of VirtualMachinePreferenceSpec but in the future we will need to handle older versions here - preferenceSpec := instancetypev1alpha1.VirtualMachinePreferenceSpec{} + preferenceSpec := instancetypev1alpha2.VirtualMachinePreferenceSpec{} err = json.Unmarshal(preferenceSpecRevision.Spec, &preferenceSpec) if err != nil { return nil, err @@ -413,7 +413,7 @@ func (m *methods) getPreferenceSpecRevision(revisionName string, namespace strin return &preferenceSpec, nil } -func (m *methods) findPreference(vm *virtv1.VirtualMachine) (*instancetypev1alpha1.VirtualMachinePreference, error) { +func (m *methods) findPreference(vm *virtv1.VirtualMachine) (*instancetypev1alpha2.VirtualMachinePreference, error) { if vm.Spec.Preference == nil { return nil, nil @@ -427,7 +427,7 @@ func (m *methods) findPreference(vm *virtv1.VirtualMachine) (*instancetypev1alph return preference, nil } -func (m *methods) findClusterPreference(vm *virtv1.VirtualMachine) (*instancetypev1alpha1.VirtualMachineClusterPreference, error) { +func (m *methods) findClusterPreference(vm *virtv1.VirtualMachine) (*instancetypev1alpha2.VirtualMachineClusterPreference, error) { if vm.Spec.Preference == nil { return nil, nil @@ -440,11 +440,11 @@ func (m *methods) findClusterPreference(vm *virtv1.VirtualMachine) (*instancetyp return preference, nil } -func (m *methods) FindInstancetypeSpec(vm *virtv1.VirtualMachine) (*instancetypev1alpha1.VirtualMachineInstancetypeSpec, error) { +func (m *methods) FindInstancetypeSpec(vm *virtv1.VirtualMachine) (*instancetypev1alpha2.VirtualMachineInstancetypeSpec, error) { var err error - var instancetype *instancetypev1alpha1.VirtualMachineInstancetype - var clusterInstancetype *instancetypev1alpha1.VirtualMachineClusterInstancetype + var instancetype *instancetypev1alpha2.VirtualMachineInstancetype + var clusterInstancetype *instancetypev1alpha2.VirtualMachineClusterInstancetype if vm.Spec.Instancetype == nil { return nil, nil @@ -478,21 +478,21 @@ func (m *methods) FindInstancetypeSpec(vm *virtv1.VirtualMachine) (*instancetype return nil, nil } -func (m *methods) getInstancetypeSpecRevision(revisionName string, namespace string) (*instancetypev1alpha1.VirtualMachineInstancetypeSpec, error) { +func (m *methods) getInstancetypeSpecRevision(revisionName string, namespace string) (*instancetypev1alpha2.VirtualMachineInstancetypeSpec, error) { revision, err := m.clientset.AppsV1().ControllerRevisions(namespace).Get(context.Background(), revisionName, metav1.GetOptions{}) if err != nil { return nil, err } - instancetypeSpecRevision := instancetypev1alpha1.VirtualMachineInstancetypeSpecRevision{} + instancetypeSpecRevision := instancetypev1alpha2.VirtualMachineInstancetypeSpecRevision{} err = json.Unmarshal(revision.Data.Raw, &instancetypeSpecRevision) if err != nil { return nil, err } // For now we only support a single version of VirtualMachineInstancetypeSpec but in the future we will need to handle older versions here - instancetypeSpec := instancetypev1alpha1.VirtualMachineInstancetypeSpec{} + instancetypeSpec := instancetypev1alpha2.VirtualMachineInstancetypeSpec{} err = json.Unmarshal(instancetypeSpecRevision.Spec, &instancetypeSpec) if err != nil { return nil, err @@ -501,7 +501,7 @@ func (m *methods) getInstancetypeSpecRevision(revisionName string, namespace str return &instancetypeSpec, nil } -func (m *methods) findInstancetype(vm *virtv1.VirtualMachine) (*instancetypev1alpha1.VirtualMachineInstancetype, error) { +func (m *methods) findInstancetype(vm *virtv1.VirtualMachine) (*instancetypev1alpha2.VirtualMachineInstancetype, error) { if vm.Spec.Instancetype == nil { return nil, nil @@ -514,7 +514,7 @@ func (m *methods) findInstancetype(vm *virtv1.VirtualMachine) (*instancetypev1al return instancetype, nil } -func (m *methods) findClusterInstancetype(vm *virtv1.VirtualMachine) (*instancetypev1alpha1.VirtualMachineClusterInstancetype, error) { +func (m *methods) findClusterInstancetype(vm *virtv1.VirtualMachine) (*instancetypev1alpha2.VirtualMachineClusterInstancetype, error) { if vm.Spec.Instancetype == nil { return nil, nil @@ -528,7 +528,7 @@ func (m *methods) findClusterInstancetype(vm *virtv1.VirtualMachine) (*instancet return instancetype, nil } -func applyCpu(field *k8sfield.Path, instancetypeSpec *instancetypev1alpha1.VirtualMachineInstancetypeSpec, preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) Conflicts { +func applyCpu(field *k8sfield.Path, instancetypeSpec *instancetypev1alpha2.VirtualMachineInstancetypeSpec, preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) Conflicts { if vmiSpec.Domain.CPU != nil { return Conflicts{field.Child("domain", "cpu")} } @@ -553,17 +553,17 @@ func applyCpu(field *k8sfield.Path, instancetypeSpec *instancetypev1alpha1.Virtu } // Default to PreferSockets when a PreferredCPUTopology isn't provided - preferredTopology := instancetypev1alpha1.PreferSockets + preferredTopology := instancetypev1alpha2.PreferSockets if preferenceSpec != nil && preferenceSpec.CPU != nil && preferenceSpec.CPU.PreferredCPUTopology != "" { preferredTopology = preferenceSpec.CPU.PreferredCPUTopology } switch preferredTopology { - case instancetypev1alpha1.PreferCores: + case instancetypev1alpha2.PreferCores: vmiSpec.Domain.CPU.Cores = instancetypeSpec.CPU.Guest - case instancetypev1alpha1.PreferSockets: + case instancetypev1alpha2.PreferSockets: vmiSpec.Domain.CPU.Sockets = instancetypeSpec.CPU.Guest - case instancetypev1alpha1.PreferThreads: + case instancetypev1alpha2.PreferThreads: vmiSpec.Domain.CPU.Threads = instancetypeSpec.CPU.Guest } @@ -602,7 +602,7 @@ func AddPreferenceNameAnnotations(vm *virtv1.VirtualMachine, target metav1.Objec } } -func applyMemory(field *k8sfield.Path, instancetypeSpec *instancetypev1alpha1.VirtualMachineInstancetypeSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) Conflicts { +func applyMemory(field *k8sfield.Path, instancetypeSpec *instancetypev1alpha2.VirtualMachineInstancetypeSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) Conflicts { if vmiSpec.Domain.Memory != nil { return Conflicts{field.Child("domain", "memory")} @@ -628,7 +628,7 @@ func applyMemory(field *k8sfield.Path, instancetypeSpec *instancetypev1alpha1.Vi return nil } -func applyIOThreadPolicy(field *k8sfield.Path, instancetypeSpec *instancetypev1alpha1.VirtualMachineInstancetypeSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) Conflicts { +func applyIOThreadPolicy(field *k8sfield.Path, instancetypeSpec *instancetypev1alpha2.VirtualMachineInstancetypeSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) Conflicts { if instancetypeSpec.IOThreadsPolicy == nil { return nil @@ -644,7 +644,7 @@ func applyIOThreadPolicy(field *k8sfield.Path, instancetypeSpec *instancetypev1a return nil } -func applyLaunchSecurity(field *k8sfield.Path, instancetypeSpec *instancetypev1alpha1.VirtualMachineInstancetypeSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) Conflicts { +func applyLaunchSecurity(field *k8sfield.Path, instancetypeSpec *instancetypev1alpha2.VirtualMachineInstancetypeSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) Conflicts { if instancetypeSpec.LaunchSecurity == nil { return nil @@ -659,7 +659,7 @@ func applyLaunchSecurity(field *k8sfield.Path, instancetypeSpec *instancetypev1a return nil } -func applyGPUs(field *k8sfield.Path, instancetypeSpec *instancetypev1alpha1.VirtualMachineInstancetypeSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) Conflicts { +func applyGPUs(field *k8sfield.Path, instancetypeSpec *instancetypev1alpha2.VirtualMachineInstancetypeSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) Conflicts { if len(instancetypeSpec.GPUs) == 0 { return nil @@ -675,7 +675,7 @@ func applyGPUs(field *k8sfield.Path, instancetypeSpec *instancetypev1alpha1.Virt return nil } -func applyHostDevices(field *k8sfield.Path, instancetypeSpec *instancetypev1alpha1.VirtualMachineInstancetypeSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) Conflicts { +func applyHostDevices(field *k8sfield.Path, instancetypeSpec *instancetypev1alpha2.VirtualMachineInstancetypeSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) Conflicts { if len(instancetypeSpec.HostDevices) == 0 { return nil @@ -691,7 +691,7 @@ func applyHostDevices(field *k8sfield.Path, instancetypeSpec *instancetypev1alph return nil } -func ApplyDevicePreferences(preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { +func ApplyDevicePreferences(preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { if preferenceSpec.Devices == nil { return @@ -757,7 +757,7 @@ func ApplyDevicePreferences(preferenceSpec *instancetypev1alpha1.VirtualMachineP } -func applyDiskPreferences(preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { +func applyDiskPreferences(preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { for diskIndex := range vmiSpec.Domain.Devices.Disks { vmiDisk := &vmiSpec.Domain.Devices.Disks[diskIndex] // If we don't have a target device defined default to a DiskTarget so we can apply preferences @@ -799,7 +799,7 @@ func applyDiskPreferences(preferenceSpec *instancetypev1alpha1.VirtualMachinePre } } -func applyInterfacePreferences(preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { +func applyInterfacePreferences(preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { for ifaceIndex := range vmiSpec.Domain.Devices.Interfaces { vmiIface := &vmiSpec.Domain.Devices.Interfaces[ifaceIndex] if preferenceSpec.Devices.PreferredInterfaceModel != "" && vmiIface.Model == "" { @@ -808,7 +808,7 @@ func applyInterfacePreferences(preferenceSpec *instancetypev1alpha1.VirtualMachi } } -func applyInputPreferences(preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { +func applyInputPreferences(preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { for inputIndex := range vmiSpec.Domain.Devices.Inputs { vmiInput := &vmiSpec.Domain.Devices.Inputs[inputIndex] if preferenceSpec.Devices.PreferredInputBus != "" && vmiInput.Bus == "" { @@ -821,7 +821,7 @@ func applyInputPreferences(preferenceSpec *instancetypev1alpha1.VirtualMachinePr } } -func applyFeaturePreferences(preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { +func applyFeaturePreferences(preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { if preferenceSpec.Features == nil { return @@ -858,7 +858,7 @@ func applyFeaturePreferences(preferenceSpec *instancetypev1alpha1.VirtualMachine } -func applyHyperVFeaturePreferences(preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { +func applyHyperVFeaturePreferences(preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { if vmiSpec.Domain.Features.Hyperv == nil { vmiSpec.Domain.Features.Hyperv = &v1.FeatureHyperv{} @@ -922,7 +922,7 @@ func applyHyperVFeaturePreferences(preferenceSpec *instancetypev1alpha1.VirtualM } } -func applyFirmwarePreferences(preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { +func applyFirmwarePreferences(preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { if preferenceSpec.Firmware == nil { return @@ -953,7 +953,7 @@ func applyFirmwarePreferences(preferenceSpec *instancetypev1alpha1.VirtualMachin } } -func applyMachinePreferences(preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { +func applyMachinePreferences(preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { if preferenceSpec.Machine == nil { return @@ -968,7 +968,7 @@ func applyMachinePreferences(preferenceSpec *instancetypev1alpha1.VirtualMachine } } -func applyClockPreferences(preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { +func applyClockPreferences(preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *virtv1.VirtualMachineInstanceSpec) { if preferenceSpec.Clock == nil { return } diff --git a/pkg/instancetype/instancetype_test.go b/pkg/instancetype/instancetype_test.go index 481ecfd6ac72..a9e177559272 100644 --- a/pkg/instancetype/instancetype_test.go +++ b/pkg/instancetype/instancetype_test.go @@ -27,9 +27,9 @@ import ( v1 "kubevirt.io/api/core/v1" apiinstancetype "kubevirt.io/api/instancetype" - instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" + instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" fakeclientset "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/fake" - "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/instancetype/v1alpha1" + "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/instancetype/v1alpha2" ) const resourceUID types.UID = "9160e5de-2540-476a-86d9-af0081aee68a" @@ -43,7 +43,7 @@ var _ = Describe("Instancetype and Preferences", func() { vmi *v1.VirtualMachineInstance virtClient *kubecli.MockKubevirtClient vmInterface *kubecli.MockVirtualMachineInterface - fakeInstancetypeClients v1alpha1.InstancetypeV1alpha1Interface + fakeInstancetypeClients v1alpha2.InstancetypeV1alpha2Interface k8sClient *k8sfake.Clientset ) @@ -67,7 +67,7 @@ var _ = Describe("Instancetype and Preferences", func() { vmInterface = kubecli.NewMockVirtualMachineInterface(ctrl) virtClient.EXPECT().VirtualMachine(metav1.NamespaceDefault).Return(vmInterface).AnyTimes() virtClient.EXPECT().AppsV1().Return(k8sClient.AppsV1()).AnyTimes() - fakeInstancetypeClients = fakeclientset.NewSimpleClientset().InstancetypeV1alpha1() + fakeInstancetypeClients = fakeclientset.NewSimpleClientset().InstancetypeV1alpha2() instancetypeMethods = instancetype.NewMethods(virtClient) @@ -114,22 +114,22 @@ var _ = Describe("Instancetype and Preferences", func() { }) Context("Using global ClusterInstancetype", func() { - var clusterInstancetype *instancetypev1alpha1.VirtualMachineClusterInstancetype - var fakeClusterInstancetypeClient v1alpha1.VirtualMachineClusterInstancetypeInterface + var clusterInstancetype *instancetypev1alpha2.VirtualMachineClusterInstancetype + var fakeClusterInstancetypeClient v1alpha2.VirtualMachineClusterInstancetypeInterface BeforeEach(func() { fakeClusterInstancetypeClient = fakeInstancetypeClients.VirtualMachineClusterInstancetypes() virtClient.EXPECT().VirtualMachineClusterInstancetype().Return(fakeClusterInstancetypeClient).AnyTimes() - clusterInstancetype = &instancetypev1alpha1.VirtualMachineClusterInstancetype{ + clusterInstancetype = &instancetypev1alpha2.VirtualMachineClusterInstancetype{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster-instancetype", UID: resourceUID, Generation: resourceGeneration, }, - Spec: instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - CPU: instancetypev1alpha1.CPUInstancetype{ + Spec: instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + CPU: instancetypev1alpha2.CPUInstancetype{ Guest: uint32(2), }, }, @@ -220,8 +220,8 @@ var _ = Describe("Instancetype and Preferences", func() { It("store ControllerRevision fails if a revision exists with unexpected data", func() { - unexpectedInstancetypeSpec := instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - CPU: instancetypev1alpha1.CPUInstancetype{ + unexpectedInstancetypeSpec := instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + CPU: instancetypev1alpha2.CPUInstancetype{ Guest: 15, }, } @@ -246,23 +246,23 @@ var _ = Describe("Instancetype and Preferences", func() { }) Context("Using namespaced Instancetype", func() { - var f *instancetypev1alpha1.VirtualMachineInstancetype - var fakeInstancetypeClient v1alpha1.VirtualMachineInstancetypeInterface + var f *instancetypev1alpha2.VirtualMachineInstancetype + var fakeInstancetypeClient v1alpha2.VirtualMachineInstancetypeInterface BeforeEach(func() { fakeInstancetypeClient = fakeInstancetypeClients.VirtualMachineInstancetypes(vm.Namespace) virtClient.EXPECT().VirtualMachineInstancetype(gomock.Any()).Return(fakeInstancetypeClient).AnyTimes() - f = &instancetypev1alpha1.VirtualMachineInstancetype{ + f = &instancetypev1alpha2.VirtualMachineInstancetype{ ObjectMeta: metav1.ObjectMeta{ Name: "test-instancetype", Namespace: vm.Namespace, UID: resourceUID, Generation: resourceGeneration, }, - Spec: instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - CPU: instancetypev1alpha1.CPUInstancetype{ + Spec: instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + CPU: instancetypev1alpha2.CPUInstancetype{ Guest: uint32(2), }, }, @@ -351,8 +351,8 @@ var _ = Describe("Instancetype and Preferences", func() { It("store ControllerRevision fails if a revision exists with unexpected data", func() { - unexpectedInstancetypeSpec := instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - CPU: instancetypev1alpha1.CPUInstancetype{ + unexpectedInstancetypeSpec := instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + CPU: instancetypev1alpha2.CPUInstancetype{ Guest: 15, }, } @@ -448,23 +448,23 @@ var _ = Describe("Instancetype and Preferences", func() { }) Context("Using global ClusterPreference", func() { - var clusterPreference *instancetypev1alpha1.VirtualMachineClusterPreference - var fakeClusterPreferenceClient v1alpha1.VirtualMachineClusterPreferenceInterface + var clusterPreference *instancetypev1alpha2.VirtualMachineClusterPreference + var fakeClusterPreferenceClient v1alpha2.VirtualMachineClusterPreferenceInterface BeforeEach(func() { fakeClusterPreferenceClient = fakeInstancetypeClients.VirtualMachineClusterPreferences() virtClient.EXPECT().VirtualMachineClusterPreference().Return(fakeClusterPreferenceClient).AnyTimes() - clusterPreference = &instancetypev1alpha1.VirtualMachineClusterPreference{ + clusterPreference = &instancetypev1alpha2.VirtualMachineClusterPreference{ ObjectMeta: metav1.ObjectMeta{ Name: "test-cluster-preference", UID: resourceUID, Generation: resourceGeneration, }, - Spec: instancetypev1alpha1.VirtualMachinePreferenceSpec{ - CPU: &instancetypev1alpha1.CPUPreferences{ - PreferredCPUTopology: instancetypev1alpha1.PreferCores, + Spec: instancetypev1alpha2.VirtualMachinePreferenceSpec{ + CPU: &instancetypev1alpha2.CPUPreferences{ + PreferredCPUTopology: instancetypev1alpha2.PreferCores, }, }, } @@ -551,9 +551,9 @@ var _ = Describe("Instancetype and Preferences", func() { It("store ControllerRevision fails if a revision exists with unexpected data", func() { - unexpectedPreferenceSpec := instancetypev1alpha1.VirtualMachinePreferenceSpec{ - CPU: &instancetypev1alpha1.CPUPreferences{ - PreferredCPUTopology: instancetypev1alpha1.PreferThreads, + unexpectedPreferenceSpec := instancetypev1alpha2.VirtualMachinePreferenceSpec{ + CPU: &instancetypev1alpha2.CPUPreferences{ + PreferredCPUTopology: instancetypev1alpha2.PreferThreads, }, } @@ -568,24 +568,24 @@ var _ = Describe("Instancetype and Preferences", func() { }) Context("Using namespaced Preference", func() { - var preference *instancetypev1alpha1.VirtualMachinePreference - var fakePreferenceClient v1alpha1.VirtualMachinePreferenceInterface + var preference *instancetypev1alpha2.VirtualMachinePreference + var fakePreferenceClient v1alpha2.VirtualMachinePreferenceInterface BeforeEach(func() { fakePreferenceClient = fakeInstancetypeClients.VirtualMachinePreferences(vm.Namespace) virtClient.EXPECT().VirtualMachinePreference(gomock.Any()).Return(fakePreferenceClient).AnyTimes() - preference = &instancetypev1alpha1.VirtualMachinePreference{ + preference = &instancetypev1alpha2.VirtualMachinePreference{ ObjectMeta: metav1.ObjectMeta{ Name: "test-preference", Namespace: vm.Namespace, UID: resourceUID, Generation: resourceGeneration, }, - Spec: instancetypev1alpha1.VirtualMachinePreferenceSpec{ - CPU: &instancetypev1alpha1.CPUPreferences{ - PreferredCPUTopology: instancetypev1alpha1.PreferCores, + Spec: instancetypev1alpha2.VirtualMachinePreferenceSpec{ + CPU: &instancetypev1alpha2.CPUPreferences{ + PreferredCPUTopology: instancetypev1alpha2.PreferCores, }, }, } @@ -671,9 +671,9 @@ var _ = Describe("Instancetype and Preferences", func() { It("store ControllerRevision fails if a revision exists with unexpected data", func() { - unexpectedPreferenceSpec := instancetypev1alpha1.VirtualMachinePreferenceSpec{ - CPU: &instancetypev1alpha1.CPUPreferences{ - PreferredCPUTopology: instancetypev1alpha1.PreferThreads, + unexpectedPreferenceSpec := instancetypev1alpha2.VirtualMachinePreferenceSpec{ + CPU: &instancetypev1alpha2.CPUPreferences{ + PreferredCPUTopology: instancetypev1alpha2.PreferThreads, }, } @@ -730,8 +730,8 @@ var _ = Describe("Instancetype and Preferences", func() { Context("Apply", func() { var ( - instancetypeSpec *instancetypev1alpha1.VirtualMachineInstancetypeSpec - preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec + instancetypeSpec *instancetypev1alpha2.VirtualMachineInstancetypeSpec + preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec field *field.Path ) @@ -748,8 +748,8 @@ var _ = Describe("Instancetype and Preferences", func() { BeforeEach(func() { - instancetypeSpec = &instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - CPU: instancetypev1alpha1.CPUInstancetype{ + instancetypeSpec = &instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + CPU: instancetypev1alpha2.CPUInstancetype{ Guest: uint32(2), Model: "host-passthrough", DedicatedCPUPlacement: true, @@ -762,8 +762,8 @@ var _ = Describe("Instancetype and Preferences", func() { }, }, } - preferenceSpec = &instancetypev1alpha1.VirtualMachinePreferenceSpec{ - CPU: &instancetypev1alpha1.CPUPreferences{}, + preferenceSpec = &instancetypev1alpha2.VirtualMachinePreferenceSpec{ + CPU: &instancetypev1alpha2.CPUPreferences{}, } }) @@ -785,7 +785,7 @@ var _ = Describe("Instancetype and Preferences", func() { It("should apply in full with PreferCores selected", func() { - preferenceSpec.CPU.PreferredCPUTopology = instancetypev1alpha1.PreferCores + preferenceSpec.CPU.PreferredCPUTopology = instancetypev1alpha2.PreferCores conflicts := instancetypeMethods.ApplyToVmi(field, instancetypeSpec, preferenceSpec, &vmi.Spec) Expect(conflicts).To(BeEmpty()) @@ -803,7 +803,7 @@ var _ = Describe("Instancetype and Preferences", func() { It("should apply in full with PreferThreads selected", func() { - preferenceSpec.CPU.PreferredCPUTopology = instancetypev1alpha1.PreferThreads + preferenceSpec.CPU.PreferredCPUTopology = instancetypev1alpha2.PreferThreads conflicts := instancetypeMethods.ApplyToVmi(field, instancetypeSpec, preferenceSpec, &vmi.Spec) Expect(conflicts).To(BeEmpty()) @@ -821,7 +821,7 @@ var _ = Describe("Instancetype and Preferences", func() { It("should apply in full with PreferSockets selected", func() { - preferenceSpec.CPU.PreferredCPUTopology = instancetypev1alpha1.PreferSockets + preferenceSpec.CPU.PreferredCPUTopology = instancetypev1alpha2.PreferSockets conflicts := instancetypeMethods.ApplyToVmi(field, instancetypeSpec, preferenceSpec, &vmi.Spec) Expect(conflicts).To(BeEmpty()) @@ -839,8 +839,8 @@ var _ = Describe("Instancetype and Preferences", func() { It("should return a conflict if vmi.Spec.Domain.CPU already defined", func() { - instancetypeSpec = &instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - CPU: instancetypev1alpha1.CPUInstancetype{ + instancetypeSpec = &instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + CPU: instancetypev1alpha2.CPUInstancetype{ Guest: uint32(2), }, } @@ -859,8 +859,8 @@ var _ = Describe("Instancetype and Preferences", func() { It("should return a conflict if vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceCPU] already defined", func() { - instancetypeSpec = &instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - CPU: instancetypev1alpha1.CPUInstancetype{ + instancetypeSpec = &instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + CPU: instancetypev1alpha2.CPUInstancetype{ Guest: uint32(2), }, } @@ -879,8 +879,8 @@ var _ = Describe("Instancetype and Preferences", func() { It("should return a conflict if vmi.Spec.Domain.Resources.Limits[k8sv1.ResourceCPU] already defined", func() { - instancetypeSpec = &instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - CPU: instancetypev1alpha1.CPUInstancetype{ + instancetypeSpec = &instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + CPU: instancetypev1alpha2.CPUInstancetype{ Guest: uint32(2), }, } @@ -899,8 +899,8 @@ var _ = Describe("Instancetype and Preferences", func() { }) Context("instancetype.Spec.Memory", func() { BeforeEach(func() { - instancetypeSpec = &instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - Memory: instancetypev1alpha1.MemoryInstancetype{ + instancetypeSpec = &instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + Memory: instancetypev1alpha2.MemoryInstancetype{ Guest: resource.MustParse("512M"), Hugepages: &v1.Hugepages{ PageSize: "1Gi", @@ -934,8 +934,8 @@ var _ = Describe("Instancetype and Preferences", func() { It("should return a conflict if vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory] already defined", func() { - instancetypeSpec = &instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - Memory: instancetypev1alpha1.MemoryInstancetype{ + instancetypeSpec = &instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + Memory: instancetypev1alpha2.MemoryInstancetype{ Guest: resource.MustParse("512M"), }, } @@ -954,8 +954,8 @@ var _ = Describe("Instancetype and Preferences", func() { It("should return a conflict if vmi.Spec.Domain.Resources.Limits[k8sv1.ResourceMemory] already defined", func() { - instancetypeSpec = &instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - Memory: instancetypev1alpha1.MemoryInstancetype{ + instancetypeSpec = &instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + Memory: instancetypev1alpha2.MemoryInstancetype{ Guest: resource.MustParse("512M"), }, } @@ -978,7 +978,7 @@ var _ = Describe("Instancetype and Preferences", func() { BeforeEach(func() { instancetypePolicy = v1.IOThreadsPolicyShared - instancetypeSpec = &instancetypev1alpha1.VirtualMachineInstancetypeSpec{ + instancetypeSpec = &instancetypev1alpha2.VirtualMachineInstancetypeSpec{ IOThreadsPolicy: &instancetypePolicy, } }) @@ -1002,7 +1002,7 @@ var _ = Describe("Instancetype and Preferences", func() { Context("instancetype.Spec.LaunchSecurity", func() { BeforeEach(func() { - instancetypeSpec = &instancetypev1alpha1.VirtualMachineInstancetypeSpec{ + instancetypeSpec = &instancetypev1alpha2.VirtualMachineInstancetypeSpec{ LaunchSecurity: &v1.LaunchSecurity{ SEV: &v1.SEV{}, }, @@ -1030,7 +1030,7 @@ var _ = Describe("Instancetype and Preferences", func() { Context("instancetype.Spec.GPUs", func() { BeforeEach(func() { - instancetypeSpec = &instancetypev1alpha1.VirtualMachineInstancetypeSpec{ + instancetypeSpec = &instancetypev1alpha2.VirtualMachineInstancetypeSpec{ GPUs: []v1.GPU{ v1.GPU{ Name: "barfoo", @@ -1068,7 +1068,7 @@ var _ = Describe("Instancetype and Preferences", func() { Context("instancetype.Spec.HostDevices", func() { BeforeEach(func() { - instancetypeSpec = &instancetypev1alpha1.VirtualMachineInstancetypeSpec{ + instancetypeSpec = &instancetypev1alpha2.VirtualMachineInstancetypeSpec{ HostDevices: []v1.HostDevice{ v1.HostDevice{ Name: "foobar", @@ -1175,8 +1175,8 @@ var _ = Describe("Instancetype and Preferences", func() { } vmi.Spec.Domain.Devices.Sound = &v1.SoundDevice{} - preferenceSpec = &instancetypev1alpha1.VirtualMachinePreferenceSpec{ - Devices: &instancetypev1alpha1.DevicePreferences{ + preferenceSpec = &instancetypev1alpha2.VirtualMachinePreferenceSpec{ + Devices: &instancetypev1alpha2.DevicePreferences{ PreferredAutoattachGraphicsDevice: pointer.Bool(true), PreferredAutoattachMemBalloon: pointer.Bool(true), PreferredAutoattachPodInterface: pointer.Bool(true), @@ -1267,8 +1267,8 @@ var _ = Describe("Instancetype and Preferences", func() { BeforeEach(func() { spinLockRetries := uint32(32) - preferenceSpec = &instancetypev1alpha1.VirtualMachinePreferenceSpec{ - Features: &instancetypev1alpha1.FeaturePreferences{ + preferenceSpec = &instancetypev1alpha2.VirtualMachinePreferenceSpec{ + Features: &instancetypev1alpha2.FeaturePreferences{ PreferredAcpi: &v1.FeatureState{}, PreferredApic: &v1.FeatureAPIC{ Enabled: pointer.Bool(true), @@ -1341,8 +1341,8 @@ var _ = Describe("Instancetype and Preferences", func() { Context("Preference.Firmware", func() { It("should apply BIOS preferences full to VMI", func() { - preferenceSpec = &instancetypev1alpha1.VirtualMachinePreferenceSpec{ - Firmware: &instancetypev1alpha1.FirmwarePreferences{ + preferenceSpec = &instancetypev1alpha2.VirtualMachinePreferenceSpec{ + Firmware: &instancetypev1alpha2.FirmwarePreferences{ PreferredUseBios: pointer.Bool(true), PreferredUseBiosSerial: pointer.Bool(true), PreferredUseEfi: pointer.Bool(false), @@ -1357,8 +1357,8 @@ var _ = Describe("Instancetype and Preferences", func() { }) It("should apply SecureBoot preferences full to VMI", func() { - preferenceSpec = &instancetypev1alpha1.VirtualMachinePreferenceSpec{ - Firmware: &instancetypev1alpha1.FirmwarePreferences{ + preferenceSpec = &instancetypev1alpha2.VirtualMachinePreferenceSpec{ + Firmware: &instancetypev1alpha2.FirmwarePreferences{ PreferredUseBios: pointer.Bool(false), PreferredUseBiosSerial: pointer.Bool(false), PreferredUseEfi: pointer.Bool(true), @@ -1376,8 +1376,8 @@ var _ = Describe("Instancetype and Preferences", func() { Context("Preference.Machine", func() { It("should apply to VMI", func() { - preferenceSpec = &instancetypev1alpha1.VirtualMachinePreferenceSpec{ - Machine: &instancetypev1alpha1.MachinePreferences{ + preferenceSpec = &instancetypev1alpha2.VirtualMachinePreferenceSpec{ + Machine: &instancetypev1alpha2.MachinePreferences{ PreferredMachineType: "q35-rhel-8.0", }, } @@ -1391,8 +1391,8 @@ var _ = Describe("Instancetype and Preferences", func() { Context("Preference.Clock", func() { It("should apply to VMI", func() { - preferenceSpec = &instancetypev1alpha1.VirtualMachinePreferenceSpec{ - Clock: &instancetypev1alpha1.ClockPreferences{ + preferenceSpec = &instancetypev1alpha2.VirtualMachinePreferenceSpec{ + Clock: &instancetypev1alpha2.ClockPreferences{ PreferredClockOffset: &v1.ClockOffset{ UTC: &v1.ClockOffsetUTC{ OffsetSeconds: pointer.Int(30), diff --git a/pkg/testutils/BUILD.bazel b/pkg/testutils/BUILD.bazel index 7a0454ca8c4c..58c858ea83bb 100644 --- a/pkg/testutils/BUILD.bazel +++ b/pkg/testutils/BUILD.bazel @@ -16,7 +16,7 @@ go_library( "//pkg/virt-config:go_default_library", "//pkg/virt-launcher/virtwrap/api:go_default_library", "//staging/src/kubevirt.io/api/core/v1:go_default_library", - "//staging/src/kubevirt.io/api/instancetype/v1alpha1:go_default_library", + "//staging/src/kubevirt.io/api/instancetype/v1alpha2:go_default_library", "//vendor/github.com/onsi/gomega:go_default_library", "//vendor/github.com/onsi/gomega/types:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", diff --git a/pkg/testutils/mock_flavor.go b/pkg/testutils/mock_flavor.go index 2ea99b0e977c..d2851e61a73e 100644 --- a/pkg/testutils/mock_flavor.go +++ b/pkg/testutils/mock_flavor.go @@ -4,29 +4,29 @@ import ( k8sfield "k8s.io/apimachinery/pkg/util/validation/field" v1 "kubevirt.io/api/core/v1" - instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" + instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" "kubevirt.io/kubevirt/pkg/instancetype" ) type MockInstancetypeMethods struct { - FindInstancetypeSpecFunc func(vm *v1.VirtualMachine) (*instancetypev1alpha1.VirtualMachineInstancetypeSpec, error) - ApplyToVmiFunc func(field *k8sfield.Path, instancetypespec *instancetypev1alpha1.VirtualMachineInstancetypeSpec, preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *v1.VirtualMachineInstanceSpec) instancetype.Conflicts - FindPreferenceSpecFunc func(vm *v1.VirtualMachine) (*instancetypev1alpha1.VirtualMachinePreferenceSpec, error) + FindInstancetypeSpecFunc func(vm *v1.VirtualMachine) (*instancetypev1alpha2.VirtualMachineInstancetypeSpec, error) + ApplyToVmiFunc func(field *k8sfield.Path, instancetypespec *instancetypev1alpha2.VirtualMachineInstancetypeSpec, preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *v1.VirtualMachineInstanceSpec) instancetype.Conflicts + FindPreferenceSpecFunc func(vm *v1.VirtualMachine) (*instancetypev1alpha2.VirtualMachinePreferenceSpec, error) StoreControllerRevisionsFunc func(vm *v1.VirtualMachine) error } var _ instancetype.Methods = &MockInstancetypeMethods{} -func (m *MockInstancetypeMethods) FindInstancetypeSpec(vm *v1.VirtualMachine) (*instancetypev1alpha1.VirtualMachineInstancetypeSpec, error) { +func (m *MockInstancetypeMethods) FindInstancetypeSpec(vm *v1.VirtualMachine) (*instancetypev1alpha2.VirtualMachineInstancetypeSpec, error) { return m.FindInstancetypeSpecFunc(vm) } -func (m *MockInstancetypeMethods) ApplyToVmi(field *k8sfield.Path, instancetypespec *instancetypev1alpha1.VirtualMachineInstancetypeSpec, preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *v1.VirtualMachineInstanceSpec) instancetype.Conflicts { +func (m *MockInstancetypeMethods) ApplyToVmi(field *k8sfield.Path, instancetypespec *instancetypev1alpha2.VirtualMachineInstancetypeSpec, preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *v1.VirtualMachineInstanceSpec) instancetype.Conflicts { return m.ApplyToVmiFunc(field, instancetypespec, preferenceSpec, vmiSpec) } -func (m *MockInstancetypeMethods) FindPreferenceSpec(vm *v1.VirtualMachine) (*instancetypev1alpha1.VirtualMachinePreferenceSpec, error) { +func (m *MockInstancetypeMethods) FindPreferenceSpec(vm *v1.VirtualMachine) (*instancetypev1alpha2.VirtualMachinePreferenceSpec, error) { return m.FindPreferenceSpecFunc(vm) } @@ -36,13 +36,13 @@ func (m *MockInstancetypeMethods) StoreControllerRevisions(vm *v1.VirtualMachine func NewMockInstancetypeMethods() *MockInstancetypeMethods { return &MockInstancetypeMethods{ - FindInstancetypeSpecFunc: func(_ *v1.VirtualMachine) (*instancetypev1alpha1.VirtualMachineInstancetypeSpec, error) { + FindInstancetypeSpecFunc: func(_ *v1.VirtualMachine) (*instancetypev1alpha2.VirtualMachineInstancetypeSpec, error) { return nil, nil }, - ApplyToVmiFunc: func(_ *k8sfield.Path, _ *instancetypev1alpha1.VirtualMachineInstancetypeSpec, _ *instancetypev1alpha1.VirtualMachinePreferenceSpec, _ *v1.VirtualMachineInstanceSpec) instancetype.Conflicts { + ApplyToVmiFunc: func(_ *k8sfield.Path, _ *instancetypev1alpha2.VirtualMachineInstancetypeSpec, _ *instancetypev1alpha2.VirtualMachinePreferenceSpec, _ *v1.VirtualMachineInstanceSpec) instancetype.Conflicts { return nil }, - FindPreferenceSpecFunc: func(_ *v1.VirtualMachine) (*instancetypev1alpha1.VirtualMachinePreferenceSpec, error) { + FindPreferenceSpecFunc: func(_ *v1.VirtualMachine) (*instancetypev1alpha2.VirtualMachinePreferenceSpec, error) { return nil, nil }, StoreControllerRevisionsFunc: func(_ *v1.VirtualMachine) error { diff --git a/pkg/virt-api/definitions/BUILD.bazel b/pkg/virt-api/definitions/BUILD.bazel index d04accdc2dd5..38dba65e0dc5 100644 --- a/pkg/virt-api/definitions/BUILD.bazel +++ b/pkg/virt-api/definitions/BUILD.bazel @@ -16,7 +16,7 @@ go_library( "//staging/src/kubevirt.io/api/core/v1:go_default_library", "//staging/src/kubevirt.io/api/export/v1alpha1:go_default_library", "//staging/src/kubevirt.io/api/instancetype:go_default_library", - "//staging/src/kubevirt.io/api/instancetype/v1alpha1:go_default_library", + "//staging/src/kubevirt.io/api/instancetype/v1alpha2:go_default_library", "//staging/src/kubevirt.io/api/migrations:go_default_library", "//staging/src/kubevirt.io/api/migrations/v1alpha1:go_default_library", "//staging/src/kubevirt.io/api/pool/v1alpha1:go_default_library", diff --git a/pkg/virt-api/definitions/definitions.go b/pkg/virt-api/definitions/definitions.go index e1979d2ac322..3847002de040 100644 --- a/pkg/virt-api/definitions/definitions.go +++ b/pkg/virt-api/definitions/definitions.go @@ -41,7 +41,7 @@ import ( v1 "kubevirt.io/api/core/v1" exportv1 "kubevirt.io/api/export/v1alpha1" - instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" + instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" poolv1alpha1 "kubevirt.io/api/pool/v1alpha1" snapshotv1 "kubevirt.io/api/snapshot/v1alpha1" @@ -194,32 +194,32 @@ func migrationPoliciesApiServiceDefinitions() []*restful.WebService { } func instancetypeApiServiceDefinitions() []*restful.WebService { - instancetypeGVR := instancetypev1alpha1.SchemeGroupVersion.WithResource(instancetype.PluralResourceName) - clusterInstancetypeGVR := instancetypev1alpha1.SchemeGroupVersion.WithResource(instancetype.ClusterPluralResourceName) - preferenceGVR := instancetypev1alpha1.SchemeGroupVersion.WithResource(instancetype.PluralPreferenceResourceName) - clusterPreferenceGVR := instancetypev1alpha1.SchemeGroupVersion.WithResource(instancetype.ClusterPluralPreferenceResourceName) + instancetypeGVR := instancetypev1alpha2.SchemeGroupVersion.WithResource(instancetype.PluralResourceName) + clusterInstancetypeGVR := instancetypev1alpha2.SchemeGroupVersion.WithResource(instancetype.ClusterPluralResourceName) + preferenceGVR := instancetypev1alpha2.SchemeGroupVersion.WithResource(instancetype.PluralPreferenceResourceName) + clusterPreferenceGVR := instancetypev1alpha2.SchemeGroupVersion.WithResource(instancetype.ClusterPluralPreferenceResourceName) - ws, err := groupVersionProxyBase(instancetypev1alpha1.SchemeGroupVersion) + ws, err := groupVersionProxyBase(instancetypev1alpha2.SchemeGroupVersion) if err != nil { panic(err) } - ws, err = genericNamespacedResourceProxy(ws, instancetypeGVR, &instancetypev1alpha1.VirtualMachineInstancetype{}, "VirtualMachineInstancetype", &instancetypev1alpha1.VirtualMachineInstancetypeList{}) + ws, err = genericNamespacedResourceProxy(ws, instancetypeGVR, &instancetypev1alpha2.VirtualMachineInstancetype{}, "VirtualMachineInstancetype", &instancetypev1alpha2.VirtualMachineInstancetypeList{}) if err != nil { panic(err) } - ws, err = genericClusterResourceProxy(ws, clusterInstancetypeGVR, &instancetypev1alpha1.VirtualMachineClusterInstancetype{}, "VirtualMachineClusterInstancetype", &instancetypev1alpha1.VirtualMachineClusterInstancetypeList{}) + ws, err = genericClusterResourceProxy(ws, clusterInstancetypeGVR, &instancetypev1alpha2.VirtualMachineClusterInstancetype{}, "VirtualMachineClusterInstancetype", &instancetypev1alpha2.VirtualMachineClusterInstancetypeList{}) if err != nil { panic(err) } - ws, err = genericNamespacedResourceProxy(ws, preferenceGVR, &instancetypev1alpha1.VirtualMachinePreference{}, "VirtualMachinePreference", &instancetypev1alpha1.VirtualMachinePreferenceList{}) + ws, err = genericNamespacedResourceProxy(ws, preferenceGVR, &instancetypev1alpha2.VirtualMachinePreference{}, "VirtualMachinePreference", &instancetypev1alpha2.VirtualMachinePreferenceList{}) if err != nil { panic(err) } - ws, err = genericClusterResourceProxy(ws, clusterPreferenceGVR, &instancetypev1alpha1.VirtualMachineClusterPreference{}, "VirtualMachineClusterPreference", &instancetypev1alpha1.VirtualMachineClusterPreferenceList{}) + ws, err = genericClusterResourceProxy(ws, clusterPreferenceGVR, &instancetypev1alpha2.VirtualMachineClusterPreference{}, "VirtualMachineClusterPreference", &instancetypev1alpha2.VirtualMachineClusterPreferenceList{}) if err != nil { panic(err) } diff --git a/pkg/virt-api/rest/BUILD.bazel b/pkg/virt-api/rest/BUILD.bazel index 7df289172557..c5cbb12d487f 100644 --- a/pkg/virt-api/rest/BUILD.bazel +++ b/pkg/virt-api/rest/BUILD.bazel @@ -74,7 +74,7 @@ go_test( "//pkg/virt-config:go_default_library", "//staging/src/kubevirt.io/api/core:go_default_library", "//staging/src/kubevirt.io/api/core/v1:go_default_library", - "//staging/src/kubevirt.io/api/instancetype/v1alpha1:go_default_library", + "//staging/src/kubevirt.io/api/instancetype/v1alpha2:go_default_library", "//staging/src/kubevirt.io/client-go/api:go_default_library", "//staging/src/kubevirt.io/client-go/generated/containerized-data-importer/clientset/versioned/fake:go_default_library", "//staging/src/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/fake:go_default_library", diff --git a/pkg/virt-api/rest/expand_test.go b/pkg/virt-api/rest/expand_test.go index e46bb912061b..b5d363ba20ee 100644 --- a/pkg/virt-api/rest/expand_test.go +++ b/pkg/virt-api/rest/expand_test.go @@ -20,7 +20,7 @@ import ( kubevirtcore "kubevirt.io/api/core" v1 "kubevirt.io/api/core/v1" - instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" + instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/fake" "kubevirt.io/client-go/kubecli" @@ -93,7 +93,7 @@ var _ = Describe("Instancetype expansion subresources", func() { }) It("should fail if VM points to nonexistent instancetype", func() { - instancetypeMethods.FindInstancetypeSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha1.VirtualMachineInstancetypeSpec, error) { + instancetypeMethods.FindInstancetypeSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha2.VirtualMachineInstancetypeSpec, error) { return nil, fmt.Errorf("instancetype does not exist") } @@ -106,7 +106,7 @@ var _ = Describe("Instancetype expansion subresources", func() { }) It("should fail if VM points to nonexistent preference", func() { - instancetypeMethods.FindPreferenceSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha1.VirtualMachinePreferenceSpec, error) { + instancetypeMethods.FindPreferenceSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha2.VirtualMachinePreferenceSpec, error) { return nil, fmt.Errorf("preference does not exist") } @@ -119,13 +119,13 @@ var _ = Describe("Instancetype expansion subresources", func() { }) It("should apply instancetype to VM", func() { - instancetypeMethods.FindInstancetypeSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha1.VirtualMachineInstancetypeSpec, error) { - return &instancetypev1alpha1.VirtualMachineInstancetypeSpec{}, nil + instancetypeMethods.FindInstancetypeSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha2.VirtualMachineInstancetypeSpec, error) { + return &instancetypev1alpha2.VirtualMachineInstancetypeSpec{}, nil } cpu := &v1.CPU{Cores: 2} - instancetypeMethods.ApplyToVmiFunc = func(field *k8sfield.Path, instancetypespec *instancetypev1alpha1.VirtualMachineInstancetypeSpec, preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *v1.VirtualMachineInstanceSpec) instancetype.Conflicts { + instancetypeMethods.ApplyToVmiFunc = func(field *k8sfield.Path, instancetypespec *instancetypev1alpha2.VirtualMachineInstancetypeSpec, preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *v1.VirtualMachineInstanceSpec) instancetype.Conflicts { vmiSpec.Domain.CPU = cpu return nil } @@ -145,12 +145,12 @@ var _ = Describe("Instancetype expansion subresources", func() { }) It("should apply preference to VM", func() { - instancetypeMethods.FindPreferenceSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha1.VirtualMachinePreferenceSpec, error) { - return &instancetypev1alpha1.VirtualMachinePreferenceSpec{}, nil + instancetypeMethods.FindPreferenceSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha2.VirtualMachinePreferenceSpec, error) { + return &instancetypev1alpha2.VirtualMachinePreferenceSpec{}, nil } machineType := "test-machine" - instancetypeMethods.ApplyToVmiFunc = func(field *k8sfield.Path, instancetypespec *instancetypev1alpha1.VirtualMachineInstancetypeSpec, preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *v1.VirtualMachineInstanceSpec) instancetype.Conflicts { + instancetypeMethods.ApplyToVmiFunc = func(field *k8sfield.Path, instancetypespec *instancetypev1alpha2.VirtualMachineInstancetypeSpec, preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *v1.VirtualMachineInstanceSpec) instancetype.Conflicts { vmiSpec.Domain.Machine = &v1.Machine{Type: machineType} return nil } @@ -170,11 +170,11 @@ var _ = Describe("Instancetype expansion subresources", func() { }) It("should fail, if there is a conflict when applying instancetype", func() { - instancetypeMethods.FindInstancetypeSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha1.VirtualMachineInstancetypeSpec, error) { - return &instancetypev1alpha1.VirtualMachineInstancetypeSpec{}, nil + instancetypeMethods.FindInstancetypeSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha2.VirtualMachineInstancetypeSpec, error) { + return &instancetypev1alpha2.VirtualMachineInstancetypeSpec{}, nil } - instancetypeMethods.ApplyToVmiFunc = func(field *k8sfield.Path, instancetypespec *instancetypev1alpha1.VirtualMachineInstancetypeSpec, preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *v1.VirtualMachineInstanceSpec) instancetype.Conflicts { + instancetypeMethods.ApplyToVmiFunc = func(field *k8sfield.Path, instancetypespec *instancetypev1alpha2.VirtualMachineInstancetypeSpec, preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *v1.VirtualMachineInstanceSpec) instancetype.Conflicts { return instancetype.Conflicts{k8sfield.NewPath("spec", "template", "spec", "example", "path")} } diff --git a/pkg/virt-api/webhooks/validating-webhook/admitters/BUILD.bazel b/pkg/virt-api/webhooks/validating-webhook/admitters/BUILD.bazel index 06eb75434826..1654755ae731 100644 --- a/pkg/virt-api/webhooks/validating-webhook/admitters/BUILD.bazel +++ b/pkg/virt-api/webhooks/validating-webhook/admitters/BUILD.bazel @@ -42,7 +42,7 @@ go_library( "//staging/src/kubevirt.io/api/core/v1:go_default_library", "//staging/src/kubevirt.io/api/export/v1alpha1:go_default_library", "//staging/src/kubevirt.io/api/instancetype:go_default_library", - "//staging/src/kubevirt.io/api/instancetype/v1alpha1:go_default_library", + "//staging/src/kubevirt.io/api/instancetype/v1alpha2:go_default_library", "//staging/src/kubevirt.io/api/migrations:go_default_library", "//staging/src/kubevirt.io/api/migrations/v1alpha1:go_default_library", "//staging/src/kubevirt.io/api/pool/v1alpha1:go_default_library", @@ -105,7 +105,7 @@ go_test( "//staging/src/kubevirt.io/api/core/v1:go_default_library", "//staging/src/kubevirt.io/api/export/v1alpha1:go_default_library", "//staging/src/kubevirt.io/api/instancetype:go_default_library", - "//staging/src/kubevirt.io/api/instancetype/v1alpha1:go_default_library", + "//staging/src/kubevirt.io/api/instancetype/v1alpha2:go_default_library", "//staging/src/kubevirt.io/api/migrations:go_default_library", "//staging/src/kubevirt.io/api/migrations/v1alpha1:go_default_library", "//staging/src/kubevirt.io/api/pool/v1alpha1:go_default_library", diff --git a/pkg/virt-api/webhooks/validating-webhook/admitters/instancetype-admitter.go b/pkg/virt-api/webhooks/validating-webhook/admitters/instancetype-admitter.go index 31b5d048eb94..48f81a3aece0 100644 --- a/pkg/virt-api/webhooks/validating-webhook/admitters/instancetype-admitter.go +++ b/pkg/virt-api/webhooks/validating-webhook/admitters/instancetype-admitter.go @@ -9,7 +9,7 @@ import ( admissionv1 "k8s.io/api/admission/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" + instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" webhookutils "kubevirt.io/kubevirt/pkg/util/webhooks" validating_webhooks "kubevirt.io/kubevirt/pkg/util/webhooks/validating-webhooks" @@ -22,12 +22,12 @@ var _ validating_webhooks.Admitter = &InstancetypeAdmitter{} func (f *InstancetypeAdmitter) Admit(ar *admissionv1.AdmissionReview) *admissionv1.AdmissionResponse { return admitInstancetype(ar, metav1.GroupVersionResource{ - Group: instancetypev1alpha1.SchemeGroupVersion.Group, - Version: instancetypev1alpha1.SchemeGroupVersion.Version, + Group: instancetypev1alpha2.SchemeGroupVersion.Group, + Version: instancetypev1alpha2.SchemeGroupVersion.Version, Resource: instancetype.PluralResourceName, }, - func(raw []byte) (*instancetypev1alpha1.VirtualMachineInstancetype, error) { - instancetypeObj := &instancetypev1alpha1.VirtualMachineInstancetype{} + func(raw []byte) (*instancetypev1alpha2.VirtualMachineInstancetype, error) { + instancetypeObj := &instancetypev1alpha2.VirtualMachineInstancetype{} err := json.Unmarshal(raw, &instancetypeObj) if err != nil { return nil, err @@ -37,7 +37,7 @@ func (f *InstancetypeAdmitter) Admit(ar *admissionv1.AdmissionReview) *admission ) } -type extractInstancetypeFunc = func([]byte) (*instancetypev1alpha1.VirtualMachineInstancetype, error) +type extractInstancetypeFunc = func([]byte) (*instancetypev1alpha2.VirtualMachineInstancetype, error) func admitInstancetype(ar *admissionv1.AdmissionReview, expectedGvr metav1.GroupVersionResource, extractInstancetype extractInstancetypeFunc) *admissionv1.AdmissionResponse { // Only handle create and update @@ -70,12 +70,12 @@ var _ validating_webhooks.Admitter = &ClusterInstancetypeAdmitter{} func (f *ClusterInstancetypeAdmitter) Admit(ar *admissionv1.AdmissionReview) *admissionv1.AdmissionResponse { return admitClusterInstancetype(ar, metav1.GroupVersionResource{ - Group: instancetypev1alpha1.SchemeGroupVersion.Group, - Version: instancetypev1alpha1.SchemeGroupVersion.Version, + Group: instancetypev1alpha2.SchemeGroupVersion.Group, + Version: instancetypev1alpha2.SchemeGroupVersion.Version, Resource: instancetype.ClusterPluralResourceName, }, - func(raw []byte) (*instancetypev1alpha1.VirtualMachineClusterInstancetype, error) { - clusterInstancetypeObj := &instancetypev1alpha1.VirtualMachineClusterInstancetype{} + func(raw []byte) (*instancetypev1alpha2.VirtualMachineClusterInstancetype, error) { + clusterInstancetypeObj := &instancetypev1alpha2.VirtualMachineClusterInstancetype{} err := json.Unmarshal(raw, &clusterInstancetypeObj) if err != nil { return nil, err @@ -85,7 +85,7 @@ func (f *ClusterInstancetypeAdmitter) Admit(ar *admissionv1.AdmissionReview) *ad ) } -type extractClusterInstancetypeFunc = func([]byte) (*instancetypev1alpha1.VirtualMachineClusterInstancetype, error) +type extractClusterInstancetypeFunc = func([]byte) (*instancetypev1alpha2.VirtualMachineClusterInstancetype, error) func admitClusterInstancetype(ar *admissionv1.AdmissionReview, expectedGvr metav1.GroupVersionResource, extractClusterInstancetype extractClusterInstancetypeFunc) *admissionv1.AdmissionResponse { // Only handle create and update diff --git a/pkg/virt-api/webhooks/validating-webhook/admitters/instancetype-admitter_test.go b/pkg/virt-api/webhooks/validating-webhook/admitters/instancetype-admitter_test.go index d49b99b99a25..dc71fc256876 100644 --- a/pkg/virt-api/webhooks/validating-webhook/admitters/instancetype-admitter_test.go +++ b/pkg/virt-api/webhooks/validating-webhook/admitters/instancetype-admitter_test.go @@ -13,19 +13,19 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" + instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" ) var _ = Describe("Validating Instancetype Admitter", func() { var ( admitter *InstancetypeAdmitter - instancetypeObj *instancetypev1alpha1.VirtualMachineInstancetype + instancetypeObj *instancetypev1alpha2.VirtualMachineInstancetype ) BeforeEach(func() { admitter = &InstancetypeAdmitter{} - instancetypeObj = &instancetypev1alpha1.VirtualMachineInstancetype{ + instancetypeObj = &instancetypev1alpha2.VirtualMachineInstancetype{ ObjectMeta: metav1.ObjectMeta{ Name: "test-name", Namespace: "test-namespace", @@ -52,13 +52,13 @@ var _ = Describe("Validating Instancetype Admitter", func() { var _ = Describe("Validating ClusterInstancetype Admitter", func() { var ( admitter *ClusterInstancetypeAdmitter - clusterInstancetypeObj *instancetypev1alpha1.VirtualMachineClusterInstancetype + clusterInstancetypeObj *instancetypev1alpha2.VirtualMachineClusterInstancetype ) BeforeEach(func() { admitter = &ClusterInstancetypeAdmitter{} - clusterInstancetypeObj = &instancetypev1alpha1.VirtualMachineClusterInstancetype{ + clusterInstancetypeObj = &instancetypev1alpha2.VirtualMachineClusterInstancetype{ ObjectMeta: metav1.ObjectMeta{ Name: "test-name", Namespace: "test-namespace", @@ -82,7 +82,7 @@ var _ = Describe("Validating ClusterInstancetype Admitter", func() { }) }) -func createInstancetypeAdmissionReview(instancetype *instancetypev1alpha1.VirtualMachineInstancetype) *admissionv1.AdmissionReview { +func createInstancetypeAdmissionReview(instancetype *instancetypev1alpha2.VirtualMachineInstancetype) *admissionv1.AdmissionReview { bytes, err := json.Marshal(instancetype) ExpectWithOffset(1, err).ToNot(HaveOccurred(), "Could not JSON encode instancetype: %v", instancetype) @@ -90,8 +90,8 @@ func createInstancetypeAdmissionReview(instancetype *instancetypev1alpha1.Virtua Request: &admissionv1.AdmissionRequest{ Operation: admissionv1.Create, Resource: metav1.GroupVersionResource{ - Group: instancetypev1alpha1.SchemeGroupVersion.Group, - Version: instancetypev1alpha1.SchemeGroupVersion.Version, + Group: instancetypev1alpha2.SchemeGroupVersion.Group, + Version: instancetypev1alpha2.SchemeGroupVersion.Version, Resource: apiinstancetype.PluralResourceName, }, Object: runtime.RawExtension{ @@ -101,7 +101,7 @@ func createInstancetypeAdmissionReview(instancetype *instancetypev1alpha1.Virtua } } -func createClusterInstancetypeAdmissionReview(clusterInstancetype *instancetypev1alpha1.VirtualMachineClusterInstancetype) *admissionv1.AdmissionReview { +func createClusterInstancetypeAdmissionReview(clusterInstancetype *instancetypev1alpha2.VirtualMachineClusterInstancetype) *admissionv1.AdmissionReview { bytes, err := json.Marshal(clusterInstancetype) ExpectWithOffset(1, err).ToNot(HaveOccurred(), "Could not JSON encode instancetype: %v", clusterInstancetype) @@ -109,8 +109,8 @@ func createClusterInstancetypeAdmissionReview(clusterInstancetype *instancetypev Request: &admissionv1.AdmissionRequest{ Operation: admissionv1.Create, Resource: metav1.GroupVersionResource{ - Group: instancetypev1alpha1.SchemeGroupVersion.Group, - Version: instancetypev1alpha1.SchemeGroupVersion.Version, + Group: instancetypev1alpha2.SchemeGroupVersion.Group, + Version: instancetypev1alpha2.SchemeGroupVersion.Version, Resource: apiinstancetype.ClusterPluralResourceName, }, Object: runtime.RawExtension{ diff --git a/pkg/virt-api/webhooks/validating-webhook/admitters/preference-admitter.go b/pkg/virt-api/webhooks/validating-webhook/admitters/preference-admitter.go index dc063b61adb5..ad11a951c4d2 100644 --- a/pkg/virt-api/webhooks/validating-webhook/admitters/preference-admitter.go +++ b/pkg/virt-api/webhooks/validating-webhook/admitters/preference-admitter.go @@ -9,7 +9,7 @@ import ( admissionv1 "k8s.io/api/admission/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" + instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" webhookutils "kubevirt.io/kubevirt/pkg/util/webhooks" validating_webhooks "kubevirt.io/kubevirt/pkg/util/webhooks/validating-webhooks" @@ -22,12 +22,12 @@ var _ validating_webhooks.Admitter = &InstancetypeAdmitter{} func (f *PreferenceAdmitter) Admit(ar *admissionv1.AdmissionReview) *admissionv1.AdmissionResponse { return admitPreference(ar, metav1.GroupVersionResource{ - Group: instancetypev1alpha1.SchemeGroupVersion.Group, - Version: instancetypev1alpha1.SchemeGroupVersion.Version, + Group: instancetypev1alpha2.SchemeGroupVersion.Group, + Version: instancetypev1alpha2.SchemeGroupVersion.Version, Resource: instancetype.PluralPreferenceResourceName, }, - func(raw []byte) (*instancetypev1alpha1.VirtualMachinePreference, error) { - preferenceObj := &instancetypev1alpha1.VirtualMachinePreference{} + func(raw []byte) (*instancetypev1alpha2.VirtualMachinePreference, error) { + preferenceObj := &instancetypev1alpha2.VirtualMachinePreference{} err := json.Unmarshal(raw, &preferenceObj) if err != nil { return nil, err @@ -37,7 +37,7 @@ func (f *PreferenceAdmitter) Admit(ar *admissionv1.AdmissionReview) *admissionv1 ) } -type extractPreferenceFunc = func([]byte) (*instancetypev1alpha1.VirtualMachinePreference, error) +type extractPreferenceFunc = func([]byte) (*instancetypev1alpha2.VirtualMachinePreference, error) func admitPreference(ar *admissionv1.AdmissionReview, expectedGvr metav1.GroupVersionResource, extractPreference extractPreferenceFunc) *admissionv1.AdmissionResponse { // Only handle create and update @@ -70,12 +70,12 @@ var _ validating_webhooks.Admitter = &ClusterInstancetypeAdmitter{} func (f *ClusterPreferenceAdmitter) Admit(ar *admissionv1.AdmissionReview) *admissionv1.AdmissionResponse { return admitClusterPreference(ar, metav1.GroupVersionResource{ - Group: instancetypev1alpha1.SchemeGroupVersion.Group, - Version: instancetypev1alpha1.SchemeGroupVersion.Version, + Group: instancetypev1alpha2.SchemeGroupVersion.Group, + Version: instancetypev1alpha2.SchemeGroupVersion.Version, Resource: instancetype.ClusterPluralPreferenceResourceName, }, - func(raw []byte) (*instancetypev1alpha1.VirtualMachineClusterPreference, error) { - clusterPreferenceObj := &instancetypev1alpha1.VirtualMachineClusterPreference{} + func(raw []byte) (*instancetypev1alpha2.VirtualMachineClusterPreference, error) { + clusterPreferenceObj := &instancetypev1alpha2.VirtualMachineClusterPreference{} err := json.Unmarshal(raw, &clusterPreferenceObj) if err != nil { return nil, err @@ -85,7 +85,7 @@ func (f *ClusterPreferenceAdmitter) Admit(ar *admissionv1.AdmissionReview) *admi ) } -type extractClusterPreferenceFunc = func([]byte) (*instancetypev1alpha1.VirtualMachineClusterPreference, error) +type extractClusterPreferenceFunc = func([]byte) (*instancetypev1alpha2.VirtualMachineClusterPreference, error) func admitClusterPreference(ar *admissionv1.AdmissionReview, expectedGvr metav1.GroupVersionResource, extractClusterPreference extractClusterPreferenceFunc) *admissionv1.AdmissionResponse { // Only handle create and update diff --git a/pkg/virt-api/webhooks/validating-webhook/admitters/vms-admitter_test.go b/pkg/virt-api/webhooks/validating-webhook/admitters/vms-admitter_test.go index fbd51e50b783..08c44204ad39 100644 --- a/pkg/virt-api/webhooks/validating-webhook/admitters/vms-admitter_test.go +++ b/pkg/virt-api/webhooks/validating-webhook/admitters/vms-admitter_test.go @@ -41,7 +41,7 @@ import ( "k8s.io/client-go/tools/cache" instancetypeapi "kubevirt.io/api/instancetype" - instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" + instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" v1 "kubevirt.io/api/core/v1" cdiv1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" @@ -1447,7 +1447,7 @@ var _ = Describe("Validating VM Admitter", func() { }) It("should reject if instancetype is not found", func() { - instancetypeMethods.FindInstancetypeSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha1.VirtualMachineInstancetypeSpec, error) { + instancetypeMethods.FindInstancetypeSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha2.VirtualMachineInstancetypeSpec, error) { return nil, fmt.Errorf("instancetype not found") } @@ -1459,7 +1459,7 @@ var _ = Describe("Validating VM Admitter", func() { }) It("should reject if preference is not found", func() { - instancetypeMethods.FindPreferenceSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha1.VirtualMachinePreferenceSpec, error) { + instancetypeMethods.FindPreferenceSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha2.VirtualMachinePreferenceSpec, error) { return nil, fmt.Errorf("preference not found") } @@ -1476,16 +1476,16 @@ var _ = Describe("Validating VM Admitter", func() { path1 = basePath.Child("example", "path") path2 = basePath.Child("domain", "example", "path") ) - instancetypeMethods.FindInstancetypeSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha1.VirtualMachineInstancetypeSpec, error) { - return &instancetypev1alpha1.VirtualMachineInstancetypeSpec{}, nil + instancetypeMethods.FindInstancetypeSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha2.VirtualMachineInstancetypeSpec, error) { + return &instancetypev1alpha2.VirtualMachineInstancetypeSpec{}, nil } - instancetypeMethods.FindInstancetypeSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha1.VirtualMachineInstancetypeSpec, error) { - return &instancetypev1alpha1.VirtualMachineInstancetypeSpec{}, nil + instancetypeMethods.FindInstancetypeSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha2.VirtualMachineInstancetypeSpec, error) { + return &instancetypev1alpha2.VirtualMachineInstancetypeSpec{}, nil } - instancetypeMethods.FindPreferenceSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha1.VirtualMachinePreferenceSpec, error) { - return &instancetypev1alpha1.VirtualMachinePreferenceSpec{}, nil + instancetypeMethods.FindPreferenceSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha2.VirtualMachinePreferenceSpec, error) { + return &instancetypev1alpha2.VirtualMachinePreferenceSpec{}, nil } - instancetypeMethods.ApplyToVmiFunc = func(_ *k8sfield.Path, _ *instancetypev1alpha1.VirtualMachineInstancetypeSpec, _ *instancetypev1alpha1.VirtualMachinePreferenceSpec, _ *v1.VirtualMachineInstanceSpec) instancetype.Conflicts { + instancetypeMethods.ApplyToVmiFunc = func(_ *k8sfield.Path, _ *instancetypev1alpha2.VirtualMachineInstancetypeSpec, _ *instancetypev1alpha2.VirtualMachinePreferenceSpec, _ *v1.VirtualMachineInstanceSpec) instancetype.Conflicts { return instancetype.Conflicts{path1, path2} } @@ -1504,10 +1504,10 @@ var _ = Describe("Validating VM Admitter", func() { Expect(response.Allowed).To(BeTrue()) // Instancetype application sets invalid memory value - instancetypeMethods.FindInstancetypeSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha1.VirtualMachineInstancetypeSpec, error) { - return &instancetypev1alpha1.VirtualMachineInstancetypeSpec{}, nil + instancetypeMethods.FindInstancetypeSpecFunc = func(_ *v1.VirtualMachine) (*instancetypev1alpha2.VirtualMachineInstancetypeSpec, error) { + return &instancetypev1alpha2.VirtualMachineInstancetypeSpec{}, nil } - instancetypeMethods.ApplyToVmiFunc = func(_ *k8sfield.Path, _ *instancetypev1alpha1.VirtualMachineInstancetypeSpec, _ *instancetypev1alpha1.VirtualMachinePreferenceSpec, vmiSpec *v1.VirtualMachineInstanceSpec) instancetype.Conflicts { + instancetypeMethods.ApplyToVmiFunc = func(_ *k8sfield.Path, _ *instancetypev1alpha2.VirtualMachineInstancetypeSpec, _ *instancetypev1alpha2.VirtualMachinePreferenceSpec, vmiSpec *v1.VirtualMachineInstanceSpec) instancetype.Conflicts { vmiSpec.Domain.Resources.Requests[k8sv1.ResourceMemory] = resource.MustParse("-1Mi") return nil } diff --git a/pkg/virt-controller/watch/BUILD.bazel b/pkg/virt-controller/watch/BUILD.bazel index b73f16c200d2..151811a1c755 100644 --- a/pkg/virt-controller/watch/BUILD.bazel +++ b/pkg/virt-controller/watch/BUILD.bazel @@ -54,7 +54,7 @@ go_library( "//staging/src/kubevirt.io/api/clone/v1alpha1:go_default_library", "//staging/src/kubevirt.io/api/core/v1:go_default_library", "//staging/src/kubevirt.io/api/export/v1alpha1:go_default_library", - "//staging/src/kubevirt.io/api/instancetype/v1alpha1:go_default_library", + "//staging/src/kubevirt.io/api/instancetype/v1alpha2:go_default_library", "//staging/src/kubevirt.io/api/migrations/v1alpha1:go_default_library", "//staging/src/kubevirt.io/api/pool/v1alpha1:go_default_library", "//staging/src/kubevirt.io/api/snapshot/v1alpha1:go_default_library", @@ -135,14 +135,14 @@ go_test( "//staging/src/kubevirt.io/api/core/v1:go_default_library", "//staging/src/kubevirt.io/api/export/v1alpha1:go_default_library", "//staging/src/kubevirt.io/api/instancetype:go_default_library", - "//staging/src/kubevirt.io/api/instancetype/v1alpha1:go_default_library", + "//staging/src/kubevirt.io/api/instancetype/v1alpha2:go_default_library", "//staging/src/kubevirt.io/api/migrations/v1alpha1:go_default_library", "//staging/src/kubevirt.io/api/pool/v1alpha1:go_default_library", "//staging/src/kubevirt.io/api/snapshot/v1alpha1:go_default_library", "//staging/src/kubevirt.io/client-go/api:go_default_library", "//staging/src/kubevirt.io/client-go/generated/containerized-data-importer/clientset/versioned/fake:go_default_library", "//staging/src/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/fake:go_default_library", - "//staging/src/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/instancetype/v1alpha1:go_default_library", + "//staging/src/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/instancetype/v1alpha2:go_default_library", "//staging/src/kubevirt.io/client-go/generated/network-attachment-definition-client/clientset/versioned/fake:go_default_library", "//staging/src/kubevirt.io/client-go/kubecli:go_default_library", "//staging/src/kubevirt.io/client-go/log:go_default_library", diff --git a/pkg/virt-controller/watch/vm.go b/pkg/virt-controller/watch/vm.go index 4a2e7fb66149..3613ff52acb0 100644 --- a/pkg/virt-controller/watch/vm.go +++ b/pkg/virt-controller/watch/vm.go @@ -45,7 +45,7 @@ import ( "k8s.io/utils/trace" virtv1 "kubevirt.io/api/core/v1" - instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" + instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" "kubevirt.io/client-go/kubecli" "kubevirt.io/client-go/log" cdiv1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" @@ -1213,7 +1213,7 @@ func (c *VMController) setupVMIFromVM(vm *virtv1.VirtualMachine) *virtv1.Virtual return vmi } -func (c *VMController) applyInstancetypeToVmi(vm *virtv1.VirtualMachine, vmi *virtv1.VirtualMachineInstance, preferenceSpec *instancetypev1alpha1.VirtualMachinePreferenceSpec) error { +func (c *VMController) applyInstancetypeToVmi(vm *virtv1.VirtualMachine, vmi *virtv1.VirtualMachineInstance, preferenceSpec *instancetypev1alpha2.VirtualMachinePreferenceSpec) error { instancetypeSpec, err := c.instancetypeMethods.FindInstancetypeSpec(vm) if err != nil { @@ -2279,7 +2279,7 @@ func autoAttachInputDevice(vmi *virtv1.VirtualMachineInstance) { ) } -func (c *VMController) applyDevicePreferences(vm *virtv1.VirtualMachine, vmi *virtv1.VirtualMachineInstance) (*instancetypev1alpha1.VirtualMachinePreferenceSpec, error) { +func (c *VMController) applyDevicePreferences(vm *virtv1.VirtualMachine, vmi *virtv1.VirtualMachineInstance) (*instancetypev1alpha2.VirtualMachinePreferenceSpec, error) { if vm.Spec.Preference != nil { preferenceSpec, err := c.instancetypeMethods.FindPreferenceSpec(vm) if err != nil { diff --git a/pkg/virt-controller/watch/vm_test.go b/pkg/virt-controller/watch/vm_test.go index 566a000becdf..8768a43e99de 100644 --- a/pkg/virt-controller/watch/vm_test.go +++ b/pkg/virt-controller/watch/vm_test.go @@ -28,12 +28,12 @@ import ( v1 "kubevirt.io/api/core/v1" virtv1 "kubevirt.io/api/core/v1" instancetypeapi "kubevirt.io/api/instancetype" - instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" + instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" "kubevirt.io/client-go/api" cdifake "kubevirt.io/client-go/generated/containerized-data-importer/clientset/versioned/fake" "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/fake" fakeclientset "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/fake" - "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/instancetype/v1alpha1" + "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/instancetype/v1alpha2" "kubevirt.io/client-go/kubecli" cdiv1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" @@ -2775,11 +2775,11 @@ var _ = Describe("VirtualMachine", func() { vm *virtv1.VirtualMachine vmi *virtv1.VirtualMachineInstance - fakeInstancetypeClients v1alpha1.InstancetypeV1alpha1Interface - fakeInstancetypeClient v1alpha1.VirtualMachineInstancetypeInterface - fakeClusterInstancetypeClient v1alpha1.VirtualMachineClusterInstancetypeInterface - fakePreferenceClient v1alpha1.VirtualMachinePreferenceInterface - fakeClusterPreferenceClient v1alpha1.VirtualMachineClusterPreferenceInterface + fakeInstancetypeClients v1alpha2.InstancetypeV1alpha2Interface + fakeInstancetypeClient v1alpha2.VirtualMachineInstancetypeInterface + fakeClusterInstancetypeClient v1alpha2.VirtualMachineClusterInstancetypeInterface + fakePreferenceClient v1alpha2.VirtualMachinePreferenceInterface + fakeClusterPreferenceClient v1alpha2.VirtualMachineClusterPreferenceInterface ) BeforeEach(func() { @@ -2788,7 +2788,7 @@ var _ = Describe("VirtualMachine", func() { // We need to clear the domainSpec here to ensure the instancetype doesn't conflict vm.Spec.Template.Spec.Domain = v1.DomainSpec{} - fakeInstancetypeClients = fakeclientset.NewSimpleClientset().InstancetypeV1alpha1() + fakeInstancetypeClients = fakeclientset.NewSimpleClientset().InstancetypeV1alpha2() fakeInstancetypeClient = fakeInstancetypeClients.VirtualMachineInstancetypes(metav1.NamespaceDefault) virtClient.EXPECT().VirtualMachineInstancetype(gomock.Any()).Return(fakeInstancetypeClient).AnyTimes() @@ -2810,20 +2810,20 @@ var _ = Describe("VirtualMachine", func() { Context("instancetype", func() { var ( - instancetypeObj *instancetypev1alpha1.VirtualMachineInstancetype - clusterInstancetypeObj *instancetypev1alpha1.VirtualMachineClusterInstancetype + instancetypeObj *instancetypev1alpha2.VirtualMachineInstancetype + clusterInstancetypeObj *instancetypev1alpha2.VirtualMachineClusterInstancetype ) BeforeEach(func() { - instancetypeSpec := instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - CPU: instancetypev1alpha1.CPUInstancetype{ + instancetypeSpec := instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + CPU: instancetypev1alpha2.CPUInstancetype{ Guest: uint32(2), }, - Memory: instancetypev1alpha1.MemoryInstancetype{ + Memory: instancetypev1alpha2.MemoryInstancetype{ Guest: resource.MustParse("128M"), }, } - instancetypeObj = &instancetypev1alpha1.VirtualMachineInstancetype{ + instancetypeObj = &instancetypev1alpha2.VirtualMachineInstancetype{ ObjectMeta: metav1.ObjectMeta{ Name: "instancetype", Namespace: vm.Namespace, @@ -2835,7 +2835,7 @@ var _ = Describe("VirtualMachine", func() { _, err := virtClient.VirtualMachineInstancetype(vm.Namespace).Create(context.Background(), instancetypeObj, metav1.CreateOptions{}) Expect(err).NotTo(HaveOccurred()) - clusterInstancetypeObj = &instancetypev1alpha1.VirtualMachineClusterInstancetype{ + clusterInstancetypeObj = &instancetypev1alpha2.VirtualMachineClusterInstancetype{ ObjectMeta: metav1.ObjectMeta{ Name: "clusterInstancetype", UID: resourceUID, @@ -2881,8 +2881,8 @@ var _ = Describe("VirtualMachine", func() { revision, err := virtClient.AppsV1().ControllerRevisions(vm.Namespace).Get(context.Background(), expectedRevisionName, metav1.GetOptions{}) Expect(err).ToNot(HaveOccurred()) - specRevision := instancetypev1alpha1.VirtualMachineInstancetypeSpecRevision{} - spec := instancetypev1alpha1.VirtualMachineInstancetypeSpec{} + specRevision := instancetypev1alpha2.VirtualMachineInstancetypeSpecRevision{} + spec := instancetypev1alpha2.VirtualMachineInstancetypeSpec{} Expect(json.Unmarshal(revision.Data.Raw, &specRevision)).To(Succeed()) Expect(json.Unmarshal(specRevision.Spec, &spec)).To(Succeed()) Expect(specRevision.APIVersion).To(Equal(instancetypeObj.TypeMeta.APIVersion)) @@ -2995,8 +2995,8 @@ var _ = Describe("VirtualMachine", func() { revision, err := virtClient.AppsV1().ControllerRevisions(vm.Namespace).Get(context.Background(), expectedRevisionName, metav1.GetOptions{}) Expect(err).ToNot(HaveOccurred()) - specRevision := instancetypev1alpha1.VirtualMachineInstancetypeSpecRevision{} - spec := instancetypev1alpha1.VirtualMachineInstancetypeSpec{} + specRevision := instancetypev1alpha2.VirtualMachineInstancetypeSpecRevision{} + spec := instancetypev1alpha2.VirtualMachineInstancetypeSpec{} Expect(json.Unmarshal(revision.Data.Raw, &specRevision)).To(Succeed()) Expect(json.Unmarshal(specRevision.Spec, &spec)).To(Succeed()) Expect(specRevision.APIVersion).To(Equal(clusterInstancetypeObj.TypeMeta.APIVersion)) @@ -3176,8 +3176,8 @@ var _ = Describe("VirtualMachine", func() { It("should reject if an existing ControllerRevision is found with unexpected VirtualMachineInstancetypeSpec data", func() { - unexpectedExistingSpec := instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - CPU: instancetypev1alpha1.CPUInstancetype{ + unexpectedExistingSpec := instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + CPU: instancetypev1alpha2.CPUInstancetype{ Guest: 15, }, } @@ -3213,23 +3213,23 @@ var _ = Describe("VirtualMachine", func() { Context("preference", func() { var ( - preference *instancetypev1alpha1.VirtualMachinePreference - clusterPreference *instancetypev1alpha1.VirtualMachineClusterPreference + preference *instancetypev1alpha2.VirtualMachinePreference + clusterPreference *instancetypev1alpha2.VirtualMachineClusterPreference ) BeforeEach(func() { - preferenceSpec := instancetypev1alpha1.VirtualMachinePreferenceSpec{ - Firmware: &instancetypev1alpha1.FirmwarePreferences{ + preferenceSpec := instancetypev1alpha2.VirtualMachinePreferenceSpec{ + Firmware: &instancetypev1alpha2.FirmwarePreferences{ PreferredUseEfi: pointer.Bool(true), }, - Devices: &instancetypev1alpha1.DevicePreferences{ + Devices: &instancetypev1alpha2.DevicePreferences{ PreferredDiskBus: virtv1.DiskBusVirtio, PreferredInterfaceModel: "virtio", PreferredInputBus: virtv1.InputBusUSB, PreferredInputType: virtv1.InputTypeTablet, }, } - preference = &instancetypev1alpha1.VirtualMachinePreference{ + preference = &instancetypev1alpha2.VirtualMachinePreference{ ObjectMeta: metav1.ObjectMeta{ Name: "preference", Namespace: vm.Namespace, @@ -3241,7 +3241,7 @@ var _ = Describe("VirtualMachine", func() { _, err := virtClient.VirtualMachinePreference(vm.Namespace).Create(context.Background(), preference, metav1.CreateOptions{}) Expect(err).NotTo(HaveOccurred()) - clusterPreference = &instancetypev1alpha1.VirtualMachineClusterPreference{ + clusterPreference = &instancetypev1alpha2.VirtualMachineClusterPreference{ ObjectMeta: metav1.ObjectMeta{ Name: "clusterPreference", UID: resourceUID, @@ -3288,8 +3288,8 @@ var _ = Describe("VirtualMachine", func() { preferenceRevision, err := virtClient.AppsV1().ControllerRevisions(vm.Namespace).Get(context.Background(), expectedPreferenceRevisionName, metav1.GetOptions{}) Expect(err).ToNot(HaveOccurred()) - preferenceSpecRevision := instancetypev1alpha1.VirtualMachinePreferenceSpecRevision{} - preferenceSpec := instancetypev1alpha1.VirtualMachinePreferenceSpec{} + preferenceSpecRevision := instancetypev1alpha2.VirtualMachinePreferenceSpecRevision{} + preferenceSpec := instancetypev1alpha2.VirtualMachinePreferenceSpec{} Expect(json.Unmarshal(preferenceRevision.Data.Raw, &preferenceSpecRevision)).To(Succeed()) Expect(json.Unmarshal(preferenceSpecRevision.Spec, &preferenceSpec)).To(Succeed()) Expect(preferenceSpecRevision.APIVersion).To(Equal(preference.TypeMeta.APIVersion)) @@ -3403,8 +3403,8 @@ var _ = Describe("VirtualMachine", func() { preferenceRevision, err := virtClient.AppsV1().ControllerRevisions(vm.Namespace).Get(context.Background(), expectedPreferenceRevisionName, metav1.GetOptions{}) Expect(err).ToNot(HaveOccurred()) - preferenceSpecRevision := instancetypev1alpha1.VirtualMachinePreferenceSpecRevision{} - preferenceSpec := instancetypev1alpha1.VirtualMachinePreferenceSpec{} + preferenceSpecRevision := instancetypev1alpha2.VirtualMachinePreferenceSpecRevision{} + preferenceSpec := instancetypev1alpha2.VirtualMachinePreferenceSpec{} Expect(json.Unmarshal(preferenceRevision.Data.Raw, &preferenceSpecRevision)).To(Succeed()) Expect(json.Unmarshal(preferenceSpecRevision.Spec, &preferenceSpec)).To(Succeed()) Expect(preferenceSpecRevision.APIVersion).To(Equal(clusterPreference.TypeMeta.APIVersion)) @@ -3554,9 +3554,9 @@ var _ = Describe("VirtualMachine", func() { It("should reject if an existing ControllerRevision is found with unexpected VirtualMachinePreferenceSpec data", func() { - unexpectedExistingSpec := instancetypev1alpha1.VirtualMachinePreferenceSpec{ - CPU: &instancetypev1alpha1.CPUPreferences{ - PreferredCPUTopology: instancetypev1alpha1.PreferThreads, + unexpectedExistingSpec := instancetypev1alpha2.VirtualMachinePreferenceSpec{ + CPU: &instancetypev1alpha2.CPUPreferences{ + PreferredCPUTopology: instancetypev1alpha2.PreferThreads, }, } @@ -3622,15 +3622,15 @@ var _ = Describe("VirtualMachine", func() { It("should apply preferredAutoattachPodInterface and skip adding default network interface", func() { - autoattachPodInterfacePreference := &instancetypev1alpha1.VirtualMachinePreference{ + autoattachPodInterfacePreference := &instancetypev1alpha2.VirtualMachinePreference{ ObjectMeta: metav1.ObjectMeta{ Name: "autoattachPodInterfacePreference", Namespace: vm.Namespace, UID: resourceUID, Generation: resourceGeneration, }, - Spec: instancetypev1alpha1.VirtualMachinePreferenceSpec{ - Devices: &instancetypev1alpha1.DevicePreferences{ + Spec: instancetypev1alpha2.VirtualMachinePreferenceSpec{ + Devices: &instancetypev1alpha2.DevicePreferences{ PreferredAutoattachPodInterface: pointer.Bool(false), }, }, @@ -3760,15 +3760,15 @@ var _ = Describe("VirtualMachine", func() { It("should apply preferences to preferredAutoattachInputDevice attached input device", func() { - autoattachInputDevicePreference := &instancetypev1alpha1.VirtualMachinePreference{ + autoattachInputDevicePreference := &instancetypev1alpha2.VirtualMachinePreference{ ObjectMeta: metav1.ObjectMeta{ Name: "autoattachInputDevicePreference", Namespace: vm.Namespace, UID: resourceUID, Generation: resourceGeneration, }, - Spec: instancetypev1alpha1.VirtualMachinePreferenceSpec{ - Devices: &instancetypev1alpha1.DevicePreferences{ + Spec: instancetypev1alpha2.VirtualMachinePreferenceSpec{ + Devices: &instancetypev1alpha2.DevicePreferences{ PreferredAutoattachInputDevice: pointer.Bool(true), PreferredInputBus: virtv1.InputBusVirtio, PreferredInputType: virtv1.InputTypeTablet, @@ -3809,15 +3809,15 @@ var _ = Describe("VirtualMachine", func() { It("should apply preferredAutoattachInputDevice and skip adding default input device", func() { - autoattachInputDevicePreference := &instancetypev1alpha1.VirtualMachinePreference{ + autoattachInputDevicePreference := &instancetypev1alpha2.VirtualMachinePreference{ ObjectMeta: metav1.ObjectMeta{ Name: "preferredAutoattachInputDevicePreference", Namespace: vm.Namespace, UID: resourceUID, Generation: resourceGeneration, }, - Spec: instancetypev1alpha1.VirtualMachinePreferenceSpec{ - Devices: &instancetypev1alpha1.DevicePreferences{ + Spec: instancetypev1alpha2.VirtualMachinePreferenceSpec{ + Devices: &instancetypev1alpha2.DevicePreferences{ PreferredAutoattachInputDevice: pointer.Bool(false), }, }, diff --git a/pkg/virt-operator/resource/generate/components/webhooks.go b/pkg/virt-operator/resource/generate/components/webhooks.go index 809f69aa58a1..4acc9e3b8a27 100644 --- a/pkg/virt-operator/resource/generate/components/webhooks.go +++ b/pkg/virt-operator/resource/generate/components/webhooks.go @@ -21,7 +21,7 @@ import ( virtv1 "kubevirt.io/api/core/v1" exportv1 "kubevirt.io/api/export/v1alpha1" - instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" + instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" poolv1 "kubevirt.io/api/pool/v1alpha1" snapshotv1 "kubevirt.io/api/snapshot/v1alpha1" ) @@ -612,8 +612,8 @@ func NewVirtAPIValidatingWebhookConfiguration(installNamespace string) *admissio admissionregistrationv1.Update, }, Rule: admissionregistrationv1.Rule{ - APIGroups: []string{instancetypev1alpha1.SchemeGroupVersion.Group}, - APIVersions: []string{instancetypev1alpha1.SchemeGroupVersion.Version}, + APIGroups: []string{instancetypev1alpha2.SchemeGroupVersion.Group}, + APIVersions: []string{instancetypev1alpha2.SchemeGroupVersion.Version}, Resources: []string{instancetype.PluralResourceName}, }, }}, @@ -637,8 +637,8 @@ func NewVirtAPIValidatingWebhookConfiguration(installNamespace string) *admissio admissionregistrationv1.Update, }, Rule: admissionregistrationv1.Rule{ - APIGroups: []string{instancetypev1alpha1.SchemeGroupVersion.Group}, - APIVersions: []string{instancetypev1alpha1.SchemeGroupVersion.Version}, + APIGroups: []string{instancetypev1alpha2.SchemeGroupVersion.Group}, + APIVersions: []string{instancetypev1alpha2.SchemeGroupVersion.Version}, Resources: []string{instancetype.ClusterPluralResourceName}, }, }}, @@ -662,8 +662,8 @@ func NewVirtAPIValidatingWebhookConfiguration(installNamespace string) *admissio admissionregistrationv1.Update, }, Rule: admissionregistrationv1.Rule{ - APIGroups: []string{instancetypev1alpha1.SchemeGroupVersion.Group}, - APIVersions: []string{instancetypev1alpha1.SchemeGroupVersion.Version}, + APIGroups: []string{instancetypev1alpha2.SchemeGroupVersion.Group}, + APIVersions: []string{instancetypev1alpha2.SchemeGroupVersion.Version}, Resources: []string{instancetype.PluralPreferenceResourceName}, }, }}, @@ -687,8 +687,8 @@ func NewVirtAPIValidatingWebhookConfiguration(installNamespace string) *admissio admissionregistrationv1.Update, }, Rule: admissionregistrationv1.Rule{ - APIGroups: []string{instancetypev1alpha1.SchemeGroupVersion.Group}, - APIVersions: []string{instancetypev1alpha1.SchemeGroupVersion.Version}, + APIGroups: []string{instancetypev1alpha2.SchemeGroupVersion.Group}, + APIVersions: []string{instancetypev1alpha2.SchemeGroupVersion.Version}, Resources: []string{instancetype.ClusterPluralPreferenceResourceName}, }, }}, diff --git a/staging/src/kubevirt.io/client-go/kubecli/BUILD.bazel b/staging/src/kubevirt.io/client-go/kubecli/BUILD.bazel index 685fd92bb5bc..5778431a0894 100644 --- a/staging/src/kubevirt.io/client-go/kubecli/BUILD.bazel +++ b/staging/src/kubevirt.io/client-go/kubecli/BUILD.bazel @@ -34,7 +34,7 @@ go_library( "//staging/src/kubevirt.io/client-go/generated/kubevirt/clientset/versioned:go_default_library", "//staging/src/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/clone/v1alpha1:go_default_library", "//staging/src/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/export/v1alpha1:go_default_library", - "//staging/src/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/instancetype/v1alpha1:go_default_library", + "//staging/src/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/instancetype/v1alpha2:go_default_library", "//staging/src/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/migrations/v1alpha1:go_default_library", "//staging/src/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/pool/v1alpha1:go_default_library", "//staging/src/kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/snapshot/v1alpha1:go_default_library", diff --git a/staging/src/kubevirt.io/client-go/kubecli/generated_mock_kubevirt.go b/staging/src/kubevirt.io/client-go/kubecli/generated_mock_kubevirt.go index 0e37be0e6517..98923e254bc2 100644 --- a/staging/src/kubevirt.io/client-go/kubecli/generated_mock_kubevirt.go +++ b/staging/src/kubevirt.io/client-go/kubecli/generated_mock_kubevirt.go @@ -69,10 +69,10 @@ import ( versioned1 "kubevirt.io/client-go/generated/kubevirt/clientset/versioned" v1alpha15 "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/clone/v1alpha1" v1alpha16 "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/export/v1alpha1" - v1alpha17 "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/instancetype/v1alpha1" - v1alpha18 "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/migrations/v1alpha1" - v1alpha19 "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/pool/v1alpha1" - v1alpha110 "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/snapshot/v1alpha1" + v1alpha2 "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/instancetype/v1alpha2" + v1alpha17 "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/migrations/v1alpha1" + v1alpha18 "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/pool/v1alpha1" + v1alpha19 "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/snapshot/v1alpha1" versioned2 "kubevirt.io/client-go/generated/network-attachment-definition-client/clientset/versioned" versioned3 "kubevirt.io/client-go/generated/prometheus-operator/clientset/versioned" version "kubevirt.io/client-go/version" @@ -129,9 +129,9 @@ func (_mr *_MockKubevirtClientRecorder) ReplicaSet(arg0 interface{}) *gomock.Cal return _mr.mock.ctrl.RecordCall(_mr.mock, "ReplicaSet", arg0) } -func (_m *MockKubevirtClient) VirtualMachinePool(namespace string) v1alpha19.VirtualMachinePoolInterface { +func (_m *MockKubevirtClient) VirtualMachinePool(namespace string) v1alpha18.VirtualMachinePoolInterface { ret := _m.ctrl.Call(_m, "VirtualMachinePool", namespace) - ret0, _ := ret[0].(v1alpha19.VirtualMachinePoolInterface) + ret0, _ := ret[0].(v1alpha18.VirtualMachinePoolInterface) return ret0 } @@ -169,9 +169,9 @@ func (_mr *_MockKubevirtClientRecorder) VirtualMachineInstancePreset(arg0 interf return _mr.mock.ctrl.RecordCall(_mr.mock, "VirtualMachineInstancePreset", arg0) } -func (_m *MockKubevirtClient) VirtualMachineSnapshot(namespace string) v1alpha110.VirtualMachineSnapshotInterface { +func (_m *MockKubevirtClient) VirtualMachineSnapshot(namespace string) v1alpha19.VirtualMachineSnapshotInterface { ret := _m.ctrl.Call(_m, "VirtualMachineSnapshot", namespace) - ret0, _ := ret[0].(v1alpha110.VirtualMachineSnapshotInterface) + ret0, _ := ret[0].(v1alpha19.VirtualMachineSnapshotInterface) return ret0 } @@ -179,9 +179,9 @@ func (_mr *_MockKubevirtClientRecorder) VirtualMachineSnapshot(arg0 interface{}) return _mr.mock.ctrl.RecordCall(_mr.mock, "VirtualMachineSnapshot", arg0) } -func (_m *MockKubevirtClient) VirtualMachineSnapshotContent(namespace string) v1alpha110.VirtualMachineSnapshotContentInterface { +func (_m *MockKubevirtClient) VirtualMachineSnapshotContent(namespace string) v1alpha19.VirtualMachineSnapshotContentInterface { ret := _m.ctrl.Call(_m, "VirtualMachineSnapshotContent", namespace) - ret0, _ := ret[0].(v1alpha110.VirtualMachineSnapshotContentInterface) + ret0, _ := ret[0].(v1alpha19.VirtualMachineSnapshotContentInterface) return ret0 } @@ -189,9 +189,9 @@ func (_mr *_MockKubevirtClientRecorder) VirtualMachineSnapshotContent(arg0 inter return _mr.mock.ctrl.RecordCall(_mr.mock, "VirtualMachineSnapshotContent", arg0) } -func (_m *MockKubevirtClient) VirtualMachineRestore(namespace string) v1alpha110.VirtualMachineRestoreInterface { +func (_m *MockKubevirtClient) VirtualMachineRestore(namespace string) v1alpha19.VirtualMachineRestoreInterface { ret := _m.ctrl.Call(_m, "VirtualMachineRestore", namespace) - ret0, _ := ret[0].(v1alpha110.VirtualMachineRestoreInterface) + ret0, _ := ret[0].(v1alpha19.VirtualMachineRestoreInterface) return ret0 } @@ -209,9 +209,9 @@ func (_mr *_MockKubevirtClientRecorder) VirtualMachineExport(arg0 interface{}) * return _mr.mock.ctrl.RecordCall(_mr.mock, "VirtualMachineExport", arg0) } -func (_m *MockKubevirtClient) VirtualMachineInstancetype(namespace string) v1alpha17.VirtualMachineInstancetypeInterface { +func (_m *MockKubevirtClient) VirtualMachineInstancetype(namespace string) v1alpha2.VirtualMachineInstancetypeInterface { ret := _m.ctrl.Call(_m, "VirtualMachineInstancetype", namespace) - ret0, _ := ret[0].(v1alpha17.VirtualMachineInstancetypeInterface) + ret0, _ := ret[0].(v1alpha2.VirtualMachineInstancetypeInterface) return ret0 } @@ -219,9 +219,9 @@ func (_mr *_MockKubevirtClientRecorder) VirtualMachineInstancetype(arg0 interfac return _mr.mock.ctrl.RecordCall(_mr.mock, "VirtualMachineInstancetype", arg0) } -func (_m *MockKubevirtClient) VirtualMachineClusterInstancetype() v1alpha17.VirtualMachineClusterInstancetypeInterface { +func (_m *MockKubevirtClient) VirtualMachineClusterInstancetype() v1alpha2.VirtualMachineClusterInstancetypeInterface { ret := _m.ctrl.Call(_m, "VirtualMachineClusterInstancetype") - ret0, _ := ret[0].(v1alpha17.VirtualMachineClusterInstancetypeInterface) + ret0, _ := ret[0].(v1alpha2.VirtualMachineClusterInstancetypeInterface) return ret0 } @@ -229,9 +229,9 @@ func (_mr *_MockKubevirtClientRecorder) VirtualMachineClusterInstancetype() *gom return _mr.mock.ctrl.RecordCall(_mr.mock, "VirtualMachineClusterInstancetype") } -func (_m *MockKubevirtClient) VirtualMachinePreference(namespace string) v1alpha17.VirtualMachinePreferenceInterface { +func (_m *MockKubevirtClient) VirtualMachinePreference(namespace string) v1alpha2.VirtualMachinePreferenceInterface { ret := _m.ctrl.Call(_m, "VirtualMachinePreference", namespace) - ret0, _ := ret[0].(v1alpha17.VirtualMachinePreferenceInterface) + ret0, _ := ret[0].(v1alpha2.VirtualMachinePreferenceInterface) return ret0 } @@ -239,9 +239,9 @@ func (_mr *_MockKubevirtClientRecorder) VirtualMachinePreference(arg0 interface{ return _mr.mock.ctrl.RecordCall(_mr.mock, "VirtualMachinePreference", arg0) } -func (_m *MockKubevirtClient) VirtualMachineClusterPreference() v1alpha17.VirtualMachineClusterPreferenceInterface { +func (_m *MockKubevirtClient) VirtualMachineClusterPreference() v1alpha2.VirtualMachineClusterPreferenceInterface { ret := _m.ctrl.Call(_m, "VirtualMachineClusterPreference") - ret0, _ := ret[0].(v1alpha17.VirtualMachineClusterPreferenceInterface) + ret0, _ := ret[0].(v1alpha2.VirtualMachineClusterPreferenceInterface) return ret0 } @@ -249,9 +249,9 @@ func (_mr *_MockKubevirtClientRecorder) VirtualMachineClusterPreference() *gomoc return _mr.mock.ctrl.RecordCall(_mr.mock, "VirtualMachineClusterPreference") } -func (_m *MockKubevirtClient) MigrationPolicy() v1alpha18.MigrationPolicyInterface { +func (_m *MockKubevirtClient) MigrationPolicy() v1alpha17.MigrationPolicyInterface { ret := _m.ctrl.Call(_m, "MigrationPolicy") - ret0, _ := ret[0].(v1alpha18.MigrationPolicyInterface) + ret0, _ := ret[0].(v1alpha17.MigrationPolicyInterface) return ret0 } @@ -419,9 +419,9 @@ func (_mr *_MockKubevirtClientRecorder) DynamicClient() *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "DynamicClient") } -func (_m *MockKubevirtClient) MigrationPolicyClient() *v1alpha18.MigrationsV1alpha1Client { +func (_m *MockKubevirtClient) MigrationPolicyClient() *v1alpha17.MigrationsV1alpha1Client { ret := _m.ctrl.Call(_m, "MigrationPolicyClient") - ret0, _ := ret[0].(*v1alpha18.MigrationsV1alpha1Client) + ret0, _ := ret[0].(*v1alpha17.MigrationsV1alpha1Client) return ret0 } diff --git a/staging/src/kubevirt.io/client-go/kubecli/kubevirt.go b/staging/src/kubevirt.io/client-go/kubecli/kubevirt.go index 5178bb74cee3..2feb471eddf1 100644 --- a/staging/src/kubevirt.io/client-go/kubecli/kubevirt.go +++ b/staging/src/kubevirt.io/client-go/kubecli/kubevirt.go @@ -50,7 +50,7 @@ import ( k8ssnapshotclient "kubevirt.io/client-go/generated/external-snapshotter/clientset/versioned" generatedclient "kubevirt.io/client-go/generated/kubevirt/clientset/versioned" vmexportv1alpha1 "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/export/v1alpha1" - instancetypev1alpha1 "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/instancetype/v1alpha1" + instancetypev1alpha2 "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/instancetype/v1alpha2" migrationsv1 "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/migrations/v1alpha1" poolv1 "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/pool/v1alpha1" vmsnapshotv1alpha1 "kubevirt.io/client-go/generated/kubevirt/clientset/versioned/typed/snapshot/v1alpha1" @@ -71,10 +71,10 @@ type KubevirtClient interface { VirtualMachineSnapshotContent(namespace string) vmsnapshotv1alpha1.VirtualMachineSnapshotContentInterface VirtualMachineRestore(namespace string) vmsnapshotv1alpha1.VirtualMachineRestoreInterface VirtualMachineExport(namespace string) vmexportv1alpha1.VirtualMachineExportInterface - VirtualMachineInstancetype(namespace string) instancetypev1alpha1.VirtualMachineInstancetypeInterface - VirtualMachineClusterInstancetype() instancetypev1alpha1.VirtualMachineClusterInstancetypeInterface - VirtualMachinePreference(namespace string) instancetypev1alpha1.VirtualMachinePreferenceInterface - VirtualMachineClusterPreference() instancetypev1alpha1.VirtualMachineClusterPreferenceInterface + VirtualMachineInstancetype(namespace string) instancetypev1alpha2.VirtualMachineInstancetypeInterface + VirtualMachineClusterInstancetype() instancetypev1alpha2.VirtualMachineClusterInstancetypeInterface + VirtualMachinePreference(namespace string) instancetypev1alpha2.VirtualMachinePreferenceInterface + VirtualMachineClusterPreference() instancetypev1alpha2.VirtualMachineClusterPreferenceInterface MigrationPolicy() migrationsv1.MigrationPolicyInterface ExpandSpec() *ExpandSpec ServerVersion() ServerVersionInterface @@ -177,20 +177,20 @@ func (k kubevirt) VirtualMachineExport(namespace string) vmexportv1alpha1.Virtua return k.generatedKubeVirtClient.ExportV1alpha1().VirtualMachineExports(namespace) } -func (k kubevirt) VirtualMachineInstancetype(namespace string) instancetypev1alpha1.VirtualMachineInstancetypeInterface { - return k.generatedKubeVirtClient.InstancetypeV1alpha1().VirtualMachineInstancetypes(namespace) +func (k kubevirt) VirtualMachineInstancetype(namespace string) instancetypev1alpha2.VirtualMachineInstancetypeInterface { + return k.generatedKubeVirtClient.InstancetypeV1alpha2().VirtualMachineInstancetypes(namespace) } -func (k kubevirt) VirtualMachineClusterInstancetype() instancetypev1alpha1.VirtualMachineClusterInstancetypeInterface { - return k.generatedKubeVirtClient.InstancetypeV1alpha1().VirtualMachineClusterInstancetypes() +func (k kubevirt) VirtualMachineClusterInstancetype() instancetypev1alpha2.VirtualMachineClusterInstancetypeInterface { + return k.generatedKubeVirtClient.InstancetypeV1alpha2().VirtualMachineClusterInstancetypes() } -func (k kubevirt) VirtualMachinePreference(namespace string) instancetypev1alpha1.VirtualMachinePreferenceInterface { - return k.generatedKubeVirtClient.InstancetypeV1alpha1().VirtualMachinePreferences(namespace) +func (k kubevirt) VirtualMachinePreference(namespace string) instancetypev1alpha2.VirtualMachinePreferenceInterface { + return k.generatedKubeVirtClient.InstancetypeV1alpha2().VirtualMachinePreferences(namespace) } -func (k kubevirt) VirtualMachineClusterPreference() instancetypev1alpha1.VirtualMachineClusterPreferenceInterface { - return k.generatedKubeVirtClient.InstancetypeV1alpha1().VirtualMachineClusterPreferences() +func (k kubevirt) VirtualMachineClusterPreference() instancetypev1alpha2.VirtualMachineClusterPreferenceInterface { + return k.generatedKubeVirtClient.InstancetypeV1alpha2().VirtualMachineClusterPreferences() } func (k kubevirt) KubernetesSnapshotClient() k8ssnapshotclient.Interface { diff --git a/tests/BUILD.bazel b/tests/BUILD.bazel index 57d6ec650601..4a54055ad57d 100644 --- a/tests/BUILD.bazel +++ b/tests/BUILD.bazel @@ -197,7 +197,7 @@ go_test( "//staging/src/kubevirt.io/api/core:go_default_library", "//staging/src/kubevirt.io/api/core/v1:go_default_library", "//staging/src/kubevirt.io/api/instancetype:go_default_library", - "//staging/src/kubevirt.io/api/instancetype/v1alpha1:go_default_library", + "//staging/src/kubevirt.io/api/instancetype/v1alpha2:go_default_library", "//staging/src/kubevirt.io/api/migrations/v1alpha1:go_default_library", "//staging/src/kubevirt.io/api/pool:go_default_library", "//staging/src/kubevirt.io/api/pool/v1alpha1:go_default_library", diff --git a/tests/instancetype_test.go b/tests/instancetype_test.go index a9535b15597b..f3d008bff240 100644 --- a/tests/instancetype_test.go +++ b/tests/instancetype_test.go @@ -19,7 +19,7 @@ import ( v1 "kubevirt.io/api/core/v1" virtv1 "kubevirt.io/api/core/v1" instancetypeapi "kubevirt.io/api/instancetype" - instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" + instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" "kubevirt.io/client-go/kubecli" k6ttypes "kubevirt.io/kubevirt/pkg/util/types" @@ -48,7 +48,7 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c Expect(err).ToNot(HaveOccurred()) }) - DescribeTable("[test_id:TODO] should reject invalid instancetype", func(instancetype instancetypev1alpha1.VirtualMachineInstancetype) { + DescribeTable("[test_id:TODO] should reject invalid instancetype", func(instancetype instancetypev1alpha2.VirtualMachineInstancetype) { _, err := virtClient.VirtualMachineInstancetype(util.NamespaceTestDefault). Create(context.Background(), &instancetype, metav1.CreateOptions{}) Expect(err).To(HaveOccurred()) @@ -57,34 +57,34 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c cause := apiStatus.Status().Details.Causes[0] Expect(cause.Type).To(Equal(metav1.CauseTypeFieldValueRequired)) }, - Entry("without CPU defined", instancetypev1alpha1.VirtualMachineInstancetype{ - Spec: instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - Memory: instancetypev1alpha1.MemoryInstancetype{ + Entry("without CPU defined", instancetypev1alpha2.VirtualMachineInstancetype{ + Spec: instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + Memory: instancetypev1alpha2.MemoryInstancetype{ Guest: resource.MustParse("128M"), }, }, }), - Entry("without CPU.Guest defined", instancetypev1alpha1.VirtualMachineInstancetype{ - Spec: instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - CPU: instancetypev1alpha1.CPUInstancetype{}, - Memory: instancetypev1alpha1.MemoryInstancetype{ + Entry("without CPU.Guest defined", instancetypev1alpha2.VirtualMachineInstancetype{ + Spec: instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + CPU: instancetypev1alpha2.CPUInstancetype{}, + Memory: instancetypev1alpha2.MemoryInstancetype{ Guest: resource.MustParse("128M"), }, }, }), - Entry("without Memory defined", instancetypev1alpha1.VirtualMachineInstancetype{ - Spec: instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - CPU: instancetypev1alpha1.CPUInstancetype{ + Entry("without Memory defined", instancetypev1alpha2.VirtualMachineInstancetype{ + Spec: instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + CPU: instancetypev1alpha2.CPUInstancetype{ Guest: 1, }, }, }), - Entry("without Memory.Guest defined", instancetypev1alpha1.VirtualMachineInstancetype{ - Spec: instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - CPU: instancetypev1alpha1.CPUInstancetype{ + Entry("without Memory.Guest defined", instancetypev1alpha2.VirtualMachineInstancetype{ + Spec: instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + CPU: instancetypev1alpha2.CPUInstancetype{ Guest: 1, }, - Memory: instancetypev1alpha1.MemoryInstancetype{}, + Memory: instancetypev1alpha2.MemoryInstancetype{}, }, }), ) @@ -193,8 +193,8 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c Expect(err).ToNot(HaveOccurred()) clusterPreference := newVirtualMachineClusterPreference() - clusterPreference.Spec.CPU = &instancetypev1alpha1.CPUPreferences{ - PreferredCPUTopology: instancetypev1alpha1.PreferSockets, + clusterPreference.Spec.CPU = &instancetypev1alpha2.CPUPreferences{ + PreferredCPUTopology: instancetypev1alpha2.PreferSockets, } clusterPreference, err = virtClient.VirtualMachineClusterPreference(). @@ -229,13 +229,13 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c Expect(err).ToNot(HaveOccurred()) preference := newVirtualMachinePreference() - preference.Spec.CPU = &instancetypev1alpha1.CPUPreferences{ - PreferredCPUTopology: instancetypev1alpha1.PreferSockets, + preference.Spec.CPU = &instancetypev1alpha2.CPUPreferences{ + PreferredCPUTopology: instancetypev1alpha2.PreferSockets, } - preference.Spec.Devices = &instancetypev1alpha1.DevicePreferences{ + preference.Spec.Devices = &instancetypev1alpha2.DevicePreferences{ PreferredDiskBus: v1.DiskBusSATA, } - preference.Spec.Features = &instancetypev1alpha1.FeaturePreferences{ + preference.Spec.Features = &instancetypev1alpha2.FeaturePreferences{ PreferredHyperv: &v1.FeatureHyperv{ VAPIC: &v1.FeatureState{ Enabled: pointer.Bool(true), @@ -245,7 +245,7 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c }, }, } - preference.Spec.Firmware = &instancetypev1alpha1.FirmwarePreferences{ + preference.Spec.Firmware = &instancetypev1alpha2.FirmwarePreferences{ PreferredUseBios: pointer.Bool(true), } @@ -276,7 +276,7 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c vmi, err = virtClient.VirtualMachineInstance(util.NamespaceTestDefault).Get(vm.Name, &metav1.GetOptions{}) Expect(err).ToNot(HaveOccurred()) - // Assert we've used sockets as instancetypev1alpha1.PreferSockets was requested + // Assert we've used sockets as instancetypev1alpha2.PreferSockets was requested Expect(vmi.Spec.Domain.CPU.Sockets).To(Equal(instancetype.Spec.CPU.Guest)) Expect(*vmi.Spec.Domain.Memory.Guest).To(Equal(instancetype.Spec.Memory.Guest)) @@ -383,7 +383,7 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c vmi := libvmi.NewCirros() clusterPreference := newVirtualMachineClusterPreference() - clusterPreference.Spec.Devices = &instancetypev1alpha1.DevicePreferences{ + clusterPreference.Spec.Devices = &instancetypev1alpha2.DevicePreferences{ PreferredInterfaceModel: "virtio", } @@ -411,7 +411,7 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c vmi := libvmi.NewCirros() clusterPreference := newVirtualMachineClusterPreference() - clusterPreference.Spec.Devices = &instancetypev1alpha1.DevicePreferences{ + clusterPreference.Spec.Devices = &instancetypev1alpha2.DevicePreferences{ PreferredDiskBus: v1.DiskBusVirtio, } @@ -450,9 +450,9 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c By("Creating a VirtualMachinePreference") preference := newVirtualMachinePreference() - preference.Spec = instancetypev1alpha1.VirtualMachinePreferenceSpec{ - CPU: &instancetypev1alpha1.CPUPreferences{ - PreferredCPUTopology: instancetypev1alpha1.PreferSockets, + preference.Spec = instancetypev1alpha2.VirtualMachinePreferenceSpec{ + CPU: &instancetypev1alpha2.CPUPreferences{ + PreferredCPUTopology: instancetypev1alpha2.PreferSockets, }, } preference, err = virtClient.VirtualMachinePreference(util.NamespaceTestDefault). @@ -487,8 +487,8 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c instancetypeRevision, err := virtClient.AppsV1().ControllerRevisions(util.NamespaceTestDefault).Get(context.Background(), vm.Spec.Instancetype.RevisionName, metav1.GetOptions{}) Expect(err).ToNot(HaveOccurred()) - stashedInstancetypeSpecRevision := instancetypev1alpha1.VirtualMachineInstancetypeSpecRevision{} - stashedInstancetypeSpec := instancetypev1alpha1.VirtualMachineInstancetypeSpec{} + stashedInstancetypeSpecRevision := instancetypev1alpha2.VirtualMachineInstancetypeSpecRevision{} + stashedInstancetypeSpec := instancetypev1alpha2.VirtualMachineInstancetypeSpec{} Expect(json.Unmarshal(instancetypeRevision.Data.Raw, &stashedInstancetypeSpecRevision)).To(Succeed()) Expect(stashedInstancetypeSpecRevision.APIVersion).To(Equal(instancetype.APIVersion)) Expect(json.Unmarshal(stashedInstancetypeSpecRevision.Spec, &stashedInstancetypeSpec)).To(Succeed()) @@ -497,8 +497,8 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c preferenceRevision, err := virtClient.AppsV1().ControllerRevisions(util.NamespaceTestDefault).Get(context.Background(), vm.Spec.Preference.RevisionName, metav1.GetOptions{}) Expect(err).ToNot(HaveOccurred()) - stashedPreferenceSpecRevision := instancetypev1alpha1.VirtualMachinePreferenceSpecRevision{} - stashedPreferenceSpec := instancetypev1alpha1.VirtualMachinePreferenceSpec{} + stashedPreferenceSpecRevision := instancetypev1alpha2.VirtualMachinePreferenceSpecRevision{} + stashedPreferenceSpec := instancetypev1alpha2.VirtualMachinePreferenceSpec{} Expect(json.Unmarshal(preferenceRevision.Data.Raw, &stashedPreferenceSpecRevision)).To(Succeed()) Expect(stashedPreferenceSpecRevision.APIVersion).To(Equal(preference.APIVersion)) Expect(json.Unmarshal(stashedPreferenceSpecRevision.Spec, &stashedPreferenceSpec)).To(Succeed()) @@ -559,8 +559,8 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c instancetypeRevision, err = virtClient.AppsV1().ControllerRevisions(util.NamespaceTestDefault).Get(context.Background(), newVM.Spec.Instancetype.RevisionName, metav1.GetOptions{}) Expect(err).ToNot(HaveOccurred()) - stashedInstancetypeSpecRevision = instancetypev1alpha1.VirtualMachineInstancetypeSpecRevision{} - stashedInstancetypeSpec = instancetypev1alpha1.VirtualMachineInstancetypeSpec{} + stashedInstancetypeSpecRevision = instancetypev1alpha2.VirtualMachineInstancetypeSpecRevision{} + stashedInstancetypeSpec = instancetypev1alpha2.VirtualMachineInstancetypeSpec{} Expect(json.Unmarshal(instancetypeRevision.Data.Raw, &stashedInstancetypeSpecRevision)).To(Succeed()) Expect(stashedInstancetypeSpecRevision.APIVersion).To(Equal(updatedInstancetype.APIVersion)) Expect(json.Unmarshal(stashedInstancetypeSpecRevision.Spec, &stashedInstancetypeSpec)).To(Succeed()) @@ -578,8 +578,8 @@ var _ = Describe("[crit:medium][vendor:cnv-qe@redhat.com][level:component][sig-c }) }) -func newVirtualMachineInstancetype(vmi *v1.VirtualMachineInstance) *instancetypev1alpha1.VirtualMachineInstancetype { - return &instancetypev1alpha1.VirtualMachineInstancetype{ +func newVirtualMachineInstancetype(vmi *v1.VirtualMachineInstance) *instancetypev1alpha2.VirtualMachineInstancetype { + return &instancetypev1alpha2.VirtualMachineInstancetype{ ObjectMeta: metav1.ObjectMeta{ GenerateName: "vm-instancetype-", Namespace: util.NamespaceTestDefault, @@ -588,8 +588,8 @@ func newVirtualMachineInstancetype(vmi *v1.VirtualMachineInstance) *instancetype } } -func newVirtualMachineClusterInstancetype(vmi *v1.VirtualMachineInstance) *instancetypev1alpha1.VirtualMachineClusterInstancetype { - return &instancetypev1alpha1.VirtualMachineClusterInstancetype{ +func newVirtualMachineClusterInstancetype(vmi *v1.VirtualMachineInstance) *instancetypev1alpha2.VirtualMachineClusterInstancetype { + return &instancetypev1alpha2.VirtualMachineClusterInstancetype{ ObjectMeta: metav1.ObjectMeta{ GenerateName: "vm-cluster-instancetype-", Namespace: util.NamespaceTestDefault, @@ -598,7 +598,7 @@ func newVirtualMachineClusterInstancetype(vmi *v1.VirtualMachineInstance) *insta } } -func newVirtualMachineInstancetypeSpec(vmi *v1.VirtualMachineInstance) instancetypev1alpha1.VirtualMachineInstancetypeSpec { +func newVirtualMachineInstancetypeSpec(vmi *v1.VirtualMachineInstance) instancetypev1alpha2.VirtualMachineInstancetypeSpec { // Copy the amount of memory set within the VMI so our tests don't randomly start using more resources guestMemory := resource.MustParse("128M") if vmi != nil { @@ -606,18 +606,18 @@ func newVirtualMachineInstancetypeSpec(vmi *v1.VirtualMachineInstance) instancet guestMemory = vmi.Spec.Domain.Resources.Requests[k8sv1.ResourceMemory].DeepCopy() } } - return instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - CPU: instancetypev1alpha1.CPUInstancetype{ + return instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + CPU: instancetypev1alpha2.CPUInstancetype{ Guest: uint32(1), }, - Memory: instancetypev1alpha1.MemoryInstancetype{ + Memory: instancetypev1alpha2.MemoryInstancetype{ Guest: guestMemory, }, } } -func newVirtualMachinePreference() *instancetypev1alpha1.VirtualMachinePreference { - return &instancetypev1alpha1.VirtualMachinePreference{ +func newVirtualMachinePreference() *instancetypev1alpha2.VirtualMachinePreference { + return &instancetypev1alpha2.VirtualMachinePreference{ ObjectMeta: metav1.ObjectMeta{ GenerateName: "vm-preference-", Namespace: util.NamespaceTestDefault, @@ -625,8 +625,8 @@ func newVirtualMachinePreference() *instancetypev1alpha1.VirtualMachinePreferenc } } -func newVirtualMachineClusterPreference() *instancetypev1alpha1.VirtualMachineClusterPreference { - return &instancetypev1alpha1.VirtualMachineClusterPreference{ +func newVirtualMachineClusterPreference() *instancetypev1alpha2.VirtualMachineClusterPreference { + return &instancetypev1alpha2.VirtualMachineClusterPreference{ ObjectMeta: metav1.ObjectMeta{ GenerateName: "vm-cluster-preference-", Namespace: util.NamespaceTestDefault, diff --git a/tests/subresource_api_test.go b/tests/subresource_api_test.go index ad6255d6d891..234378654a54 100644 --- a/tests/subresource_api_test.go +++ b/tests/subresource_api_test.go @@ -37,7 +37,7 @@ import ( v1 "kubevirt.io/api/core/v1" instancetypeapi "kubevirt.io/api/instancetype" - instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" + instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" "kubevirt.io/client-go/kubecli" "kubevirt.io/kubevirt/tests" @@ -245,7 +245,7 @@ var _ = Describe("[sig-compute]Subresource Api", func() { Context("ExpandSpec endpoint", func() { Context("instancetype", func() { var ( - instancetype *instancetypev1alpha1.VirtualMachineInstancetype + instancetype *instancetypev1alpha2.VirtualMachineInstancetype expectedCpu *v1.CPU vmi *v1.VirtualMachineInstance ) @@ -334,11 +334,11 @@ var _ = Describe("[sig-compute]Subresource Api", func() { }) Context("preference", func() { - var preference *instancetypev1alpha1.VirtualMachinePreference + var preference *instancetypev1alpha2.VirtualMachinePreference BeforeEach(func() { preference = newVirtualMachinePreference() - preference.Spec.Devices = &instancetypev1alpha1.DevicePreferences{ + preference.Spec.Devices = &instancetypev1alpha2.DevicePreferences{ PreferredAutoattachGraphicsDevice: pointer.Bool(true), } diff --git a/tools/vms-generator/BUILD.bazel b/tools/vms-generator/BUILD.bazel index 2a932aef6d9d..fc03f3ac9e47 100644 --- a/tools/vms-generator/BUILD.bazel +++ b/tools/vms-generator/BUILD.bazel @@ -9,7 +9,7 @@ go_library( "//pkg/testutils:go_default_library", "//pkg/virt-api/webhooks/validating-webhook/admitters:go_default_library", "//staging/src/kubevirt.io/api/core/v1:go_default_library", - "//staging/src/kubevirt.io/api/instancetype/v1alpha1:go_default_library", + "//staging/src/kubevirt.io/api/instancetype/v1alpha2:go_default_library", "//staging/src/kubevirt.io/api/pool/v1alpha1:go_default_library", "//tools/util:go_default_library", "//tools/vms-generator/utils:go_default_library", diff --git a/tools/vms-generator/utils/BUILD.bazel b/tools/vms-generator/utils/BUILD.bazel index 53e327e308db..91f7912e9ad3 100644 --- a/tools/vms-generator/utils/BUILD.bazel +++ b/tools/vms-generator/utils/BUILD.bazel @@ -10,7 +10,7 @@ go_library( visibility = ["//visibility:public"], deps = [ "//staging/src/kubevirt.io/api/core/v1:go_default_library", - "//staging/src/kubevirt.io/api/instancetype/v1alpha1:go_default_library", + "//staging/src/kubevirt.io/api/instancetype/v1alpha2:go_default_library", "//staging/src/kubevirt.io/api/pool/v1alpha1:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/api/scheduling/v1:go_default_library", diff --git a/tools/vms-generator/utils/utils.go b/tools/vms-generator/utils/utils.go index 4535131f4d57..cc3ab73da0ab 100644 --- a/tools/vms-generator/utils/utils.go +++ b/tools/vms-generator/utils/utils.go @@ -35,7 +35,7 @@ import ( "k8s.io/utils/pointer" v1 "kubevirt.io/api/core/v1" - instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" + instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" poolv1 "kubevirt.io/api/pool/v1alpha1" cdiv1 "kubevirt.io/containerized-data-importer-api/pkg/apis/core/v1beta1" ) @@ -1180,21 +1180,21 @@ func generateCloudConfigString(cloudConfigElement ...string) string { append([]string{cloudConfigHeader}, cloudConfigElement...), "\n") } -func GetComputeSmallInstancetypeSpec() instancetypev1alpha1.VirtualMachineInstancetypeSpec { - return instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - CPU: instancetypev1alpha1.CPUInstancetype{ +func GetComputeSmallInstancetypeSpec() instancetypev1alpha2.VirtualMachineInstancetypeSpec { + return instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + CPU: instancetypev1alpha2.CPUInstancetype{ Guest: uint32(1), }, - Memory: instancetypev1alpha1.MemoryInstancetype{ + Memory: instancetypev1alpha2.MemoryInstancetype{ Guest: resource.MustParse("128Mi"), }, } } -func GetVirtualMachineInstancetypeComputeSmall() *instancetypev1alpha1.VirtualMachineInstancetype { - return &instancetypev1alpha1.VirtualMachineInstancetype{ +func GetVirtualMachineInstancetypeComputeSmall() *instancetypev1alpha2.VirtualMachineInstancetype { + return &instancetypev1alpha2.VirtualMachineInstancetype{ TypeMeta: metav1.TypeMeta{ - APIVersion: instancetypev1alpha1.SchemeGroupVersion.String(), + APIVersion: instancetypev1alpha2.SchemeGroupVersion.String(), Kind: "VirtualMachineInstancetype", }, ObjectMeta: metav1.ObjectMeta{ @@ -1204,10 +1204,10 @@ func GetVirtualMachineInstancetypeComputeSmall() *instancetypev1alpha1.VirtualMa } } -func GetVirtualMachineClusterInstancetypeComputeSmall() *instancetypev1alpha1.VirtualMachineClusterInstancetype { - return &instancetypev1alpha1.VirtualMachineClusterInstancetype{ +func GetVirtualMachineClusterInstancetypeComputeSmall() *instancetypev1alpha2.VirtualMachineClusterInstancetype { + return &instancetypev1alpha2.VirtualMachineClusterInstancetype{ TypeMeta: metav1.TypeMeta{ - APIVersion: instancetypev1alpha1.SchemeGroupVersion.String(), + APIVersion: instancetypev1alpha2.SchemeGroupVersion.String(), Kind: "VirtualMachineClusterInstancetype", }, ObjectMeta: metav1.ObjectMeta{ @@ -1217,20 +1217,20 @@ func GetVirtualMachineClusterInstancetypeComputeSmall() *instancetypev1alpha1.Vi } } -func GetVirtualMachineInstancetypeComputeLarge() *instancetypev1alpha1.VirtualMachineInstancetype { - return &instancetypev1alpha1.VirtualMachineInstancetype{ +func GetVirtualMachineInstancetypeComputeLarge() *instancetypev1alpha2.VirtualMachineInstancetype { + return &instancetypev1alpha2.VirtualMachineInstancetype{ TypeMeta: metav1.TypeMeta{ - APIVersion: instancetypev1alpha1.SchemeGroupVersion.String(), + APIVersion: instancetypev1alpha2.SchemeGroupVersion.String(), Kind: "VirtualMachineInstancetype", }, ObjectMeta: metav1.ObjectMeta{ Name: VirtualMachineInstancetypeComputeLarge, }, - Spec: instancetypev1alpha1.VirtualMachineInstancetypeSpec{ - CPU: instancetypev1alpha1.CPUInstancetype{ + Spec: instancetypev1alpha2.VirtualMachineInstancetypeSpec{ + CPU: instancetypev1alpha2.CPUInstancetype{ Guest: uint32(4), }, - Memory: instancetypev1alpha1.MemoryInstancetype{ + Memory: instancetypev1alpha2.MemoryInstancetype{ Guest: resource.MustParse("2048Mi"), }, }, @@ -1287,17 +1287,17 @@ func GetVmCirrosInstancetypeComputeLarge() *v1.VirtualMachine { return vm } -func GetVirtualMachinePreferenceVirtio() *instancetypev1alpha1.VirtualMachinePreference { - return &instancetypev1alpha1.VirtualMachinePreference{ +func GetVirtualMachinePreferenceVirtio() *instancetypev1alpha2.VirtualMachinePreference { + return &instancetypev1alpha2.VirtualMachinePreference{ TypeMeta: metav1.TypeMeta{ - APIVersion: instancetypev1alpha1.SchemeGroupVersion.String(), + APIVersion: instancetypev1alpha2.SchemeGroupVersion.String(), Kind: "VirtualMachinePreference", }, ObjectMeta: metav1.ObjectMeta{ Name: VirtualMachinePreferenceVirtio, }, - Spec: instancetypev1alpha1.VirtualMachinePreferenceSpec{ - Devices: &instancetypev1alpha1.DevicePreferences{ + Spec: instancetypev1alpha2.VirtualMachinePreferenceSpec{ + Devices: &instancetypev1alpha2.DevicePreferences{ PreferredDiskBus: "virtio", PreferredInterfaceModel: "virtio", }, @@ -1305,21 +1305,21 @@ func GetVirtualMachinePreferenceVirtio() *instancetypev1alpha1.VirtualMachinePre } } -func GetVirtualMachinePreferenceWindows() *instancetypev1alpha1.VirtualMachinePreference { +func GetVirtualMachinePreferenceWindows() *instancetypev1alpha2.VirtualMachinePreference { spinlocks := uint32(8191) - return &instancetypev1alpha1.VirtualMachinePreference{ + return &instancetypev1alpha2.VirtualMachinePreference{ TypeMeta: metav1.TypeMeta{ - APIVersion: instancetypev1alpha1.SchemeGroupVersion.String(), + APIVersion: instancetypev1alpha2.SchemeGroupVersion.String(), Kind: "VirtualMachinePreference", }, ObjectMeta: metav1.ObjectMeta{ Name: VirtualMachinePreferenceWindows, }, - Spec: instancetypev1alpha1.VirtualMachinePreferenceSpec{ - CPU: &instancetypev1alpha1.CPUPreferences{ - PreferredCPUTopology: instancetypev1alpha1.PreferSockets, + Spec: instancetypev1alpha2.VirtualMachinePreferenceSpec{ + CPU: &instancetypev1alpha2.CPUPreferences{ + PreferredCPUTopology: instancetypev1alpha2.PreferSockets, }, - Clock: &instancetypev1alpha1.ClockPreferences{ + Clock: &instancetypev1alpha2.ClockPreferences{ PreferredClockOffset: &v1.ClockOffset{UTC: &v1.ClockOffsetUTC{}}, PreferredTimer: &v1.Timer{ HPET: &v1.HPETTimer{Enabled: pointer.Bool(false)}, @@ -1328,12 +1328,12 @@ func GetVirtualMachinePreferenceWindows() *instancetypev1alpha1.VirtualMachinePr Hyperv: &v1.HypervTimer{}, }, }, - Devices: &instancetypev1alpha1.DevicePreferences{ + Devices: &instancetypev1alpha2.DevicePreferences{ PreferredDiskBus: "sata", PreferredInterfaceModel: "e1000", PreferredTPM: &v1.TPMDevice{}, }, - Features: &instancetypev1alpha1.FeaturePreferences{ + Features: &instancetypev1alpha2.FeaturePreferences{ PreferredAcpi: &v1.FeatureState{}, PreferredApic: &v1.FeatureAPIC{}, PreferredHyperv: &v1.FeatureHyperv{ @@ -1343,7 +1343,7 @@ func GetVirtualMachinePreferenceWindows() *instancetypev1alpha1.VirtualMachinePr }, PreferredSmm: &v1.FeatureState{}, }, - Firmware: &instancetypev1alpha1.FirmwarePreferences{ + Firmware: &instancetypev1alpha2.FirmwarePreferences{ PreferredUseEfi: pointer.Bool(true), PreferredUseSecureBoot: pointer.Bool(true), }, diff --git a/tools/vms-generator/vms-generator.go b/tools/vms-generator/vms-generator.go index 29bff41eb635..477a568d2082 100644 --- a/tools/vms-generator/vms-generator.go +++ b/tools/vms-generator/vms-generator.go @@ -34,7 +34,7 @@ import ( k8sfield "k8s.io/apimachinery/pkg/util/validation/field" v1 "kubevirt.io/api/core/v1" - instancetypev1alpha1 "kubevirt.io/api/instancetype/v1alpha1" + instancetypev1alpha2 "kubevirt.io/api/instancetype/v1alpha2" poolv1 "kubevirt.io/api/pool/v1alpha1" "kubevirt.io/kubevirt/pkg/testutils" @@ -68,16 +68,16 @@ func main() { }, }) - var virtualMachineInstancetypes = map[string]*instancetypev1alpha1.VirtualMachineInstancetype{ + var virtualMachineInstancetypes = map[string]*instancetypev1alpha2.VirtualMachineInstancetype{ utils.VirtualMachineInstancetypeComputeSmall: utils.GetVirtualMachineInstancetypeComputeSmall(), utils.VirtualMachineInstancetypeComputeLarge: utils.GetVirtualMachineInstancetypeComputeLarge(), } - var virtualMachineClusterInstancetypes = map[string]*instancetypev1alpha1.VirtualMachineClusterInstancetype{ + var virtualMachineClusterInstancetypes = map[string]*instancetypev1alpha2.VirtualMachineClusterInstancetype{ utils.VirtualMachineClusterInstancetypeComputeSmall: utils.GetVirtualMachineClusterInstancetypeComputeSmall(), } - var vmps = map[string]*instancetypev1alpha1.VirtualMachinePreference{ + var vmps = map[string]*instancetypev1alpha2.VirtualMachinePreference{ utils.VirtualMachinePreferenceVirtio: utils.GetVirtualMachinePreferenceVirtio(), utils.VirtualMachinePreferenceWindows: utils.GetVirtualMachinePreferenceWindows(), }