Skip to content

Commit

Permalink
Merge pull request kubevirt#8716 from rhrazdil/passt_overhead
Browse files Browse the repository at this point in the history
network,passt: consider overhead when binding all ports
  • Loading branch information
kubevirt-bot authored Nov 11, 2022
2 parents 373ba7a + 8c427ec commit f50ae91
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
8 changes: 8 additions & 0 deletions pkg/virt-controller/services/renderresources.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,14 @@ func GetMemoryOverhead(vmi *v1.VirtualMachineInstance, cpuArch string) *resource
overhead.Add(resource.MustParse("53Mi"))
}

// Additional overhead for each interface with Passt binding, that forwards all ports.
// More information can be found here: https://bugs.passt.top/show_bug.cgi?id=20
for _, net := range vmi.Spec.Domain.Devices.Interfaces {
if net.Passt != nil && len(net.Ports) == 0 {
overhead.Add(resource.MustParse("800Mi"))
}
}

return overhead
}

Expand Down
1 change: 0 additions & 1 deletion tests/network/vmi_istio.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,6 @@ func createPasstVm(ports []v1.Port) *v1.VirtualMachineInstance {
libvmi.WithInterface(libvmi.InterfaceDeviceWithPasstBinding(ports...)),
libvmi.WithLabel(vmiAppSelectorKey, vmiAppSelectorValue),
libvmi.WithAnnotation(istio.ISTIO_INJECT_ANNOTATION, "true"),
withPasstExtendedResourceMemory(ports...),
)
return vmi
}
Expand Down
10 changes: 0 additions & 10 deletions tests/network/vmi_passt.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ var _ = SIGDescribe("[Serial] Passt", func() {
serverVMI = libvmi.NewAlpineWithTestTooling(
libvmi.WithInterface(libvmi.InterfaceDeviceWithPasstBinding(ports...)),
libvmi.WithNetwork(v1.DefaultPodNetwork()),
withPasstExtendedResourceMemory(ports...),
)

serverVMI, err = virtClient.VirtualMachineInstance(util.NamespaceTestDefault).Create(serverVMI)
Expand Down Expand Up @@ -214,7 +213,6 @@ EOL`, inetSuffix, serverIP, serverPort)
clientVMI = libvmi.NewAlpineWithTestTooling(
libvmi.WithInterface(libvmi.InterfaceDeviceWithPasstBinding()),
libvmi.WithNetwork(v1.DefaultPodNetwork()),
withPasstExtendedResourceMemory(),
)
clientVMI, err = virtClient.VirtualMachineInstance(util.NamespaceTestDefault).Create(clientVMI)
Expect(err).ToNot(HaveOccurred())
Expand Down Expand Up @@ -288,11 +286,3 @@ EOL`, inetSuffix, serverIP, serverPort)
})
})
})

func withPasstExtendedResourceMemory(ports ...v1.Port) libvmi.Option {
if len(ports) == 0 {
return libvmi.WithResourceMemory("2048M")
}
return func(vmi *v1.VirtualMachineInstance) {
}
}

0 comments on commit f50ae91

Please sign in to comment.