Repository navigation
Conversation
defaultVMInstanceType looked the instance type up by name only, trying the namespaced VirtualMachineInstancetype before the cluster-scoped one. When both existed with the same name, a spec asking for VirtualMachineClusterInstancetype got the namespaced one. Only look up the requested kind when one is set, and keep the old order when it is empty. Signed-off-by: Lucas Barros <lucasbarros.kam@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @lbarrosby. Thanks for your PR. I'm waiting for a kubermatic member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
What this PR does / why we need it:
defaultVMInstanceTypeignored thekindof the instancetype matcher and always tried the namespacedVirtualMachineInstancetypefirst. If a namespaced and a cluster-scoped instance type share a name, a MachineDeployment that explicitly asks forVirtualMachineClusterInstancetypegot the namespaced one.With this change the lookup is limited to the requested kind (singular or plural, case-insensitive, as KubeVirt accepts). When
kindis empty the previous order is kept, so existing specs behave the same.Added
TestDefaultVMInstanceTypewith a fake client holding both kinds under the same name. Three of its cases fail on main and all pass with the fix;go test ./pkg/cloudprovider/provider/kubevirt/passes.AI disclosure: written with the help of Claude Code, reviewed and tested by me.
Which issue(s) this PR fixes:
Fixes #2065
What type of PR is this?
/kind bug
Special notes for your reviewer:
An explicit kind that does not exist now returns an error instead of falling back to the other scope, which matches what KubeVirt does when the VM is created.
Does this PR introduce a user-facing change? Then add your Release Note here:
Documentation: