diff --git a/cmd/kube-proxy/app/server_windows.go b/cmd/kube-proxy/app/server_windows.go index 481f0d8c58b..a6ba3eff5ce 100644 --- a/cmd/kube-proxy/app/server_windows.go +++ b/cmd/kube-proxy/app/server_windows.go @@ -111,8 +111,6 @@ func newProxyServer(config *proxyconfigapi.KubeProxyConfiguration, master string proxier, err = winkernel.NewDualStackProxier( config.IPTables.SyncPeriod.Duration, config.IPTables.MinSyncPeriod.Duration, - config.IPTables.MasqueradeAll, - int(*config.IPTables.MasqueradeBit), config.ClusterCIDR, hostname, nodeIPTuple(config.BindAddress), @@ -125,8 +123,6 @@ func newProxyServer(config *proxyconfigapi.KubeProxyConfiguration, master string proxier, err = winkernel.NewProxier( config.IPTables.SyncPeriod.Duration, config.IPTables.MinSyncPeriod.Duration, - config.IPTables.MasqueradeAll, - int(*config.IPTables.MasqueradeBit), config.ClusterCIDR, hostname, nodeIP, diff --git a/pkg/proxy/winkernel/proxier.go b/pkg/proxy/winkernel/proxier.go index 3c14451dbdb..e281796f223 100644 --- a/pkg/proxy/winkernel/proxier.go +++ b/pkg/proxy/winkernel/proxier.go @@ -33,7 +33,6 @@ import ( "github.com/Microsoft/hcsshim/hcn" v1 "k8s.io/api/core/v1" discovery "k8s.io/api/discovery/v1" - "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" apiutil "k8s.io/apimachinery/pkg/util/net" "k8s.io/apimachinery/pkg/util/sets" @@ -41,7 +40,6 @@ import ( utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/client-go/tools/events" "k8s.io/klog/v2" - "k8s.io/kubernetes/pkg/apis/core/v1/helper" kubefeatures "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/proxy" "k8s.io/kubernetes/pkg/proxy/apis/config" @@ -614,21 +612,14 @@ 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. - masqueradeAll bool - masqueradeMark string - clusterCIDR string - hostname string - nodeIP net.IP - recorder events.EventRecorder + clusterCIDR string + hostname string + nodeIP net.IP + recorder events.EventRecorder serviceHealthServer healthcheck.ServiceHealthServer healthzServer healthcheck.ProxierHealthUpdater - // Since converting probabilities (floats) to strings is expensive - // and we are using only probabilities in the format of 1/n, we are - // precomputing some number of those and cache for future reuse. - precomputedProbabilities []string - hns HostNetworkService network hnsNetworkInfo sourceVip string @@ -677,8 +668,6 @@ var _ proxy.Provider = &Proxier{} func NewProxier( syncPeriod time.Duration, minSyncPeriod time.Duration, - masqueradeAll bool, - masqueradeBit int, clusterCIDR string, hostname string, nodeIP net.IP, @@ -687,9 +676,6 @@ func NewProxier( config config.KubeProxyWinkernelConfiguration, healthzPort int, ) (*Proxier, error) { - masqueradeValue := 1 << uint(masqueradeBit) - masqueradeMark := fmt.Sprintf("%#08x/%#08x", masqueradeValue, masqueradeValue) - if nodeIP == nil { klog.InfoS("Invalid nodeIP, initializing kube-proxy with 127.0.0.1 as nodeIP") nodeIP = netutils.ParseIPSloppy("127.0.0.1") @@ -783,8 +769,6 @@ func NewProxier( endPointsRefCount: make(endPointsReferenceCountMap), svcPortMap: make(proxy.ServicePortMap), endpointsMap: make(proxy.EndpointsMap), - masqueradeAll: masqueradeAll, - masqueradeMark: masqueradeMark, clusterCIDR: clusterCIDR, hostname: hostname, nodeIP: nodeIP, @@ -822,8 +806,6 @@ func NewProxier( func NewDualStackProxier( syncPeriod time.Duration, minSyncPeriod time.Duration, - masqueradeAll bool, - masqueradeBit int, clusterCIDR string, hostname string, nodeIP [2]net.IP, @@ -834,14 +816,14 @@ func NewDualStackProxier( ) (proxy.Provider, error) { // Create an ipv4 instance of the single-stack proxier - ipv4Proxier, err := NewProxier(syncPeriod, minSyncPeriod, masqueradeAll, masqueradeBit, + ipv4Proxier, err := NewProxier(syncPeriod, minSyncPeriod, clusterCIDR, hostname, nodeIP[0], 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, nodeIP[0]) } - ipv6Proxier, err := NewProxier(syncPeriod, minSyncPeriod, masqueradeAll, masqueradeBit, + ipv6Proxier, err := NewProxier(syncPeriod, minSyncPeriod, clusterCIDR, hostname, nodeIP[1], 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, nodeIP[1]) @@ -1034,20 +1016,6 @@ func (proxier *Proxier) OnServiceSynced() { proxier.syncProxyRules() } -func shouldSkipService(svcName types.NamespacedName, service *v1.Service) bool { - // if ClusterIP is "None" or empty, skip proxying - if !helper.IsServiceIPSet(service) { - klog.V(3).InfoS("Skipping service due to clusterIP", "serviceName", svcName, "clusterIP", service.Spec.ClusterIP) - return true - } - // Even if ClusterIP is set, ServiceTypeExternalName services don't get proxied - if service.Spec.Type == v1.ServiceTypeExternalName { - klog.V(3).InfoS("Skipping service due to Type=ExternalName", "serviceName", svcName) - return true - } - return false -} - // OnEndpointSliceAdd is called whenever creation of a new endpoint slice object // is observed. func (proxier *Proxier) OnEndpointSliceAdd(endpointSlice *discovery.EndpointSlice) {