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

Remove hotplug VMI API #9958

Merged
merged 5 commits into from Jun 22, 2023
Merged

Conversation

AlonaKaplan
Copy link
Member

@AlonaKaplan AlonaKaplan commented Jun 21, 2023

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:

Disable network interface hotplug/unplug for VMIs. It will be supported for VMs only. 

@kubevirt-bot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kubevirt-bot kubevirt-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/XL sig/network labels Jun 21, 2023
@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jun 21, 2023
@AlonaKaplan
Copy link
Member Author

/test pull-kubevirt-e2e-k8s-1.26-sig-network-multus-v4
/test pull-kubevirt-e2e-k8s-1.26-sig-network

@AlonaKaplan
Copy link
Member Author

/test pull-kubevirt-build
/test pull-kubevirt-build-arm64
/test pull-kubevirt-generate
/test pull-kubevirt-manifests
/test pull-kubevirt-unit-test

Copy link
Member

@EdDev EdDev left a 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)) {
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

vmTemplateCopy := vm.Spec.Template.Spec.DeepCopy()
for i, ifaceRequest := range vm.Status.InterfaceRequests {
for i, _ := range vm.Status.InterfaceRequests {
Copy link
Member

Choose a reason for hiding this comment

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

The _ is redundant.

Copy link
Member Author

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()
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Since c.VMIInterfacesPatchcompares between the changed copy and the original VMI to know if there is a need to patch the VMI.

}
}

vm.Spec.Template.Spec = *vmTemplateCopy
return nil
}

func (c *VMController) VMIInterfacesPatch(newVmiSpec *virtv1.VirtualMachineInstanceSpec, vmi *virtv1.VirtualMachineInstance) error {
Copy link
Member

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.

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 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.

Copy link
Member

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.

Copy link
Member

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.

return err
}
}
if err := c.VMIInterfacesPatch(vmiSpecCopy, vmi); err != nil {
Copy link
Member

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.

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 think the VMI shouldn't be changed, it represents the original VMI. Other hot updates doesn't change it as well (volume/ cpu).

Copy link
Member

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.

Copy link
Member Author

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.

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jun 21, 2023
Hotplug unplug will be supported from VM only.

Signed-off-by: Alona Paz <alkaplan@redhat.com>
@kubevirt-bot kubevirt-bot removed the lgtm Indicates that a PR is ready to be merged. label Jun 21, 2023
@AlonaKaplan AlonaKaplan marked this pull request as ready for review June 21, 2023 14:23
@kubevirt-bot kubevirt-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 21, 2023
@EdDev
Copy link
Member

EdDev commented Jun 21, 2023

Very nice, thanks!

virtctl: remove hotplug/ugnplug from VMI
hotplug/ugnplug will be allowed from VM only

Typo

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>
@AlonaKaplan
Copy link
Member Author

/retest

@AlonaKaplan
Copy link
Member Author

/cc @maiqueb

@maiqueb
Copy link
Contributor

maiqueb commented Jun 21, 2023

I don't think we can claim that the VM is only user facing API for a workload on KubeVirt.

Users should have access only to their user facing API, which is the VM object.

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 ?

@maiqueb
Copy link
Contributor

maiqueb commented Jun 21, 2023

Also, please be more specific.

allowing users to access the VMI (through the virt-api) is introducing too many corner cases

doesn't help understand the reasons behind breaking the API.

A list of corner cases would.

@EdDev
Copy link
Member

EdDev commented Jun 21, 2023

I don't think we can claim that the VM is only user facing API for a workload on KubeVirt.

I think we can.

Users should have access only to their user facing API, which is the VM object.

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 ?

This API has not yet been released under a formal version.
We can and we should do this before the release is done to avoid deprecation notices.

In addition, the hotplug and unplug API/s are in tech-preview and this is how I suggest to treat it.
Equivalent to Kuberenetes alpha version if this helps give it a context.

The lesson learned from the period this API was in, is proof enough that we should fix the mistake we did sooner than later.

Copy link
Member

@EdDev EdDev left a comment

Choose a reason for hiding this comment

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

Thank you!

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jun 21, 2023
@chinglinwen
Copy link

Users should have access only to their user facing API, which is the VM object.

I have an example that we depends on VM's pods k6t bridge device( to flood packet to do the packet mirror), it's internal, observable behavior will be depends on somehow ;).

@chinglinwen does this affect you in any way ?

@maiqueb for this particular PR, we don't using hot plug yet, we may using it later, so it currently doesn't affect us
I notice this change remove temporary hot plug feature, I'm not sure we will need it or not ( and I've work on something else currently, so I've lost some detail in my minds ).

@EdDev
Copy link
Member

EdDev commented Jun 21, 2023

I have an example that we depends on VM's pods k6t bridge device( to flood packet to do the packet mirror), it's internal, observable behavior will be depends on somehow ;).

The existing code of hotplug has already broken the assumptions taken on the internal pod networking.
The names of the interfaces used in the pod have changed from ordinal to hashed.
But I guess this is the risk of any downstream that tweaks and depends on internals.

@AlonaKaplan
Copy link
Member Author

@maiqueb for this particular PR, we don't using hot plug yet, we may using it later, so it currently doesn't affect us I notice this change remove temporary hot plug feature, I'm not sure we will need it or not ( and I've work on something else currently, so I've lost some detail in my minds ).

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.

@chinglinwen
Copy link

I have an example that we depends on VM's pods k6t bridge device( to flood packet to do the packet mirror), it's internal, observable behavior will be depends on somehow ;).

The existing code of hotplug has already broken the assumptions taken on the internal pod networking.
The names of the interfaces used in the pod have changed from ordinal to hashed.
But I guess this is the risk of any downstream that tweaks and depends on internals.

Got it, thanks for the note.

@AlonaKaplan
Copy link
Member Author

/retest

1 similar comment
@AlonaKaplan
Copy link
Member Author

/retest

@AlonaKaplan
Copy link
Member Author

/approve

@kubevirt-bot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 22, 2023
@AlonaKaplan
Copy link
Member Author

Raising Eddy's lgtm to approve.

@AlonaKaplan
Copy link
Member Author

/cherry-pick release-1.0

@kubevirt-bot
Copy link
Contributor

@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:

/cherry-pick release-1.0

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.

@kubevirt-bot
Copy link
Contributor

@AlonaKaplan: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubevirt-e2e-k8s-1.25-sig-compute b88c64d link unknown /test pull-kubevirt-e2e-k8s-1.25-sig-compute

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.

@kubevirt-bot kubevirt-bot merged commit f73d6ce into kubevirt:main Jun 22, 2023
35 of 36 checks passed
@kubevirt-bot
Copy link
Contributor

@AlonaKaplan: new pull request created: #9965

In response to this:

/cherry-pick release-1.0

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.

@rmohr
Copy link
Member

rmohr commented Jun 23, 2023

I don't think we can claim that the VM is only user facing API for a workload on KubeVirt.

Users should have access only to their user facing API, which is the VM object.

I think this is not correct.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/network size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants