Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:Update
kubevirt
0004-Improve-the-handling-of-ordinal-pod-interf...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0004-Improve-the-handling-of-ordinal-pod-interface-name-for-upgrade.patch of Package kubevirt
From f971fd63e00bb025459ff321e45a8e3d888ce11c Mon Sep 17 00:00:00 2001 From: Vicente Cheng <vicente.cheng@suse.com> Date: Wed, 10 Apr 2024 00:47:44 +0800 Subject: [PATCH 1/2] network: add more network name scheme test cases - Add different order to verify the correct interface name - Add only one secondary network to verify the correct interface name Signed-off-by: Vicente Cheng <vicente.cheng@suse.com> --- pkg/network/namescheme/networknamescheme_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkg/network/namescheme/networknamescheme_test.go b/pkg/network/namescheme/networknamescheme_test.go index 8fe85485006a..7b6fe8f562f4 100644 --- a/pkg/network/namescheme/networknamescheme_test.go +++ b/pkg/network/namescheme/networknamescheme_test.go @@ -259,6 +259,22 @@ var _ = Describe("Network Name Scheme", func() { }, "net2", ), + Entry("given secondary network name with different order", + "multus01", + []virtv1.Network{ + createMultusSecondaryNetwork("blue", "test-br"), + createMultusSecondaryNetwork("multus01", "test-br"), + newPodNetwork(), + }, + "net2", + ), + Entry("given secondary network name, only one secondary network", + "multus01", + []virtv1.Network{ + createMultusSecondaryNetwork("multus01", "test-br"), + }, + "net1", + ), ) }) }) From b8d181ec8c81353e0e8462f3f41a8ae916795730 Mon Sep 17 00:00:00 2001 From: Vicente Cheng <vicente.cheng@suse.com> Date: Wed, 10 Apr 2024 01:10:36 +0800 Subject: [PATCH 2/2] network: improve the OrdinalPodInterfaceName mechanism - the networks are not ordered, means the pod network is not always on the first. We should consider more to get the secondary network because the secondary started from 1 to n. - Also, we should consider only have one multus and secondary network situation. This change mainly finetune the mechanism for get the secondary multus network. Signed-off-by: Vicente Cheng <vicente.cheng@suse.com> --- pkg/network/namescheme/networknamescheme.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pkg/network/namescheme/networknamescheme.go b/pkg/network/namescheme/networknamescheme.go index b2be1d62e54d..470151c91806 100644 --- a/pkg/network/namescheme/networknamescheme.go +++ b/pkg/network/namescheme/networknamescheme.go @@ -92,17 +92,13 @@ func CreateOrdinalNetworkNameScheme(vmiNetworks []v1.Network) map[string]string return networkNameSchemeMap } +// OrdinalPodInterfaceName returns the ordinal interface name for the given network name. +// Rereuse the `CreateOrdinalNetworkNameScheme` for various networks helps find the target interface name. func OrdinalPodInterfaceName(name string, networks []v1.Network) string { - for i, network := range networks { - if network.Name == name { - if vmispec.IsSecondaryMultusNetwork(network) { - return generateOrdinalInterfaceName(i) - } - - return PrimaryPodInterfaceName - } + networkNameSchemeMap := CreateOrdinalNetworkNameScheme(networks) + if ordinalName, exist := networkNameSchemeMap[name]; exist { + return ordinalName } - return "" }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor