[go: nahoru, domu]

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

network, binding: Declare the SLIRP core binding as deprecated and remove it #11701

Merged
merged 7 commits into from
May 12, 2024

Conversation

EdDev
Copy link
Member
@EdDev EdDev commented Apr 15, 2024

What this PR does

SLIRP binding has been part of Kubevirt from the early days.
With the introduction of the masquerade binding, SLIRP gradually lost interest due to the performance penalty it comes with.

Nowadays, Passt binding plugin [1] is considered an enhanced alternative to SLIRP and the closest in functionality (user-space connectivity).

The current SLIRP core binding [2] has a backend implementation that uses the SLIRP network binding plugin [3].

We have not encounter actual users who work with SLIRP binding for years now.
In addition, support for the binding is minimum (or nonexistence in practice).

Therefore, it seems reasonable to deprecate and remove SLIRP support.

In case there are users who still require SLIRP, the following mitigation exists:

  • Existing running VMs are not to be effected and should continue running.
  • New VMs should use the alternatives: The masquerade binding [4], passt binding plugin [1] or the (less recommended) slirp binding plugin [3].

This change renames slirp fields by prefixing Deprecated to their names but without changing their json naming.
Then, it removed the logic of using the binding plugin backend to define a core SLIRP binding, including the definition of default SLIRP interfaces.
Logic is also removed from virt-launcher in regards to SLIRP binding.

The existing validation admitters and virt-handler SLIRP related logic is preserved to allow existing workloads to continue operating.

The migration scenario is nonexistent for SLIRP core binding because Kubevirt never allowed/supported it.
The migration availability is marked using a condition as not available [5] and therefore migration requests will fail.

[1] https://kubevirt.io/user-guide/virtual_machines/net_binding_plugins/passt/
[2] https://kubevirt.io/user-guide/virtual_machines/interfaces_and_networks/#slirp
[3] https://kubevirt.io/user-guide/virtual_machines/net_binding_plugins/slirp/#slirp-network-binding-plugin
[4] https://kubevirt.io/user-guide/virtual_machines/interfaces_and_networks/#masquerade
[5]

func VerifyVMIMigratable(vmi *v1.VirtualMachineInstance, bindingPlugins map[string]v1.InterfaceBindingPlugin) error {

Fixes #

Links to places where the discussion took place:
The deprecation and removal of the SLIRP core binding has been discussed and communicated through
the mailing list [5].

[5] https://groups.google.com/g/kubevirt-dev/c/Dp3GVw-Y-K8

Special notes for your reviewer

This change requires wide approver agreement due to its stable API backward incompatibility effect.

Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.

Release note

The SLIRP core binding is deprecated and removed.

@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 release-note Denotes a PR that will be considered when it comes time to generate release notes. 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. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/XL sig/buildsystem Denotes an issue or PR that relates to changes in the build system. sig/network sig/scale labels Apr 15, 2024
@EdDev
Copy link
Member Author
EdDev commented Apr 15, 2024

/test pull-kubevirt-code-lint
/test pull-kubevirt-client-python
/test pull-kubevirt-fossa
/test pull-kubevirt-generate
/test pull-kubevirt-manifest
/test pull-kubevirt-prom-rules-verify
/test pull-kubevirt-unit-test
/test pull-kubevirt-verify-go-mod

@EdDev
Copy link
Member Author
EdDev commented Apr 15, 2024

/test pull-kubevirt-manifests

@EdDev
Copy link
Member Author
EdDev commented Apr 15, 2024

/test pull-kubevirt-e2e-k8s-1.29-sig-network

@EdDev
Copy link
Member Author
EdDev commented Apr 15, 2024

Add the same validation to fail migration on the target (at the virt-controller).

@AlonaKaplan commented that migration with Slirp is not supported anyway, therefore we just need to confirm it is enough to block it.

@EdDev
Copy link
Member Author
EdDev commented Apr 15, 2024

/test pull-kubevirt-code-lint
/test pull-kubevirt-client-python
/test pull-kubevirt-fossa
/test pull-kubevirt-generate
/test pull-kubevirt-manifests
/test pull-kubevirt-prom-rules-verify
/test pull-kubevirt-unit-test
/test pull-kubevirt-verify-go-mod

@EdDev
Copy link
Member Author
EdDev commented Apr 15, 2024

/test pull-kubevirt-unit-test

@EdDev
Copy link
Member Author
EdDev commented Apr 15, 2024

/test pull-kubevirt-e2e-k8s-1.29-sig-network

@EdDev
Copy link
Member Author
EdDev commented Apr 16, 2024

/test all

@EdDev EdDev marked this pull request as ready for review April 17, 2024 00:21
@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 Apr 17, 2024
Copy link
Contributor
@ormergi ormergi left a comment

Choose a reason for hiding this comment

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

Great work! looks good to me overall.

Regarding virt-controller: Add network validation for the VM and VMI controllers commit message these a typo at first line Ad -> 'Add'.

Could you please refer to the following migration scenarios (at least in PR description):

  • What will happen there is a migration request by the user to slirp VMs?
  • On post Kubevirt upgrade, what will happen to old slirp VMs?
    In both scenarios, will virt-handler / controller will re-enqueuing syncVMI routine due to existing slirp interface?

@EdDev
Copy link
Member Author
EdDev commented Apr 18, 2024

Great work! looks good to me overall.

Regarding virt-controller: Add network validation for the VM and VMI controllers commit message these a typo at first line Ad -> 'Add'.

Done.

Could you please refer to the following migration scenarios (at least in PR description):

  • What will happen there is a migration request by the user to slirp VMs?

I'll add to the description the migration scenario. The migration is blocked because SLIRP never supported migration.

  • On post Kubevirt upgrade, what will happen to old slirp VMs?

I think I did: The existing validation admitters and virt-handler SLIRP related logic is preserved to allow existing workloads to continue operating.

In both scenarios, will virt-handler / controller will re-enqueuing syncVMI routine due to existing slirp interface?

Migration is not supported for SLIRP, it is blocked today.
Existing running VMIs will continue to work as usual, see quote from above.

@EdDev EdDev force-pushed the remove-slirp branch 2 times, most recently from 8fc69fa to 539b237 Compare April 18, 2024 19:41
@@ -195,7 +195,7 @@ func DefaultSlirpNetworkInterface() *Interface {
iface := &Interface{
Name: "default",
InterfaceBindingMethod: InterfaceBindingMethod{
Slirp: &InterfaceSlirp{},
DeprecatedSlirp: &DeprecatedInterfaceSlirp{},
Copy link
Member

Choose a reason for hiding this comment

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

Should the DefaultSlirpNetworkInterface be removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it should be removed as well. Thanks.

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

@kubevirt-bot kubevirt-bot removed the lgtm Indicates that a PR is ready to be merged. label May 9, 2024
@EdDev
Copy link
Member Author
EdDev commented May 9, 2024

change: Rebase

@EdDev
Copy link
Member Author
EdDev commented May 9, 2024

change: Ran make generate again on the 1st commit.

@EdDev
Copy link
Member Author
EdDev commented May 9, 2024

change: Removed DefaultSlirpNetworkInterface

@EdDev
Copy link
Member Author
EdDev commented May 10, 2024

/test pull-kubevirt-unit-test

@AlonaKaplan
Copy link
Member

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label May 10, 2024
@kubevirt-commenter-bot
Copy link

Required labels detected, running phase 2 presubmits:
/test pull-kubevirt-e2e-windows2016
/test pull-kubevirt-e2e-kind-sriov
/test pull-kubevirt-e2e-k8s-1.30-ipv6-sig-network
/test pull-kubevirt-e2e-k8s-1.28-sig-network
/test pull-kubevirt-e2e-k8s-1.28-sig-storage
/test pull-kubevirt-e2e-k8s-1.28-sig-compute
/test pull-kubevirt-e2e-k8s-1.28-sig-operator
/test pull-kubevirt-e2e-k8s-1.29-sig-network
/test pull-kubevirt-e2e-k8s-1.29-sig-storage
/test pull-kubevirt-e2e-k8s-1.29-sig-compute
/test pull-kubevirt-e2e-k8s-1.29-sig-operator

NetworkInterface: string(v1.SlirpInterface),
PermitSlirpInterface: pointer.P(true),
NetworkInterface: string(v1.DeprecatedSlirpInterface),
DeprecatedPermitSlirpInterface: pointer.P(true),
Copy link
Member

Choose a reason for hiding this comment

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

Should the slirp be allowed to be default?

Copy link
Member Author

Choose a reason for hiding this comment

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

On upgrade the KV spec does not change.
There is no restriction imposed to set KV in order not to break existing workloads or the upgrade itself.

New VM/VMI will not accept this configuration and the Admin will need to remove Slirp from the KV spec after the upgrade in order to avoid having Slirp.

Copy link
Member

Choose a reason for hiding this comment

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

On upgrade the KV spec does not change.
There is no restriction imposed to set KV in order not to break existing workloads or the upgrade itself.

I don't think we would break compatibility, the config is internal, it would just drop to default. I am not sure how this works with other bindings....

New VM/VMI will not accept this configuration and the Admin will need to remove Slirp from the KV spec after the upgrade in order to avoid having Slirp.

Does this means that new VM/I will be denied or that they will no use the config?

Copy link
Member Author

Choose a reason for hiding this comment

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

On upgrade the KV spec does not change.
There is no restriction imposed to set KV in order not to break existing workloads or the upgrade itself.

I don't think we would break compatibility, the config is internal, it would just drop to default. I am not sure how this works with other bindings....

Internal? The Kubevirt CR is not internal.
Anything there will remain as is and it will be reflected when creating new VM/VMI.
If the configuration there is not supported, it will fail validation.

New VM/VMI will not accept this configuration and the Admin will need to remove Slirp from the KV spec after the upgrade in order to avoid having Slirp.

Does this means that new VM/I will be denied or that they will no use the config?

New VM/VMI are denied if the configuration is not supported (i.e. set Slirp interface based on the Kubevirt CR spec). Existing VM/VMI are not affected.
This is no different from defining Slirp explicitly on the VM/VMI.

Copy link
Member

Choose a reason for hiding this comment

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

Internal? The Kubevirt CR is not internal.

Yes but I am commenting about virt-config that is either from configmap or kubevirt cr(the latter lately...). It also has an internal validation on these external sources as these sources can be submitted to the system in invalid form. What I was trying to say in the previous comments is that the validation still allows the slirp. This semantically doesn't make much sense to me.

Anything there will remain as is and it will be reflected when creating new VM/VMI.
If the configuration there is not supported, it will fail validation.

This doesn't sounds better than falling to default binding

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes but I am commenting about virt-config that is either from configmap or kubevirt cr(the latter lately...). It also has an internal validation on these external sources as these sources can be submitted to the system in invalid form. What I was trying to say in the previous comments is that the validation still allows the slirp. This semantically doesn't make much sense to me.

The validation of VM/VMI to reject Slirp is limited to creation and not updates.
The config is used to calculate defaults also for updates, which should continue passing.

Therefore, I do not think it will be correct to validate the config and reject Slirp at this level.
VM/VMI that are running should not get rejected.

If you still think it is possible to both reject Slirp here and keep existing workloads running (and not fail validation on update), we can improve as a follow up.

Anything there will remain as is and it will be reflected when creating new VM/VMI.
If the configuration there is not supported, it will fail validation.

This doesn't sounds better than falling to default binding

It is not better, it is a limitation due to the requirement to support existing VMs running even when their manifest is updated (and therefore validated).

EdDev added 7 commits May 10, 2024 11:36
Existing Go structs and members names are prefixed with `Deprecated` on
their names and added documentation comments to mark them as deprecated.

The JSON naming has not changed, keeping API fields intact.

Signed-off-by: Edward Haas <edwardh@redhat.com>
Given Kubevirt CR configuration to enable SLIRP and allow it to be set
by default (in case no network interface is defined), return with an
error.

The default setting is performed on a mutating admitter webhook for both
VM and VMI CRs.
In addition, the defaulting is executed when the VM controller prepares
a VMI for creation.
We would expect the failure to be raised at the admitter, failing
immediately the CR creation. However, even if it will fail at the VM
controller, the outcome will be somehow similar: VMI will not be
created, i.e. the VM will not be able to start.

Signed-off-by: Edward Haas <edwardh@redhat.com>
Signed-off-by: Edward Haas <edwardh@redhat.com>
Signed-off-by: Edward Haas <edwardh@redhat.com>
Processing of SLIRP core binding is removed with care to preserve
existing running VM/VMIs.

New VM/VMIs which are configured to use the SLIRP core binding will
fail to setup the vNIC.

A follow up change will block such a spec at the creation validation
admitter to assure early and stable failure for new VM/VMIs.

Signed-off-by: Edward Haas <edwardh@redhat.com>
Validate at the validation admitters that new VM/VMI is not created with
the SLIRP core binding.

It has been added for both the VM and VMI admitters. Limited to the
CREATE operation.

Signed-off-by: Edward Haas <edwardh@redhat.com>
Add a network validation point at the:
- VM controller, before creating a VMI.
- VMI controller, before creating a Pod.

The network validators, together with the create validator admitters
assure no new VM/VMI is created with the SLIRP core binding.

The reason to add the validation to the controllers in addition to the
existing validation admitters is the async upgrade path of Kubevirt
components. There may be a gap between the upgrade of the
virt-controller and the virt-api (which holds the admitters).
We need to assure that in the gap no new VM/VMI is created with a SLIRP
core binding interface.

Signed-off-by: Edward Haas <edwardh@redhat.com>
@kubevirt-bot kubevirt-bot removed the lgtm Indicates that a PR is ready to be merged. label May 10, 2024
@EdDev
Copy link
Member Author
EdDev commented May 10, 2024

change: Rebase (again)

@ormergi
Copy link
Contributor
ormergi commented May 12, 2024

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label May 12, 2024
@kubevirt-commenter-bot
Copy link

Required labels detected, running phase 2 presubmits:
/test pull-kubevirt-e2e-windows2016
/test pull-kubevirt-e2e-kind-sriov
/test pull-kubevirt-e2e-k8s-1.30-ipv6-sig-network
/test pull-kubevirt-e2e-k8s-1.28-sig-network
/test pull-kubevirt-e2e-k8s-1.28-sig-storage
/test pull-kubevirt-e2e-k8s-1.28-sig-compute
/test pull-kubevirt-e2e-k8s-1.28-sig-operator
/test pull-kubevirt-e2e-k8s-1.29-sig-network
/test pull-kubevirt-e2e-k8s-1.29-sig-storage
/test pull-kubevirt-e2e-k8s-1.29-sig-compute
/test pull-kubevirt-e2e-k8s-1.29-sig-operator

@EdDev
Copy link
Member Author
EdDev commented May 12, 2024

/test pull-kubevirt-e2e-k8s-1.29-sig-performance

@kubevirt-bot kubevirt-bot merged commit e6207f2 into kubevirt:main May 12, 2024
38 checks passed
@EdDev EdDev deleted the remove-slirp branch May 12, 2024 13:42
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. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API 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/buildsystem Denotes an issue or PR that relates to changes in the build system. sig/network sig/scale size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants