Skip to content
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 support for instance types #824

Merged
merged 5 commits into from
Jul 1, 2024
Merged

Add support for instance types #824

merged 5 commits into from
Jul 1, 2024

Conversation

liranr23
Copy link
Member

@liranr23 liranr23 commented Mar 24, 2024

Setting the instanceType to the VM will set the specific VM in
the plan with the selected instance type available in the destination
cluster (if found). This means, the VM won't be set with their original
CPUs and memory they had in the source environment.

@liranr23 liranr23 marked this pull request as draft March 24, 2024 16:38
Copy link

codecov bot commented Mar 24, 2024

Codecov Report

Attention: Patch coverage is 0% with 83 lines in your changes missing coverage. Please review.

Project coverage is 15.78%. Comparing base (50a2566) to head (b614acf).
Report is 7 commits behind head on main.

Files Patch % Lines
pkg/controller/plan/kubevirt.go 0.00% 54 Missing ⚠️
pkg/controller/plan/adapter/ova/builder.go 0.00% 9 Missing ⚠️
pkg/controller/plan/adapter/ovirt/builder.go 0.00% 7 Missing ⚠️
pkg/controller/plan/adapter/vsphere/builder.go 0.00% 7 Missing ⚠️
pkg/controller/plan/adapter/openstack/builder.go 0.00% 5 Missing ⚠️
pkg/controller/plan/adapter/ocp/builder.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #824      +/-   ##
==========================================
- Coverage   15.83%   15.78%   -0.05%     
==========================================
  Files         108      108              
  Lines       19911    19973      +62     
==========================================
  Hits         3153     3153              
- Misses      16479    16541      +62     
  Partials      279      279              
Flag Coverage Δ
unittests 15.78% <0.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@liranr23
Copy link
Member Author

Based on kubev2v/forklift-console-plugin#1017 (comment), do we wish to query and add the instance types to the inventory in order to let UI do a selection box instead of string?

Copy link
Member

@ahadas ahadas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing a validation for the instance type as part of the plan validation

operator/config/crd/bases/forklift.konveyor.io_plans.yaml Outdated Show resolved Hide resolved
operator/config/crd/bases/forklift.konveyor.io_plans.yaml Outdated Show resolved Hide resolved
pkg/controller/plan/adapter/openstack/builder.go Outdated Show resolved Hide resolved
@@ -326,6 +329,9 @@ func (r *Builder) mapCPU(vm *model.VM, object *cnv.VirtualMachineSpec) {
vm.CoresPerSocket = 1
}
object.Template.Spec.Domain.Machine = &cnv.Machine{Type: "q35"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's an indication that this part does not belong here
CC @bkhizgiy
@liranr23 could you please clean it up and make the changes here similar to those in the builder of openstack?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i might have made it quite the opposite, please revisit

pkg/controller/plan/adapter/ovirt/builder.go Outdated Show resolved Hide resolved
pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
pkg/controller/plan/adapter/openstack/builder.go Outdated Show resolved Hide resolved
pkg/controller/plan/adapter/ovirt/builder.go Outdated Show resolved Hide resolved
pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
pkg/controller/plan/kubevirt.go Show resolved Hide resolved
pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
Copy link

sonarqubecloud bot commented Apr 1, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
7.6% Duplication on New Code

See analysis details on SonarCloud

@ahadas ahadas changed the title Add support to instance types Add support for instance types Apr 4, 2024
@ahadas ahadas added this to the 2.7.0 milestone Apr 9, 2024
pkg/apis/forklift/v1beta1/plan.go Outdated Show resolved Hide resolved
pkg/apis/forklift/v1beta1/plan.go Outdated Show resolved Hide resolved
pkg/controller/plan/adapter/ova/builder.go Outdated Show resolved Hide resolved
pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
pkg/controller/plan/kubevirt.go Outdated Show resolved Hide resolved
pkg/controller/provider/web/ocp/client.go Outdated Show resolved Hide resolved
@liranr23 liranr23 force-pushed the instances branch 2 times, most recently from 51f5756 to 32b9f9e Compare May 27, 2024 11:53
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
7.2% Duplication on New Code

See analysis details on SonarCloud

pkg/controller/plan/adapter/ova/builder.go Outdated Show resolved Hide resolved
pkg/controller/plan/adapter/ovirt/builder.go Outdated Show resolved Hide resolved
pkg/controller/plan/adapter/vsphere/builder.go Outdated Show resolved Hide resolved
pkg/controller/plan/kubevirt.go Show resolved Hide resolved
liranr23 added 5 commits July 1, 2024 17:06
Setting the `instanceType` to the VM will set the specific VM in
the plan with the selected instance type available in the destination
cluster (if found). This means, the VM won't be set with their original
CPUs and memory they had in the source environment.

Signed-off-by: Liran Rotenberg <[email protected]>
Set the selected instance type if exists on the VM. First we will try to
find the namespaced instance type. If not found, we will lookup for the
cluster wide one. Once the instance type is set, we skip setting the CPU
and memory requested resources.

Signed-off-by: Liran Rotenberg <[email protected]>
In order to let the UI consume this feature nicely, two new endpoints
were added for virtualmachineinstancetypes and
virtualmachineclusterinstancetypes. They will be added to the inventory
and will let the UI to use them.

Signed-off-by: Liran Rotenberg <[email protected]>
Signed-off-by: Liran Rotenberg <[email protected]>
@ahadas ahadas merged commit a8aeb93 into kubev2v:main Jul 1, 2024
9 of 12 checks passed
@ahadas ahadas removed this from the 2.7.0 milestone Jul 1, 2024
@liranr23 liranr23 deleted the instances branch July 2, 2024 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants