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
Slirp hook sidecar #10272
Conversation
/test pull-kubevirt-unit-test |
Skipping CI for Draft Pull Request. |
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.
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
.
cmd/slirp-hook-sidecar/BUILD.bazel
Outdated
"@io_bazel_rules_go//go/platform:linux_arm64": "arm64", | ||
"//conditions:default": "amd64", | ||
}), | ||
base = ":version-container", |
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.
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
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.
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
cmd/slirp-hook-sidecar/README.md
Outdated
@@ -0,0 +1,25 @@ | |||
# KubeVirt SMBIOS hook sidecar |
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.
Probably best to fill up with slirp related content
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
BUILD.bazel
Outdated
@@ -346,6 +347,15 @@ container_push( | |||
tag = "$(container_tag)", | |||
) | |||
|
|||
container_push( | |||
name = "push-slirp-hook-sidecar", |
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.
Have you requested to the quay.io container to be created?
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.
Per my understanding having the image built as part of cluster-sync will also include in the release, is that right?
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.
+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.
bfd9ef0
to
99a7701
Compare
/test pull-kubevirt-unit-test |
/cc @EdDev @AlonaKaplan |
99a7701
to
8f0b198
Compare
/test pull-kubevirt-unit-test |
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.
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.
cmd/slirp-hook-sidecar/BUILD.bazel
Outdated
) | ||
|
||
go_binary( | ||
name = "slirp-hook-sidecar", |
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.
Could you please use the name network-slirp-binding
instead?
Same for the folder name, package etc.
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
cmd/slirp-hook-sidecar/README.md
Outdated
@@ -0,0 +1,5 @@ | |||
# KubeVirt Slirp network hook sidecar |
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 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.
cmd/slirp-hook-sidecar/README.md
Outdated
|
||
This hook sidecar configures VMs Slirp interface. | ||
|
||
It will be used by Kubevirt to offload slip networking configuration and reduce code maintenance. |
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 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" |
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.
Strange to see camel-case format on imports.
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.
Fixed all over
|
||
vmSchema "kubevirt.io/api/core/v1" | ||
|
||
domainSchema "kubevirt.io/kubevirt/pkg/virt-launcher/virtwrap/api" |
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.
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") |
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 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") |
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 do not think we need this in production.
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.
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") |
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 do not think we need this in production.
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.
This is the only indication a callback was invoked from the sidecar perspective.
It helps with debugging so I think its worth keeping it.
return []domainSchema.Arg{ | ||
{Value: "-netdev"}, | ||
backendDeviceConf, | ||
}, 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.
nit: An one-liner should work here.
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
_, _, err := net.ParseCIDR(network.Pod.VMNetworkCIDR) | ||
if 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.
nit: can be one-liner
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
8f0b198
to
9715b54
Compare
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.
@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
cmd/slirp-hook-sidecar/BUILD.bazel
Outdated
) | ||
|
||
go_binary( | ||
name = "slirp-hook-sidecar", |
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
"encoding/xml" | ||
"fmt" | ||
|
||
vmSchema "kubevirt.io/api/core/v1" |
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.
Fixed all over
"kubevirt.io/kubevirt/cmd/slirp-hook-sidecar/domain" | ||
) | ||
|
||
type SlirpSpecGenerator interface { |
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
OnDefineDomain changed to not include any logic that related to slirp.
Its now exposes the DomainSpecMutator interface to enable injecting domain spec mutation logic.
// Initializing the domain XML namespace with qemu scheme is necessary for | ||
// passing commands to underlying QEMU. |
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
// 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", |
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, the string is exported to a const.
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...) |
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
The above logic is moved to domain package.
log.Log.Infof("Hook's Info method has been called") | ||
|
||
return &hooksInfo.InfoResult{ | ||
Name: "slirp", |
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
return []domainSchema.Arg{ | ||
{Value: "-netdev"}, | ||
backendDeviceConf, | ||
}, 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.
Done
_, _, err := net.ParseCIDR(network.Pod.VMNetworkCIDR) | ||
if 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.
Done
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 reviewed everything except the DEBUG* commits.
cmd/network-slirp-binding/README.md
Outdated
|
||
This hook sidecar configures VMs Slirp interface. | ||
|
||
It will be used by Kubevirt to offload slip networking configuration and reduce code maintenance. |
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.
Please drop and reduce code maintenance
.
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
) | ||
|
||
var _ = Describe("hook callback handler", func() { | ||
Context("on define domain", func() { |
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.
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.
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.
What do you mean by additional 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.
I meant "layer". Why do you need the Context
?
|
||
Expect(callback.OnDefineDomain(domainSpecXML, domSpecMutator)).To(Equal(domainSpecXML)) | ||
}) | ||
}) |
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.
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).
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
cmd/network-slirp-binding/slirp.go
Outdated
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 you should call this file main
.
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
cmd/network-slirp-binding/slirp.go
Outdated
srv "kubevirt.io/kubevirt/cmd/network-slirp-binding/server" | ||
) | ||
|
||
func main() { | ||
searchDomains, err := dns.ReadResolvConfSearchDomains() | ||
if err != nil { | ||
panic(err) |
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.
IMO it should exist normally with a message to stderr (using the log) and not panic. Panic fits libraries perhaps, not main().
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
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 see you kept the panic.
Edit: Ignore this, I saw a different one.
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 fixed in the second commit daa84f7
I think Github had a hiccup.
//testMutator := domain.SlirpNetworkConfigurator{ | ||
// Interfaces: []vmschema.Interface{iface}, | ||
// Networks: []vmschema.Network{network}, | ||
// SearchDomains: testSearchDomain, | ||
//} | ||
|
||
//_, err := testMutator.Mutate(&domainschema.DomainSpec{}) | ||
//Expect(err).To(HaveOccurred()) |
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.
leftover?
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.
Removed
//testMutator := domain.SlirpNetworkConfigurator{ | ||
// Interfaces: []vmschema.Interface{iface}, | ||
// Networks: []vmschema.Network{network}, | ||
// SearchDomains: testSearchDomain, | ||
//} | ||
// | ||
//_, err := testMutator.Mutate(&domainschema.DomainSpec{}) | ||
//Expect(err).To(HaveOccurred()) |
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.
leftotver?
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.
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) |
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 seems it will fail if no slirp interface is detected.
Should we really fail or just log an error on stderr?
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.
IMO it should fail, it means that the plugin is called with invalid VM configuration that should have been detected by the webhook.
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 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?
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.
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"}`}, | ||
}, | ||
), |
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.
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).
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.
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?
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.
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.
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 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?
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.
OK, we can consider it as a bug. But please follow up on this.
domainSpec.QEMUCmd = initQemuCmdArgs(domainSpec.QEMUCmd) | ||
domainSpec.QEMUCmd.QEMUArg = append(domainSpec.QEMUCmd.QEMUArg, slirpQemuCmdArgs...) |
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 am not sure if we can or should override any existing definitions.
Other sidecars hooks may use these commands.
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.
Note that this is no overriding, slirp related command args are appended to the domain spec commandline.
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 initQemuCmdArgs
is confusing, I though it initializes it (always), but it seems it is conditioned.
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 have also added a test to reflect this behavior.
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 name init is indeed confusing. Maybe initQemuCmdArgsIfNeeded
.
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.
Looking at this again, I dont think we need it at all, I inlined initQemuCmdArgsIfNeeded
.
9715b54
to
d731eab
Compare
{Value: `-device`}, | ||
{Value: `{"driver":"e1000","netdev":"default","id":"default"}`}, | ||
}, | ||
), |
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.
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" |
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.
?
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.
Sorry for the mess, fixed
|
||
//expectedArg := "abc" | ||
domSpec := &domainschema.DomainSpec{ | ||
// QEMUCmd: &domainschema.Commandline{QEMUArg: []domainschema.Arg{{Value: expectedArg}}}, |
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.
?
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.
Sorry for the mess, fixed
cmd/network-slirp-binding/main.go
Outdated
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) |
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.
Can you replace this panic as well?
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
d731eab
to
95b95bf
Compare
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 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"}`}, | ||
}, | ||
), |
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.
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" { |
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 do not understand this change.
Based on what rt18139
is now overridden by e1000
?
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.
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) |
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.
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 { |
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.
Pending feedback.
07333b3
to
0b84604
Compare
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>
97ebafc
to
5d22478
Compare
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>
5d22478
to
487446e
Compare
/approve Thanks! |
[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 |
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!!
Unrelated failures: /test pull-kubevirt-e2e-k8s-1.27-sig-compute |
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: