diff --git a/cmd/kube-proxy/app/server_windows.go b/cmd/kube-proxy/app/server_windows.go index 650a598af56..ea686c7f4c6 100644 --- a/cmd/kube-proxy/app/server_windows.go +++ b/cmd/kube-proxy/app/server_windows.go @@ -96,7 +96,6 @@ func (s *ProxyServer) createProxier(config *proxyconfigapi.KubeProxyConfiguratio proxier, err = winkernel.NewDualStackProxier( config.IPTables.SyncPeriod.Duration, config.IPTables.MinSyncPeriod.Duration, - config.ClusterCIDR, s.Hostname, s.NodeIPs, s.Recorder, @@ -109,7 +108,6 @@ func (s *ProxyServer) createProxier(config *proxyconfigapi.KubeProxyConfiguratio s.PrimaryIPFamily, config.IPTables.SyncPeriod.Duration, config.IPTables.MinSyncPeriod.Duration, - config.ClusterCIDR, s.Hostname, s.NodeIPs[s.PrimaryIPFamily], s.Recorder, diff --git a/pkg/proxy/winkernel/proxier.go b/pkg/proxy/winkernel/proxier.go index 844940f3484..4ecd72ea7df 100644 --- a/pkg/proxy/winkernel/proxier.go +++ b/pkg/proxy/winkernel/proxier.go @@ -596,10 +596,9 @@ type Proxier struct { initialized int32 syncRunner *async.BoundedFrequencyRunner // governs calls to syncProxyRules // These are effectively const and do not need the mutex to be held. - clusterCIDR string - hostname string - nodeIP net.IP - recorder events.EventRecorder + hostname string + nodeIP net.IP + recorder events.EventRecorder serviceHealthServer healthcheck.ServiceHealthServer healthzServer *healthcheck.ProxierHealthServer @@ -654,7 +653,6 @@ func NewProxier( ipFamily v1.IPFamily, syncPeriod time.Duration, minSyncPeriod time.Duration, - clusterCIDR string, hostname string, nodeIP net.IP, recorder events.EventRecorder, @@ -667,10 +665,6 @@ func NewProxier( nodeIP = netutils.ParseIPSloppy("127.0.0.1") } - if len(clusterCIDR) == 0 { - klog.InfoS("ClusterCIDR not specified, unable to distinguish between internal and external traffic") - } - // windows listens to all node addresses nodePortAddresses := proxyutil.NewNodePortAddresses(ipFamily, nil) serviceHealthServer := healthcheck.NewServiceHealthServer(hostname, recorder, nodePortAddresses, healthzServer) @@ -757,7 +751,6 @@ func NewProxier( endPointsRefCount: make(endPointsReferenceCountMap), svcPortMap: make(proxy.ServicePortMap), endpointsMap: make(proxy.EndpointsMap), - clusterCIDR: clusterCIDR, hostname: hostname, nodeIP: nodeIP, recorder: recorder, @@ -790,7 +783,6 @@ func NewProxier( func NewDualStackProxier( syncPeriod time.Duration, minSyncPeriod time.Duration, - clusterCIDR string, hostname string, nodeIPs map[v1.IPFamily]net.IP, recorder events.EventRecorder, @@ -801,18 +793,18 @@ func NewDualStackProxier( // Create an ipv4 instance of the single-stack proxier ipv4Proxier, err := NewProxier(v1.IPv4Protocol, syncPeriod, minSyncPeriod, - clusterCIDR, hostname, nodeIPs[v1.IPv4Protocol], recorder, healthzServer, + hostname, nodeIPs[v1.IPv4Protocol], recorder, healthzServer, config, healthzPort) if err != nil { - return nil, fmt.Errorf("unable to create ipv4 proxier: %v, hostname: %s, clusterCIDR : %s, nodeIP:%v", err, hostname, clusterCIDR, nodeIPs[v1.IPv4Protocol]) + return nil, fmt.Errorf("unable to create ipv4 proxier: %v, hostname: %s, nodeIP:%v", err, hostname, nodeIPs[v1.IPv4Protocol]) } ipv6Proxier, err := NewProxier(v1.IPv6Protocol, syncPeriod, minSyncPeriod, - clusterCIDR, hostname, nodeIPs[v1.IPv6Protocol], recorder, healthzServer, + hostname, nodeIPs[v1.IPv6Protocol], recorder, healthzServer, config, healthzPort) if err != nil { - return nil, fmt.Errorf("unable to create ipv6 proxier: %v, hostname: %s, clusterCIDR : %s, nodeIP:%v", err, hostname, clusterCIDR, nodeIPs[v1.IPv6Protocol]) + return nil, fmt.Errorf("unable to create ipv6 proxier: %v, hostname: %s, nodeIP:%v", err, hostname, nodeIPs[v1.IPv6Protocol]) } // Return a meta-proxier that dispatch calls between the two diff --git a/pkg/proxy/winkernel/proxier_test.go b/pkg/proxy/winkernel/proxier_test.go index 1b9bd287d24..964ca542835 100644 --- a/pkg/proxy/winkernel/proxier_test.go +++ b/pkg/proxy/winkernel/proxier_test.go @@ -46,7 +46,6 @@ const ( ipAddress = "10.0.0.1" prefixLen = 24 macAddress = "00-11-22-33-44-55" - clusterCIDR = "192.168.1.0/24" destinationPrefix = "192.168.2.0/24" providerAddress = "10.0.0.3" guid = "123ABC" @@ -84,7 +83,7 @@ func newHnsNetwork(networkInfo *hnsNetworkInfo) *hcn.HostComputeNetwork { return network } -func NewFakeProxier(syncPeriod time.Duration, minSyncPeriod time.Duration, clusterCIDR string, hostname string, nodeIP net.IP, networkType string) *Proxier { +func NewFakeProxier(syncPeriod time.Duration, minSyncPeriod time.Duration, hostname string, nodeIP net.IP, networkType string) *Proxier { sourceVip := "192.168.1.2" var remoteSubnets []*remoteSubnetInfo rs := &remoteSubnetInfo{ @@ -105,7 +104,6 @@ func NewFakeProxier(syncPeriod time.Duration, minSyncPeriod time.Duration, clust proxier := &Proxier{ svcPortMap: make(proxy.ServicePortMap), endpointsMap: make(proxy.EndpointsMap), - clusterCIDR: clusterCIDR, hostname: testHostName, nodeIP: nodeIP, serviceHealthServer: healthcheck.NewFakeServiceHealthServer(), @@ -132,7 +130,7 @@ func NewFakeProxier(syncPeriod time.Duration, minSyncPeriod time.Duration, clust func TestCreateServiceVip(t *testing.T) { syncPeriod := 30 * time.Second - proxier := NewFakeProxier(syncPeriod, syncPeriod, clusterCIDR, "testhost", netutils.ParseIPSloppy("10.0.0.1"), NETWORK_TYPE_OVERLAY) + proxier := NewFakeProxier(syncPeriod, syncPeriod, "testhost", netutils.ParseIPSloppy("10.0.0.1"), NETWORK_TYPE_OVERLAY) if proxier == nil { t.Error() } @@ -186,7 +184,7 @@ func TestCreateServiceVip(t *testing.T) { func TestCreateRemoteEndpointOverlay(t *testing.T) { syncPeriod := 30 * time.Second - proxier := NewFakeProxier(syncPeriod, syncPeriod, clusterCIDR, "testhost", netutils.ParseIPSloppy("10.0.0.1"), NETWORK_TYPE_OVERLAY) + proxier := NewFakeProxier(syncPeriod, syncPeriod, "testhost", netutils.ParseIPSloppy("10.0.0.1"), NETWORK_TYPE_OVERLAY) if proxier == nil { t.Error() } @@ -251,7 +249,7 @@ func TestCreateRemoteEndpointOverlay(t *testing.T) { func TestCreateRemoteEndpointL2Bridge(t *testing.T) { syncPeriod := 30 * time.Second - proxier := NewFakeProxier(syncPeriod, syncPeriod, clusterCIDR, "testhost", netutils.ParseIPSloppy("10.0.0.1"), "L2Bridge") + proxier := NewFakeProxier(syncPeriod, syncPeriod, "testhost", netutils.ParseIPSloppy("10.0.0.1"), "L2Bridge") if proxier == nil { t.Error() } @@ -313,7 +311,7 @@ func TestCreateRemoteEndpointL2Bridge(t *testing.T) { } func TestSharedRemoteEndpointDelete(t *testing.T) { syncPeriod := 30 * time.Second - proxier := NewFakeProxier(syncPeriod, syncPeriod, clusterCIDR, "testhost", netutils.ParseIPSloppy("10.0.0.1"), "L2Bridge") + proxier := NewFakeProxier(syncPeriod, syncPeriod, "testhost", netutils.ParseIPSloppy("10.0.0.1"), "L2Bridge") if proxier == nil { t.Error() } @@ -455,7 +453,7 @@ func TestSharedRemoteEndpointDelete(t *testing.T) { } func TestSharedRemoteEndpointUpdate(t *testing.T) { syncPeriod := 30 * time.Second - proxier := NewFakeProxier(syncPeriod, syncPeriod, clusterCIDR, "testhost", netutils.ParseIPSloppy("10.0.0.1"), "L2Bridge") + proxier := NewFakeProxier(syncPeriod, syncPeriod, "testhost", netutils.ParseIPSloppy("10.0.0.1"), "L2Bridge") if proxier == nil { t.Error() } @@ -629,7 +627,7 @@ func TestSharedRemoteEndpointUpdate(t *testing.T) { } func TestCreateLoadBalancer(t *testing.T) { syncPeriod := 30 * time.Second - proxier := NewFakeProxier(syncPeriod, syncPeriod, clusterCIDR, "testhost", netutils.ParseIPSloppy("10.0.0.1"), NETWORK_TYPE_OVERLAY) + proxier := NewFakeProxier(syncPeriod, syncPeriod, "testhost", netutils.ParseIPSloppy("10.0.0.1"), NETWORK_TYPE_OVERLAY) if proxier == nil { t.Error() } @@ -686,7 +684,7 @@ func TestCreateLoadBalancer(t *testing.T) { func TestCreateDsrLoadBalancer(t *testing.T) { syncPeriod := 30 * time.Second - proxier := NewFakeProxier(syncPeriod, syncPeriod, clusterCIDR, "testhost", netutils.ParseIPSloppy("10.0.0.1"), NETWORK_TYPE_OVERLAY) + proxier := NewFakeProxier(syncPeriod, syncPeriod, "testhost", netutils.ParseIPSloppy("10.0.0.1"), NETWORK_TYPE_OVERLAY) if proxier == nil { t.Error() } @@ -764,7 +762,7 @@ func TestCreateDsrLoadBalancer(t *testing.T) { // loadbalancers will be created. func TestClusterIPLBInCreateDsrLoadBalancer(t *testing.T) { syncPeriod := 30 * time.Second - proxier := NewFakeProxier(syncPeriod, syncPeriod, clusterCIDR, "testhost", netutils.ParseIPSloppy("10.0.0.1"), NETWORK_TYPE_OVERLAY) + proxier := NewFakeProxier(syncPeriod, syncPeriod, "testhost", netutils.ParseIPSloppy("10.0.0.1"), NETWORK_TYPE_OVERLAY) if proxier == nil { t.Error() @@ -845,7 +843,7 @@ func TestClusterIPLBInCreateDsrLoadBalancer(t *testing.T) { func TestEndpointSlice(t *testing.T) { syncPeriod := 30 * time.Second - proxier := NewFakeProxier(syncPeriod, syncPeriod, clusterCIDR, "testhost", netutils.ParseIPSloppy("10.0.0.1"), NETWORK_TYPE_OVERLAY) + proxier := NewFakeProxier(syncPeriod, syncPeriod, "testhost", netutils.ParseIPSloppy("10.0.0.1"), NETWORK_TYPE_OVERLAY) if proxier == nil { t.Error() } @@ -925,7 +923,7 @@ func TestNoopEndpointSlice(t *testing.T) { func TestFindRemoteSubnetProviderAddress(t *testing.T) { syncPeriod := 30 * time.Second - proxier := NewFakeProxier(syncPeriod, syncPeriod, clusterCIDR, "testhost", netutils.ParseIPSloppy("10.0.0.1"), NETWORK_TYPE_OVERLAY) + proxier := NewFakeProxier(syncPeriod, syncPeriod, "testhost", netutils.ParseIPSloppy("10.0.0.1"), NETWORK_TYPE_OVERLAY) if proxier == nil { t.Error() }