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

Slirp hook sidecar #10272

Merged
merged 7 commits into from Aug 17, 2023
Merged

Slirp hook sidecar #10272

merged 7 commits into from Aug 17, 2023

Conversation

ormergi
Copy link
Contributor

@ormergi ormergi commented Aug 10, 2023

What this PR does / why we need it:
This PR introduce Slirp hook sidecar, its a new hook sidecar for configuring Slirp network interfaces in Kubevirt.

Currently Slirp interfaces configure by Kubevirt, internally.
With the new sidecar hook, its possible to delegate Slirp interfces configuration outside Kubevirt
and enable reducing code maintenance.

Unlike other hook sidecar examples, Slirp hook-sidcar is set automatically by Kubevirt for VMs who has Slirp interface.
No need to add Kubeviet hook-sidecar annotation or any other configuration.

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:
Commits 4-7 are for testing slirp hook sidecar e2e, integrating the new hook-sidecar will be done in a follow up PR.

Release note:

Introduce network binding plugin for Slirp networking, interfacing with Kubevirt new network binding plugin API.

@ormergi
Copy link
Contributor Author

ormergi commented Aug 10, 2023

/test pull-kubevirt-unit-test
/test pull-kubevirt-build
/test pull-kubevirt-generate
/test pull-kubevirt-manifests
/test pull-kubevirt-e2e-k8s-1.27-sig-network

@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. release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. sig/network size/XXL labels Aug 10, 2023
Copy link
Member

@victortoso victortoso left a comment

Choose a reason for hiding this comment

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

Now that we have the cmd/sidecar directory, if you agree in using the sidecar-shim image, I think it would be great to move this from cmd/slirp-hook-sidecar to cmd/sidecar/slirp.

"@io_bazel_rules_go//go/platform:linux_arm64": "arm64",
"//conditions:default": "amd64",
}),
base = ":version-container",
Copy link
Member

Choose a reason for hiding this comment

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

Hey, #9231 just got merged and that introduces a sidecar-shim base image that you could use and reduce some of the grpc boilerplate. This commit is the change for the smbios example

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Victor, thanks for the heads up!

This slirp hook sidecar will be used as a reference for other network binding plugins (based on Kubevirt hook points and sidecar containers).
I am not sure we have the new sidecar-shim image available on potential D/S implementations, thus we decided to start with the "classic" hook implantation.

We will revisit the usage of sidecar-shim as a follow-up

@@ -0,0 +1,25 @@
# KubeVirt SMBIOS hook sidecar
Copy link
Member

Choose a reason for hiding this comment

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

Probably best to fill up with slirp related content

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

BUILD.bazel Outdated
@@ -346,6 +347,15 @@ container_push(
tag = "$(container_tag)",
)

container_push(
name = "push-slirp-hook-sidecar",
Copy link
Member

Choose a reason for hiding this comment

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

Have you requested to the quay.io container to be created?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Per my understanding having the image built as part of cluster-sync will also include in the release, is that right?

Copy link
Member

Choose a reason for hiding this comment

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

+container_push(
+    name = "push-network-slirp-binding",
+    format = "Docker",
+    image = "//cmd/network-slirp-binding:network-slirp-binding-image",
+    registry = "$(container_prefix)",
+    repository = "$(image_prefix)network-slirp-binding",
+    tag = "$(container_tag)",
+)

I meant that there is no network-slirp-binding repository in kubevirt/network-slirp-binding like we have for smbios sidecar example. If you want to create it, you should ping @dhiller and the nightly builds will update the repository.

@kubevirt-bot kubevirt-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 11, 2023
@kubevirt-bot kubevirt-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 13, 2023
@ormergi
Copy link
Contributor Author

ormergi commented Aug 13, 2023

/test pull-kubevirt-unit-test
/test pull-kubevirt-build
/test pull-kubevirt-generate
/test pull-kubevirt-manifests
/test pull-kubevirt-e2e-k8s-1.27-sig-network

@ormergi
Copy link
Contributor Author

ormergi commented Aug 13, 2023

/cc @EdDev @AlonaKaplan

@ormergi
Copy link
Contributor Author

ormergi commented Aug 14, 2023

/test pull-kubevirt-unit-test
/test pull-kubevirt-build
/test pull-kubevirt-generate
/test pull-kubevirt-manifests
/test pull-kubevirt-e2e-k8s-1.27-sig-network

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.

Thanks!

I think we should attempt and place in one package all the skeleton so we could re-use that package in future bindings.
In terms of dependency, the skeleton should not depend on the specific binding (e.g. slirp).

If this will take too much time, then we should just follow up on this immediately after this PR.

)

go_binary(
name = "slirp-hook-sidecar",
Copy link
Member

Choose a reason for hiding this comment

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

Could you please use the name network-slirp-binding instead?
Same for the folder name, package etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -0,0 +1,5 @@
# KubeVirt Slirp network hook sidecar
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 prefer this is called KubeVirt Network Slirp binding and in the body to describe it is implemented through the sidecar hooks interface.

If there is a ref to the hook interfaces, then we could add it here.
If there is none, we should add it in a follow up.


This hook sidecar configures VMs Slirp interface.

It will be used by Kubevirt to offload slip networking configuration and reduce code maintenance.
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 we can drop the reduce code maintenance. and describe what it does and how at high level (e.g. modifies the domain configuration based on the VMI spec).

"encoding/xml"
"fmt"

vmSchema "kubevirt.io/api/core/v1"
Copy link
Member

Choose a reason for hiding this comment

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

Strange to see camel-case format on imports.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed all over


vmSchema "kubevirt.io/api/core/v1"

domainSchema "kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api"
Copy link
Member

Choose a reason for hiding this comment

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

As a follow up: We need to extract the domain API definition to an upper level package in order to declare it as public and make sure no one will break it.

}

func (s InfoServer) Info(_ context.Context, _ *hooksInfo.InfoParams) (*hooksInfo.InfoResult, error) {
log.Log.Infof("Hook's Info method has been called")
Copy link
Member

Choose a reason for hiding this comment

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

I do not think we need this in production.

}

func (s V1alpha2Server) OnDefineDomain(_ context.Context, params *hooksV1alpha2.OnDefineDomainParams) (*hooksV1alpha2.OnDefineDomainResult, error) {
log.Log.Info("OnDefineDomain callback method has been called")
Copy link
Member

Choose a reason for hiding this comment

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

I do not think we need this in production.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the only indication a callback was invoked from the sidecar perspective.
It helps with debugging so I think its worth keeping it.

}

func (s V1alpha2Server) PreCloudInitIso(_ context.Context, params *hooksV1alpha2.PreCloudInitIsoParams) (*hooksV1alpha2.PreCloudInitIsoResult, error) {
log.Log.Info("PreCloudInitIso method has been called")
Copy link
Member

Choose a reason for hiding this comment

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

I do not think we need this in production.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the only indication a callback was invoked from the sidecar perspective.
It helps with debugging so I think its worth keeping it.

Comment on lines 84 to 87
return []domainSchema.Arg{
{Value: "-netdev"},
backendDeviceConf,
}, nil
Copy link
Member

Choose a reason for hiding this comment

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

nit: An one-liner should work here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 92 to 93
_, _, err := net.ParseCIDR(network.Pod.VMNetworkCIDR)
if 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.

nit: can be one-liner

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor Author

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

@EdDev I resolved most of the comments, still new to fix README.
The first two commits were divided to so that the first commit is a bare skeleton one could cherry pick and reuse.
Second commit add dns package (parse resolv.conf)
Third commit add domain package (concrete implementation)
Fourth commit wire things up

Please take another look

)

go_binary(
name = "slirp-hook-sidecar",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

"encoding/xml"
"fmt"

vmSchema "kubevirt.io/api/core/v1"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed all over

"kubevirt.io/kubevirt/cmd/slirp-hook-sidecar/domain"
)

type SlirpSpecGenerator interface {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

OnDefineDomain changed to not include any logic that related to slirp.
Its now exposes the DomainSpecMutator interface to enable injecting domain spec mutation logic.

Comment on lines 43 to 44
// Initializing the domain XML namespace with qemu scheme is necessary for
// passing commands to underlying QEMU.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

// Initializing the domain XML namespace with qemu scheme is necessary for
// passing commands to underlying QEMU.
// https://libvirt.org/drvqemu.html#pass-through-of-arbitrary-qemu-commands
XmlNS: "http://libvirt.org/schemas/domain/qemu/1.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, the string is exported to a const.

Comment on lines 57 to 66
slirpNetworkQemuCmdArgs, err := slirpSpecGen.Generate(vmi.Spec.Domain.Devices.Interfaces, vmi.Spec.Networks, searchDomains)
if err != nil {
return nil, err
}
if len(slirpNetworkQemuCmdArgs) == 0 {
log.Log.Warning("no QEMU slirp network cmd args were generated, returning original domain spec")
return domainXML, nil
}
domainSpec.QEMUCmd = domain.InitQemuCmdArgs(domainSpec.QEMUCmd)
domainSpec.QEMUCmd.QEMUArg = append(domainSpec.QEMUCmd.QEMUArg, slirpNetworkQemuCmdArgs...)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

The above logic is moved to domain package.

log.Log.Infof("Hook's Info method has been called")

return &hooksInfo.InfoResult{
Name: "slirp",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 84 to 87
return []domainSchema.Arg{
{Value: "-netdev"},
backendDeviceConf,
}, nil
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 92 to 93
_, _, err := net.ParseCIDR(network.Pod.VMNetworkCIDR)
if err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

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.

I reviewed everything except the DEBUG* commits.


This hook sidecar configures VMs Slirp interface.

It will be used by Kubevirt to offload slip networking configuration and reduce code maintenance.
Copy link
Member

Choose a reason for hiding this comment

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

Please drop and reduce code maintenance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

)

var _ = Describe("hook callback handler", func() {
Context("on define domain", func() {
Copy link
Member

Choose a reason for hiding this comment

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

What is the purpose of this additional later? If it has no functional usage, consider removing it and embedding the text in the upper or lower layers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean by additional later?

Copy link
Member

Choose a reason for hiding this comment

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

I meant "layer". Why do you need the Context?


Expect(callback.OnDefineDomain(domainSpecXML, domSpecMutator)).To(Equal(domainSpecXML))
})
})
Copy link
Member

Choose a reason for hiding this comment

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

What about:

  • Showing that a mutation is possible (just replacing the whole thing with something else is enough).
  • Showing the behavior when there is no input (empty byte stream).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

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 you should call this file main.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

srv "kubevirt.io/kubevirt/cmd/network-slirp-binding/server"
)

func main() {
searchDomains, err := dns.ReadResolvConfSearchDomains()
if err != nil {
panic(err)
Copy link
Member

Choose a reason for hiding this comment

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

IMO it should exist normally with a message to stderr (using the log) and not panic. Panic fits libraries perhaps, not main().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

@EdDev EdDev Aug 16, 2023

Choose a reason for hiding this comment

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

I see you kept the panic.

Edit: Ignore this, I saw a different one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It fixed in the second commit daa84f7
I think Github had a hiccup.

Comment on lines 123 to 130
//testMutator := domain.SlirpNetworkConfigurator{
// Interfaces: []vmschema.Interface{iface},
// Networks: []vmschema.Network{network},
// SearchDomains: testSearchDomain,
//}

//_, err := testMutator.Mutate(&domainschema.DomainSpec{})
//Expect(err).To(HaveOccurred())
Copy link
Member

Choose a reason for hiding this comment

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

leftover?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

Comment on lines 143 to 150
//testMutator := domain.SlirpNetworkConfigurator{
// Interfaces: []vmschema.Interface{iface},
// Networks: []vmschema.Network{network},
// SearchDomains: testSearchDomain,
//}
//
//_, err := testMutator.Mutate(&domainschema.DomainSpec{})
//Expect(err).To(HaveOccurred())
Copy link
Member

Choose a reason for hiding this comment

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

leftotver?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed


slirpConfigurator, err := domain.NewSlirpNetworkConfigurator(vmi.Spec.Domain.Devices.Interfaces, vmi.Spec.Networks, s.SearchDomains)
if err != nil {
return nil, fmt.Errorf("failed to create slirp configurator: %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

It seems it will fail if no slirp interface is detected.
Should we really fail or just log an error on stderr?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO it should fail, it means that the plugin is called with invalid VM configuration that should have been detected by the webhook.

Copy link
Member

Choose a reason for hiding this comment

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

It also means that the sidecar runs even if slirp is not defined on the VMI spec.
Maybe someone defined in manually to run and not through the new API.

@AlonaKaplan , what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Seems reasonable to fail. The sidecar should work only with the new API, if somebody configure it manually, it makes sense it will fail...

{Value: `-device`},
{Value: `{"driver":"e1000","netdev":"default","id":"default"}`},
},
),
Copy link
Member

Choose a reason for hiding this comment

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

There is a need to check that given a domain with an existing slirp configuration defined, it does not create another one but keeps the original (or overrides it).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With the current implementation additional command line args will be added.
I added a test to reflect this behavior.

In practice, when I tested the new sidecar the generated domain XML had the correct command line args although the onDefineDomain hook called twice (no duplicating args).

We can make the slirp plugin smarter up by making it looks into the QMEU command line arg values and act accordingly (not adding args if already exist, add missing args, etc..).but it will require more work and testing.

How about we do that on a follow up PR if we see there is a real issue?

Copy link
Member

Choose a reason for hiding this comment

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

In practice, when I tested the new sidecar the generated domain XML had the correct command line args although the onDefineDomain hook called twice (no duplicating args).

How is this possible? If it is called twice, it is suppose to add twice the configuration.

How about we do that on a follow up PR if we see there is a real issue?

It is a real issue because you cannot assume it is not called 100 times.

And I still expect to see this expressed in a test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How is this possible? If it is called twice, it is suppose to add twice the configuration.

The added QEMU cmd args get removed along with other attriburte but the network placeholder thing.
This is why it works and wont end up with duplication.

It is a real issue because you cannot assume it is not called 100 times.
And I still expect to see this expressed in a test.

Can we do this on a follow up PR?

Copy link
Member

Choose a reason for hiding this comment

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

OK, we can consider it as a bug. But please follow up on this.

Comment on lines 70 to 80
domainSpec.QEMUCmd = initQemuCmdArgs(domainSpec.QEMUCmd)
domainSpec.QEMUCmd.QEMUArg = append(domainSpec.QEMUCmd.QEMUArg, slirpQemuCmdArgs...)
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure if we can or should override any existing definitions.
Other sidecars hooks may use these commands.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that this is no overriding, slirp related command args are appended to the domain spec commandline.

Copy link
Member

Choose a reason for hiding this comment

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

The initQemuCmdArgs is confusing, I though it initializes it (always), but it seems it is conditioned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have also added a test to reflect this behavior.

Copy link
Member

Choose a reason for hiding this comment

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

The name init is indeed confusing. Maybe initQemuCmdArgsIfNeeded.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking at this again, I dont think we need it at all, I inlined initQemuCmdArgsIfNeeded.

{Value: `-device`},
{Value: `{"driver":"e1000","netdev":"default","id":"default"}`},
},
),
Copy link
Member

Choose a reason for hiding this comment

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

In practice, when I tested the new sidecar the generated domain XML had the correct command line args although the onDefineDomain hook called twice (no duplicating args).

How is this possible? If it is called twice, it is suppose to add twice the configuration.

How about we do that on a follow up PR if we see there is a real issue?

It is a real issue because you cannot assume it is not called 100 times.

And I still expect to see this expressed in a test.

testMutator, err := domain.NewSlirpNetworkConfigurator([]vmschema.Interface{iface}, []vmschema.Network{network}, testSearchDomain)
Expect(err).ToNot(HaveOccurred())

//expectedArg := "abc"
Copy link
Member

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for the mess, fixed


//expectedArg := "abc"
domSpec := &domainschema.DomainSpec{
// QEMUCmd: &domainschema.Commandline{QEMUArg: []domainschema.Arg{{Value: expectedArg}}},
Copy link
Member

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for the mess, fixed

if err != nil {
log.Log.Reason(err).Errorf("Failed to initialized socket on path: %s", socket)
log.Log.Error("Check whether given directory exists and socket name is not already taken by other file")
panic(err)
Copy link
Member

Choose a reason for hiding this comment

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

Can you replace this panic as well?

Copy link
Contributor 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 added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 17, 2023
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.

I am not sure the release notes are correct. We have not replaced the backend implementations with sidecars.
I would avoid adding a RN for now, at least until we will really use sidecars instead of the internal implementation.

You could mention this is specific to the network binding plugin API.

{Value: `-device`},
{Value: `{"driver":"e1000","netdev":"default","id":"default"}`},
},
),
Copy link
Member

Choose a reason for hiding this comment

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

OK, we can consider it as a bug. But please follow up on this.

// Slirp configuration works only with e1000 or rtl8139
if iface.Model != "e1000" && iface.Model != "rtl8139" {
// Slirp configuration works with e1000 only
if iface.Model != "e1000" {
Copy link
Member

Choose a reason for hiding this comment

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

I do not understand this change.
Based on what rt18139 is now overridden by e1000?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, the correct changes were probably overridden by the rebase, the correct fix is in place now.

log.Log.Infof("interface (%q) model type (%q) is not supported by QEMU slirp Network, using 'e1000' model type instead",
iface.Name, iface.Model)
}
netDeviceConf := fmt.Sprintf(`"driver":"e1000","netdev":%[1]q,"id":%[1]q`, iface.Name)
Copy link
Member

Choose a reason for hiding this comment

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

What was fixed? I fail to see the change per the comment.

var ports []vmschema.Port
configuredPorts := make(map[string]struct{}, 0)
for _, ifacePort := range iface.Ports {
if ifacePort.Port <= 0 || ifacePort.Port >= 65536 {
Copy link
Member

Choose a reason for hiding this comment

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

Pending feedback.

@kubevirt-bot kubevirt-bot added size/XL and removed size/XXL needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Aug 17, 2023
@ormergi
Copy link
Contributor Author

ormergi commented Aug 17, 2023

Rebase

cmd/network-slirp-binding:
|_ callback
|_ server
slirp.go

server & slirp.go
  Boilerplate code for registration to Kubevrit's hooks.
  Can be replaced with sidecar-shim container in the future.
callback:
  Implement Kubevirt OnDefineDomain hook point callback.
  The DomainSpecMutator interface should be implemented by
  the concrete slirp binding implementation.

Slirp binding implementation will be introduced in follow-up commits.

Signed-off-by: Or Mergi <ormergi@redhat.com>
resolv.conf search domains required for slirp networking
configuration.

Signed-off-by: Or Mergi <ormergi@redhat.com>
@ormergi ormergi force-pushed the slirp-hook-sidecar branch 2 times, most recently from 97ebafc to 5d22478 Compare August 17, 2023 09:10
Signed-off-by: Or Mergi <ormergi@redhat.com>
Signed-off-by: Or Mergi <ormergi@redhat.com>
Signed-off-by: Or Mergi <ormergi@redhat.com>
Signed-off-by: Or Mergi <ormergi@redhat.com>
Signed-off-by: Or Mergi <ormergi@redhat.com>
@ormergi ormergi marked this pull request as ready for review August 17, 2023 09: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 Aug 17, 2023
@AlonaKaplan
Copy link
Member

/approve

Thanks!

@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 Aug 17, 2023
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 Aug 17, 2023
@EdDev
Copy link
Member

EdDev commented Aug 17, 2023

Unrelated failures:

/test pull-kubevirt-e2e-k8s-1.27-sig-compute
/test pull-kubevirt-e2e-kind-1.27-vgpu

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/network size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants