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
Remove hotplug VMI API #9958
Remove hotplug VMI API #9958
Conversation
Skipping CI for Draft Pull Request. |
76a0ba5
to
2f17bca
Compare
2f17bca
to
8ef0374
Compare
/test pull-kubevirt-e2e-k8s-1.26-sig-network-multus-v4 |
/test pull-kubevirt-build |
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.
Very nice, thanks!
virtctl: remove hotplug/ugnplug from VMI
hotplug/ugnplug will be allowed from VM only
Typo
app.VMIAddInterfaceRequestHandler(request, response) | ||
} | ||
} | ||
|
||
DescribeTable("Should succeed a dynamic interface request", func(addOpts *v1.AddInterfaceOptions, mockScenario func(addOpts *v1.AddInterfaceOptions)) { |
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.
No need for a table now.
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.
done.
pkg/virt-controller/watch/vm.go
Outdated
vmTemplateCopy := vm.Spec.Template.Spec.DeepCopy() | ||
for i, ifaceRequest := range vm.Status.InterfaceRequests { | ||
for i, _ := range vm.Status.InterfaceRequests { |
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.
The _
is redundant.
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.
done.
} | ||
} | ||
} | ||
vmiSpecCopy := vmi.Spec.DeepCopy() |
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.
Why a copy is used?
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.
Since c.VMIInterfacesPatch
compares between the changed copy and the original VMI to know if there is a need to patch the VMI.
pkg/virt-controller/watch/vm.go
Outdated
} | ||
} | ||
|
||
vm.Spec.Template.Spec = *vmTemplateCopy | ||
return nil | ||
} | ||
|
||
func (c *VMController) VMIInterfacesPatch(newVmiSpec *virtv1.VirtualMachineInstanceSpec, vmi *virtv1.VirtualMachineInstance) error { |
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 would suggest to split the patch preparation and the patching itself (the later can be done at the caller).
The patch preparation can be a simple function and not a method.
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 prefer to keep it as is since it is aligned with other patches the controller has. e.g VMICPUsPatch
.
Changed the method no to be exported.
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.
How is this related to how others used it? I fail to understand.
I prefer you move the network patching to the network.go
file, adding here stuff is bad. We should minimize it as much as possible, even if others do not care.
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 will follow up on this and send a PR to fix it, it is not worth blocking on it.
pkg/virt-controller/watch/vm.go
Outdated
return err | ||
} | ||
} | ||
if err := c.VMIInterfacesPatch(vmiSpecCopy, vmi); err != nil { |
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 think there is a need to update the VMI content (use the response of the patch operation).
Mutating the VMI in the middle of the flow, requires it to be updated so following usages have an up to date VMI object.
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 think the VMI shouldn't be changed, it represents the original VMI. Other hot updates doesn't change it as well (volume/ cpu).
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.
Well, once you patch it, it changed.
If the object is not updated, decisions taken after are incorrect, e.g. status updates.
Even in this patching you assume the object was not updated by anyone else with relations to interfaces/networks.
If others have not updated it when mutating it, we do not have to repeat the same bug.
But you can reason why we need to leave the controller with an non updated object.
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.
It is ok that decisions will be made based on the old VMI object. The next reconcile it will be fixed.
This VMI object represents the existing VMI, that's how the rest of the code in the file treats it, I prefer to be consistent.
Hotplug unplug will be supported from VM only. Signed-off-by: Alona Paz <alkaplan@redhat.com>
8ef0374
to
7e8a7dd
Compare
This has not been handled. |
hotplug/unplug will be allowed from VM only Signed-off-by: Alona Paz <alkaplan@redhat.com>
hotplug/unplug will be allowed from VM only. Signed-off-by: Alona Paz <alkaplan@redhat.com>
It will be supported from VMs only. Signed-off-by: Alona Paz <alkaplan@redhat.com>
Signed-off-by: Alona Paz <alkaplan@redhat.com>
7e8a7dd
to
b88c64d
Compare
/retest |
/cc @maiqueb |
I don't think we can claim that the VM is only user facing API for a workload on KubeVirt.
I think this is not correct. Are we sure we don't have upstream users using/relying on this ? Wouldn't it make sense to send an email to the mailing list giving a heads-up of your intentions ? @chinglinwen does this affect you in any way ? |
Also, please be more specific.
doesn't help understand the reasons behind breaking the API. A list of corner cases would. |
I think we can.
This API has not yet been released under a formal version. In addition, the hotplug and unplug API/s are in tech-preview and this is how I suggest to treat it. The lesson learned from the period this API was in, is proof enough that we should fix the mistake we did sooner than later. |
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.
Thank you!
I have an example that we depends on VM's pods
@maiqueb for this particular PR, we don't using hot plug yet, we may using it later, so it currently doesn't affect us |
The existing code of hotplug has already broken the assumptions taken on the internal pod networking. |
The PR is not removing the hotplug feature. It is still available via VMs. It just removes the option to hotplug directly to a VMI. |
Got it, thanks for the note. |
/retest |
1 similar comment
/retest |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AlonaKaplan 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 |
Raising Eddy's lgtm to approve. |
/cherry-pick release-1.0 |
@AlonaKaplan: once the present PR merges, I will cherry-pick it on top of release-1.0 in a new PR and assign it to you. In response to this:
Instructions 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/test-infra repository. |
@AlonaKaplan: The following test failed, say
Instructions 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/test-infra repository. I understand the commands that are listed here. |
@AlonaKaplan: new pull request created: #9965 In response to this:
Instructions 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/test-infra repository. |
I can only second @maiqueb. VMI, VM, VMIRS, VM Pools are all user-facing APIs. That the VMI is not user-facing is not correct. I would kindly ask to bring this to the mailing list and ask for broader approver commitment. Maybe they agree to start considering the VMI as non-userfacing in the future, but as it is right now that is not a correct assumption. If this functionality is tech-preview it may be ok to keep it removed, but the decision that VMI is not user-facing can not be made here. There is in principle also no rule which says that every REST endpoint on a specific object (e.g. VM) needs to exist also on a VMI, this can be fine. Just the statement about VMI being not user-facing is critical to discuss. |
What this PR does / why we need it:
This PR removes the rest-api and virctlcommands for hotplugging/unplugging an interfaces to/from a VMI.
Interface hotplugging/unplugging will be supported via VMs only.
It was noticed that allowing users to access the VMI (through the virt-api) is introducing too many corner cases (for example interface hotplugged to a VMI didn't get MAC from kubemacpool) and complexity in the system. Users should have access only to their user facing API, which is the VM object. Allowing the system to apply the desired spec in the VM to the backend VMI.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
Release note: