Skip to content

Commit

Permalink
fix: Windows Overlay Gateway Bug (#1852)
Browse files Browse the repository at this point in the history
* fix overlay gatway bug that prevented cloud-node-manager-windows from initializing node because it couldn't reach IMDS

* use parseip instead of mask

* scope CNI overlay gateway bug fix to windows only

* update test

* adding UT to verify overlay NAT info is empty

* add podsubnet netInfo test

* fix tests and convert to old structs names

---------

Co-authored-by: Jaeryn <[email protected]>
  • Loading branch information
2 people authored and jpayne3506 committed Sep 12, 2023
1 parent c325121 commit fb71cc5
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions cni/network/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ func TestPluginMultitenancyDelete(t *testing.T) {
}

/*
Baremetal scenarios
Baremetal scenarios
*/
func TestPluginBaremetalAdd(t *testing.T) {
plugin, _ := cni.NewPlugin("test", "0.3.0")
Expand Down Expand Up @@ -838,7 +838,7 @@ func TestPluginBaremetalDelete(t *testing.T) {
}

/*
AKS-Swift scenario
AKS-Swift scenario
*/
func TestPluginAKSSwiftAdd(t *testing.T) {
plugin := GetTestResources()
Expand Down Expand Up @@ -1081,6 +1081,7 @@ func TestGetNetworkName(t *testing.T) {
})
}
}
<<<<<<< HEAD

func TestGetOverlayNatInfo(t *testing.T) {
nwCfg := &cni.NetworkConfig{ExecutionMode: string(util.V4Swift), IPAM: cni.IPAM{Mode: string(util.V4Overlay)}}
Expand All @@ -1101,3 +1102,27 @@ func TestGetPodSubnetNatInfo(t *testing.T) {
require.Empty(t, natInfo, "linux podsubnet natInfo should be empty")
}
}
||||||| parent of 0160f7dc (fix: Windows Overlay Gateway Bug (#1852))
=======

func TestGetOverlayNatInfo(t *testing.T) {
nwCfg := &cni.NetworkConfig{ExecutionMode: string(util.V4Swift)}
nwCfg.Ipam.Mode = string(util.V4Overlay)
natInfo := getNATInfo(nwCfg, nil, false)
require.Empty(t, natInfo, "overlay natInfo should be empty")
}

func TestGetPodSubnetNatInfo(t *testing.T) {
ncPrimaryIP := "10.241.0.4"
nwCfg := &cni.NetworkConfig{ExecutionMode: string(util.V4Swift)}
natInfo := getNATInfo(nwCfg, ncPrimaryIP, false)
if runtime.GOOS == "windows" {
require.Equalf(t, natInfo, []policy.NATInfo{
{VirtualIP: ncPrimaryIP, Destinations: []string{networkutils.AzureDNS}},
{Destinations: []string{networkutils.AzureIMDS}},
}, "invalid windows podsubnet natInfo")
} else {
require.Empty(t, natInfo, "linux podsubnet natInfo should be empty")
}
}
>>>>>>> 0160f7dc (fix: Windows Overlay Gateway Bug (#1852))

0 comments on commit fb71cc5

Please sign in to comment.