Skip to content

Commit 68ffe58

Browse files
add todo and remove multiple interface scenario
1 parent 605770b commit 68ffe58

File tree

4 files changed

+5
-88
lines changed

4 files changed

+5
-88
lines changed

azure-ipam/ipam.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func (p *IPAMPlugin) CmdAdd(args *cniSkel.CmdArgs) error {
146146
for _, podIPInfo := range resp.PodIPInfo {
147147
// Skip if interface already seen
148148
// This is to avoid duplicate interfaces in the result
149-
// Deduplication is necessary because there is one podIPInfo entry for each IP family(IPv4 and IPv6), and both may point to the same interface or if multiple interfaces are assigned to the same pod
149+
// Deduplication is necessary because there is one podIPInfo entry for each IP family(IPv4 and IPv6), and both may point to the same interface
150150
if podIPInfo.MacAddress == "" || seenInterfaces[podIPInfo.MacAddress] {
151151
continue
152152
}

azure-ipam/ipam_test.go

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -266,46 +266,6 @@ func (c *MockCNSClient) RequestIPs(ctx context.Context, ipconfig cns.IPConfigsRe
266266
Subnet: "fd11:1234::/120",
267267
},
268268
},
269-
{
270-
PodIPConfig: cns.IPSubnet{
271-
IPAddress: "192.168.1.10",
272-
PrefixLength: 24,
273-
},
274-
MacAddress: "aa:bb:cc:dd:ee:ff",
275-
NetworkContainerPrimaryIPConfig: cns.IPConfiguration{
276-
IPSubnet: cns.IPSubnet{
277-
IPAddress: "192.168.1.0",
278-
PrefixLength: 24,
279-
},
280-
DNSServers: nil,
281-
GatewayIPAddress: "192.168.1.1",
282-
},
283-
HostPrimaryIPInfo: cns.HostIPInfo{
284-
Gateway: "192.168.1.1",
285-
PrimaryIP: "192.168.1.1",
286-
Subnet: "192.168.1.0/24",
287-
},
288-
},
289-
{
290-
PodIPConfig: cns.IPSubnet{
291-
IPAddress: "172.16.1.10",
292-
PrefixLength: 24,
293-
},
294-
MacAddress: "",
295-
NetworkContainerPrimaryIPConfig: cns.IPConfiguration{
296-
IPSubnet: cns.IPSubnet{
297-
IPAddress: "172.16.1.0",
298-
PrefixLength: 24,
299-
},
300-
DNSServers: nil,
301-
GatewayIPAddress: "172.16.1.1",
302-
},
303-
HostPrimaryIPInfo: cns.HostIPInfo{
304-
Gateway: "172.16.1.1",
305-
PrimaryIP: "172.16.1.1",
306-
Subnet: "172.16.1.0/24",
307-
},
308-
},
309269
},
310270
Response: cns.Response{
311271
ReturnCode: 0,
@@ -449,53 +409,6 @@ func TestCmdAdd(t *testing.T) {
449409
},
450410
wantErr: false,
451411
},
452-
{
453-
name: "Test MAC address deduplication and multi-interface",
454-
args: buildArgs("happyArgsMultiInterface", happyPodArgs, happyNetConfByteArr),
455-
want: &types100.Result{
456-
CNIVersion: "1.0.0",
457-
Interfaces: []*types100.Interface{
458-
{
459-
Mac: "00:11:22:33:44:55", // First unique MAC (dual-stack)
460-
},
461-
{
462-
Mac: "aa:bb:cc:dd:ee:ff", // Second unique MAC
463-
},
464-
},
465-
IPs: []*types100.IPConfig{
466-
{
467-
Address: net.IPNet{
468-
IP: net.IPv4(10, 0, 1, 10),
469-
Mask: net.CIDRMask(24, 32),
470-
},
471-
Gateway: net.IPv4(10, 0, 0, 1),
472-
},
473-
{
474-
Address: net.IPNet{
475-
IP: net.ParseIP("fd11:1234::1"),
476-
Mask: net.CIDRMask(120, 128),
477-
},
478-
Gateway: net.ParseIP("fe80::1234:5678:9abc"),
479-
},
480-
{
481-
Address: net.IPNet{
482-
IP: net.IPv4(192, 168, 1, 10),
483-
Mask: net.CIDRMask(24, 32),
484-
},
485-
Gateway: net.IPv4(192, 168, 1, 1),
486-
},
487-
{
488-
Address: net.IPNet{
489-
IP: net.IPv4(172, 16, 1, 10),
490-
Mask: net.CIDRMask(24, 32),
491-
},
492-
Gateway: net.IPv4(172, 16, 1, 1),
493-
},
494-
},
495-
DNS: cniTypes.DNS{},
496-
},
497-
wantErr: false,
498-
},
499412
{
500413
name: "CNI add with nil gateway IP",
501414
args: buildArgs("nilGateway", happyPodArgs, happyNetConfByteArr),

cns/kubecontroller/nodenetworkconfig/conversion_linux.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import (
1616
func createNCRequestFromStaticNCHelper(nc v1alpha.NetworkContainer, primaryIPPrefix netip.Prefix, subnet cns.IPSubnet) (*cns.CreateNetworkContainerRequest, error) {
1717
secondaryIPConfigs := map[string]cns.SecondaryIPConfig{}
1818

19+
// Todo: Segregate the NIC’s primary IP from the list of secondary IPs to ensure the primary IP is not assigned to pods
20+
// WorkItem: https://msazure.visualstudio.com/One/_workitems/edit/33460135
1921
// iterate through all IP addresses in the subnet described by primaryPrefix and
2022
// add them to the request as secondary IPConfigs.
2123
for addr := primaryIPPrefix.Masked().Addr(); primaryIPPrefix.Contains(addr); addr = addr.Next() {

cns/restserver/internalapi.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ func (service *HTTPRestService) syncHostNCVersion(ctx context.Context, channelMo
216216
if len(outdatedNCs) == 0 {
217217
return len(programmedNCs), nil
218218
}
219+
// Todo: Query NMA for the supported API to validate the build version. If supported, query IMDS for the Swiftv2 NC version list and perform synchostversion update.
220+
// WorkItem: https://msazure.visualstudio.com/One/_workitems/edit/33460135
219221
ncVersionListResp, err := service.nma.GetNCVersionList(ctx)
220222
if err != nil {
221223
return len(programmedNCs), errors.Wrap(err, "failed to get nc version list from nmagent")

0 commit comments

Comments
 (0)