Validate single-stack --nodeport-addresses sooner
In the dual-stack case, iptables.NewDualStackProxier and ipvs.NewDualStackProxier filtered the nodeport addresses values by IP family before creating the single-stack proxiers. But in the single-stack case, the kube-proxy startup code just passed the value to the single-stack proxiers without validation, so they had to re-check it themselves. Fix that.
This commit is contained in:
@@ -2117,11 +2117,11 @@ func TestOnlyLocalNodePorts(t *testing.T) {
|
||||
addrs1 := []net.Addr{&net.IPNet{IP: netutils.ParseIPSloppy("2001:db8::"), Mask: net.CIDRMask(64, 128)}}
|
||||
fp.networkInterfacer.(*proxyutiltest.FakeNetwork).AddInterfaceAddr(&itf, addrs)
|
||||
fp.networkInterfacer.(*proxyutiltest.FakeNetwork).AddInterfaceAddr(&itf1, addrs1)
|
||||
fp.nodePortAddresses = []string{"100.101.102.0/24", "2001:db8::0/64"}
|
||||
fp.nodePortAddresses = []string{"100.101.102.0/24"}
|
||||
|
||||
fp.syncProxyRules()
|
||||
|
||||
// Expect 2 (matching ipvs IPFamily field) services and 1 destination
|
||||
// Expect 2 services and 1 destination
|
||||
epVS := &netlinktest.ExpectedVirtualServer{
|
||||
VSNum: 2, IP: nodeIP.String(), Port: uint16(svcNodePort), Protocol: string(v1.ProtocolTCP),
|
||||
RS: []netlinktest.ExpectedRealServer{{
|
||||
@@ -2205,7 +2205,7 @@ func TestHealthCheckNodePort(t *testing.T) {
|
||||
addrs1 := []net.Addr{&net.IPNet{IP: netutils.ParseIPSloppy("2001:db8::"), Mask: net.CIDRMask(64, 128)}}
|
||||
fp.networkInterfacer.(*proxyutiltest.FakeNetwork).AddInterfaceAddr(&itf, addrs)
|
||||
fp.networkInterfacer.(*proxyutiltest.FakeNetwork).AddInterfaceAddr(&itf1, addrs1)
|
||||
fp.nodePortAddresses = []string{"100.101.102.0/24", "2001:db8::0/64"}
|
||||
fp.nodePortAddresses = []string{"100.101.102.0/24"}
|
||||
|
||||
fp.syncProxyRules()
|
||||
|
||||
|
Reference in New Issue
Block a user