Skip to content

Commit ec7656a

Browse files
authored
[POND] Add Windows default gateway v6 to cns. (#4281)
* Add Windows default gateway v6 to cns. * Add unit test. * Update the unit test to cover windows only. * revert unnecessary change when rebase from master. * Revert the master change in unit test. * Revert the unnecessary unit test change.
1 parent f7d0eeb commit ec7656a

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

cns/kubecontroller/nodenetworkconfig/conversion_windows.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ func createNCRequestFromStaticNCHelper(
7474
NetworkContainerType: cns.Docker,
7575
Version: strconv.FormatInt(nc.Version, 10), //nolint:gomnd // it's decimal
7676
IPConfiguration: cns.IPConfiguration{
77-
IPSubnet: subnet,
78-
IPSubnetV6: subnetV6,
79-
GatewayIPAddress: nc.DefaultGateway,
77+
IPSubnet: subnet,
78+
IPSubnetV6: subnetV6,
79+
GatewayIPAddress: nc.DefaultGateway,
80+
GatewayIPv6Address: nc.DefaultGatewayV6,
8081
},
8182
NCStatus: nc.Status,
8283
}, nil

cns/kubecontroller/nodenetworkconfig/conversion_windows_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,19 @@ func TestIPv6PrefixClampWindows(t *testing.T) {
150150
})
151151
}
152152
}
153+
154+
func TestGatewayIPv6AddressWindows(t *testing.T) {
155+
nc := v1alpha.NetworkContainer{
156+
AssignmentMode: v1alpha.Static,
157+
Type: v1alpha.Overlay,
158+
ID: ncID,
159+
PrimaryIP: overlayPrimaryIP,
160+
NodeIP: nodeIP,
161+
SubnetName: subnetName,
162+
SubnetAddressSpace: subnetAddressSpace,
163+
DefaultGatewayV6: "fd00::1",
164+
}
165+
got, err := CreateNCRequestFromStaticNC(nc, false, 0)
166+
require.NoError(t, err)
167+
assert.Equal(t, "fd00::1", got.IPConfiguration.GatewayIPv6Address)
168+
}

0 commit comments

Comments
 (0)