New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add minimal VM Flavor API #6026
Conversation
Skipping CI for Draft Pull Request. |
/cc @davidvossel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great! i just had one minor comment
staging/src/kubevirt.io/client-go/apis/flavor/v1alpha1/types.go
Outdated
Show resolved
Hide resolved
staging/src/kubevirt.io/client-go/apis/flavor/v1alpha1/types.go
Outdated
Show resolved
Hide resolved
pkg/flavor/flavor.go
Outdated
return flavorSpec.DefaultProfile, nil | ||
} | ||
|
||
for i := range flavorSpec.CustomProfiles { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use
for i := range flavorSpec.CustomProfiles { | |
for _, customProfile := range flavorSpec.CustomProfiles { |
instead of the [i]
access.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to avoid unnecessary copying of structs. But it is probably insignificant performance boost.
pkg/virt-api/webhooks/validating-webhook/admitters/vms-admitter.go
Outdated
Show resolved
Hide resolved
staging/src/kubevirt.io/client-go/apis/flavor/v1alpha1/types.go
Outdated
Show resolved
Hide resolved
Moving to draft. Missing validating webhook for flavors. |
/retest |
4 similar comments
/retest |
/retest |
/retest |
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
well done
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: davidvossel The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
/retest |
This will make adding API definitions easier in the following commit. Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Added flavor API defintions and generated client. Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
Changes: - Added flavor package with common functionality to get flavor and apply it to VMI. - Added flavor FlavorMatcher field to VM API, which references a flavor. - VM validating webhook checks that the flavor exists, and can be applied to VMI without conflicts. - virt-controller applies the flavor to VMI when a VM is started Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
The webhook succeeds if: - There is at least one profile - At most one profile is set as default - Each profile can be applied to an empty VMI spec without conflicts Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
@davidvossel, I needed to rebase this. Can you approve it again? |
/retest |
1 similar comment
/retest |
/lgtm |
What this PR does / why we need it:
This PR adds minimal API and functionality for VM flavors.
The flavor resource will contain common configuration that can be reused by multiple VMs.
Changes in this PR:
Added new API resource group
flavor.kubevirt.io
, that contains flavor resources:VirtualMachineFlavor
VirtualMachineClusterFlavor
Added
Flavor
field toVirtualMachineSpec
that specifies which flavor the VM uses.When a VM is created, the validating webhook checks if the flavor exists and can be applied to VMI without conflict.
Release note: