mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 02:08:13 +00:00 
			
		
		
		
	Clean up NewServiceChangeTracker/NewEndpointsChangeTracker args
Remove the now-unused event recorders, and put the remaining args into a sensible order, and consistent between the two.
This commit is contained in:
		| @@ -62,7 +62,7 @@ func TestCleanStaleEntries(t *testing.T) { | ||||
| 	// interface, or else use a proxy.ServiceChangeTracker and proxy.NewEndpointsChangeTracker | ||||
| 	// to construct them and fill in the maps for us. | ||||
|  | ||||
| 	sct := proxy.NewServiceChangeTracker(nil, v1.IPv4Protocol, nil, nil) | ||||
| 	sct := proxy.NewServiceChangeTracker(v1.IPv4Protocol, nil, nil) | ||||
| 	svc := &v1.Service{ | ||||
| 		ObjectMeta: metav1.ObjectMeta{ | ||||
| 			Name:      testServiceName, | ||||
| @@ -104,7 +104,7 @@ func TestCleanStaleEntries(t *testing.T) { | ||||
| 	svcPortMap := make(proxy.ServicePortMap) | ||||
| 	_ = svcPortMap.Update(sct) | ||||
|  | ||||
| 	ect := proxy.NewEndpointsChangeTracker("test-worker", nil, v1.IPv4Protocol, nil, nil) | ||||
| 	ect := proxy.NewEndpointsChangeTracker(v1.IPv4Protocol, "test-worker", nil, nil) | ||||
| 	eps := &discovery.EndpointSlice{ | ||||
| 		TypeMeta:    metav1.TypeMeta{}, | ||||
| 		AddressType: discovery.AddressTypeIPv4, | ||||
|   | ||||
| @@ -24,7 +24,6 @@ import ( | ||||
| 	discovery "k8s.io/api/discovery/v1" | ||||
| 	"k8s.io/apimachinery/pkg/types" | ||||
| 	"k8s.io/apimachinery/pkg/util/sets" | ||||
| 	"k8s.io/client-go/tools/events" | ||||
| 	"k8s.io/klog/v2" | ||||
| 	"k8s.io/kubernetes/pkg/proxy/metrics" | ||||
| ) | ||||
| @@ -60,7 +59,7 @@ type makeEndpointFunc func(info *BaseEndpointInfo, svcPortName *ServicePortName) | ||||
| type processEndpointsMapChangeFunc func(oldEndpointsMap, newEndpointsMap EndpointsMap) | ||||
|  | ||||
| // NewEndpointsChangeTracker initializes an EndpointsChangeTracker | ||||
| func NewEndpointsChangeTracker(hostname string, makeEndpointInfo makeEndpointFunc, ipFamily v1.IPFamily, _ events.EventRecorder, processEndpointsMapChange processEndpointsMapChangeFunc) *EndpointsChangeTracker { | ||||
| func NewEndpointsChangeTracker(ipFamily v1.IPFamily, hostname string, makeEndpointInfo makeEndpointFunc, processEndpointsMapChange processEndpointsMapChangeFunc) *EndpointsChangeTracker { | ||||
| 	addressType := discovery.AddressTypeIPv4 | ||||
| 	if ipFamily == v1.IPv6Protocol { | ||||
| 		addressType = discovery.AddressTypeIPv6 | ||||
|   | ||||
| @@ -1244,7 +1244,7 @@ func TestEndpointSliceUpdate(t *testing.T) { | ||||
| 		// test starting from an empty state | ||||
| 		"add a simple slice that doesn't already exist": { | ||||
| 			startingSlices:         []*discovery.EndpointSlice{}, | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker("host1", nil, v1.IPv4Protocol, nil, nil), | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker(v1.IPv4Protocol, "host1", nil, nil), | ||||
| 			namespacedName:         types.NamespacedName{Name: "svc1", Namespace: "ns1"}, | ||||
| 			paramEndpointSlice:     generateEndpointSlice("svc1", "ns1", 1, 3, 999, 999, []string{"host1", "host2"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			paramRemoveSlice:       false, | ||||
| @@ -1267,7 +1267,7 @@ func TestEndpointSliceUpdate(t *testing.T) { | ||||
| 			startingSlices: []*discovery.EndpointSlice{ | ||||
| 				generateEndpointSlice("svc1", "ns1", 1, 3, 999, 999, []string{"host1", "host2"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			}, | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker("host1", nil, v1.IPv4Protocol, nil, nil), | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker(v1.IPv4Protocol, "host1", nil, nil), | ||||
| 			namespacedName:         types.NamespacedName{Name: "svc1", Namespace: "ns1"}, | ||||
| 			paramEndpointSlice:     generateEndpointSlice("svc1", "ns1", 1, 3, 999, 999, []string{"host1", "host2"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			paramRemoveSlice:       false, | ||||
| @@ -1279,7 +1279,7 @@ func TestEndpointSliceUpdate(t *testing.T) { | ||||
| 			startingSlices: []*discovery.EndpointSlice{ | ||||
| 				generateEndpointSlice("svc1", "ns1", 1, 3, 999, 999, []string{"host1", "host2"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			}, | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker("host1", nil, v1.IPv4Protocol, nil, nil), | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker(v1.IPv4Protocol, "host1", nil, nil), | ||||
| 			namespacedName:         types.NamespacedName{Name: "svc1", Namespace: "ns1"}, | ||||
| 			paramEndpointSlice:     fqdnSlice, | ||||
| 			paramRemoveSlice:       false, | ||||
| @@ -1292,7 +1292,7 @@ func TestEndpointSliceUpdate(t *testing.T) { | ||||
| 				generateEndpointSlice("svc1", "ns1", 1, 3, 999, 999, []string{"host1", "host2"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 				generateEndpointSlice("svc1", "ns1", 2, 2, 999, 999, []string{"host1", "host2"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			}, | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker("host1", nil, v1.IPv4Protocol, nil, nil), | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker(v1.IPv4Protocol, "host1", nil, nil), | ||||
| 			namespacedName:         types.NamespacedName{Name: "svc1", Namespace: "ns1"}, | ||||
| 			paramEndpointSlice:     generateEndpointSlice("svc1", "ns1", 1, 5, 999, 999, []string{"host1"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			paramRemoveSlice:       false, | ||||
| @@ -1324,7 +1324,7 @@ func TestEndpointSliceUpdate(t *testing.T) { | ||||
| 				generateEndpointSlice("svc1", "ns1", 1, 3, 999, 999, []string{"host1", "host2"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 				generateEndpointSlice("svc1", "ns1", 2, 2, 999, 999, []string{"host1", "host2"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			}, | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker("host1", nil, v1.IPv4Protocol, nil, nil), | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker(v1.IPv4Protocol, "host1", nil, nil), | ||||
| 			namespacedName:         types.NamespacedName{Name: "svc1", Namespace: "ns1"}, | ||||
| 			paramEndpointSlice:     generateEndpointSliceWithOffset("svc1", "ns1", 3, 1, 5, 999, 999, []string{"host1"}, []*int32{ptr.To[int32](80)}), | ||||
| 			paramRemoveSlice:       false, | ||||
| @@ -1354,7 +1354,7 @@ func TestEndpointSliceUpdate(t *testing.T) { | ||||
| 				generateEndpointSlice("svc1", "ns1", 1, 3, 999, 999, []string{"host1", "host2"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 				generateEndpointSlice("svc1", "ns1", 2, 2, 999, 999, []string{"host1", "host2"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			}, | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker("host1", nil, v1.IPv4Protocol, nil, nil), | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker(v1.IPv4Protocol, "host1", nil, nil), | ||||
| 			namespacedName:         types.NamespacedName{Name: "svc1", Namespace: "ns1"}, | ||||
| 			paramEndpointSlice:     generateEndpointSlice("svc1", "ns1", 1, 5, 999, 999, []string{"host1"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			paramRemoveSlice:       true, | ||||
| @@ -1376,7 +1376,7 @@ func TestEndpointSliceUpdate(t *testing.T) { | ||||
| 				generateEndpointSlice("svc1", "ns1", 1, 5, 999, 999, []string{"host1"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 				generateEndpointSlice("svc1", "ns1", 2, 2, 999, 999, []string{"host1"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			}, | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker("host1", nil, v1.IPv4Protocol, nil, nil), | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker(v1.IPv4Protocol, "host1", nil, nil), | ||||
| 			namespacedName:         types.NamespacedName{Name: "svc1", Namespace: "ns1"}, | ||||
| 			paramEndpointSlice:     generateEndpointSlice("svc1", "ns1", 3, 5, 999, 999, []string{"host1"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			paramRemoveSlice:       true, | ||||
| @@ -1388,7 +1388,7 @@ func TestEndpointSliceUpdate(t *testing.T) { | ||||
| 			startingSlices: []*discovery.EndpointSlice{ | ||||
| 				generateEndpointSlice("svc1", "ns1", 1, 3, 999, 999, []string{"host1", "host2"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			}, | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker("host1", nil, v1.IPv4Protocol, nil, nil), | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker(v1.IPv4Protocol, "host1", nil, nil), | ||||
| 			namespacedName:         types.NamespacedName{Name: "svc1", Namespace: "ns1"}, | ||||
| 			paramEndpointSlice:     generateEndpointSlice("svc1", "ns1", 1, 3, 1, 999, []string{"host1"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			paramRemoveSlice:       false, | ||||
| @@ -1411,7 +1411,7 @@ func TestEndpointSliceUpdate(t *testing.T) { | ||||
| 			startingSlices: []*discovery.EndpointSlice{ | ||||
| 				generateEndpointSlice("svc1", "ns1", 1, 2, 1, 999, []string{"host1", "host2"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			}, | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker("host1", nil, v1.IPv4Protocol, nil, nil), | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker(v1.IPv4Protocol, "host1", nil, nil), | ||||
| 			namespacedName:         types.NamespacedName{Name: "svc1", Namespace: "ns1"}, | ||||
| 			paramEndpointSlice:     generateEndpointSlice("svc1", "ns1", 1, 2, 999, 999, []string{"host1"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			paramRemoveSlice:       false, | ||||
| @@ -1433,7 +1433,7 @@ func TestEndpointSliceUpdate(t *testing.T) { | ||||
| 				generateEndpointSlice("svc1", "ns1", 1, 3, 2, 999, []string{"host1"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 				generateEndpointSlice("svc1", "ns1", 2, 2, 2, 999, []string{"host1"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			}, | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker("host1", nil, v1.IPv4Protocol, nil, nil), | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker(v1.IPv4Protocol, "host1", nil, nil), | ||||
| 			namespacedName:         types.NamespacedName{Name: "svc1", Namespace: "ns1"}, | ||||
| 			paramEndpointSlice:     generateEndpointSlice("svc1", "ns1", 1, 3, 3, 999, []string{"host1"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			paramRemoveSlice:       false, | ||||
| @@ -1461,7 +1461,7 @@ func TestEndpointSliceUpdate(t *testing.T) { | ||||
| 				generateEndpointSlice("svc1", "ns1", 1, 3, 2, 2, []string{"host1"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 				generateEndpointSlice("svc1", "ns1", 2, 2, 2, 2, []string{"host1"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			}, | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker("host1", nil, v1.IPv4Protocol, nil, nil), | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker(v1.IPv4Protocol, "host1", nil, nil), | ||||
| 			namespacedName:         types.NamespacedName{Name: "svc1", Namespace: "ns1"}, | ||||
| 			paramEndpointSlice:     generateEndpointSlice("svc1", "ns1", 1, 3, 3, 2, []string{"host1"}, []*int32{ptr.To[int32](80), ptr.To[int32](443)}), | ||||
| 			paramRemoveSlice:       false, | ||||
| @@ -1521,13 +1521,13 @@ func TestCheckoutChanges(t *testing.T) { | ||||
| 		pendingSlices          []*discovery.EndpointSlice | ||||
| 	}{ | ||||
| 		"empty slices": { | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker("", nil, v1.IPv4Protocol, nil, nil), | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker(v1.IPv4Protocol, "", nil, nil), | ||||
| 			expectedChanges:        []*endpointsChange{}, | ||||
| 			appliedSlices:          []*discovery.EndpointSlice{}, | ||||
| 			pendingSlices:          []*discovery.EndpointSlice{}, | ||||
| 		}, | ||||
| 		"adding initial slice": { | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker("", nil, v1.IPv4Protocol, nil, nil), | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker(v1.IPv4Protocol, "", nil, nil), | ||||
| 			expectedChanges: []*endpointsChange{{ | ||||
| 				previous: EndpointsMap{}, | ||||
| 				current: EndpointsMap{ | ||||
| @@ -1544,7 +1544,7 @@ func TestCheckoutChanges(t *testing.T) { | ||||
| 			}, | ||||
| 		}, | ||||
| 		"removing port in update": { | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker("", nil, v1.IPv4Protocol, nil, nil), | ||||
| 			endpointsChangeTracker: NewEndpointsChangeTracker(v1.IPv4Protocol, "", nil, nil), | ||||
| 			expectedChanges: []*endpointsChange{{ | ||||
| 				previous: EndpointsMap{ | ||||
| 					svcPortName0: []Endpoint{ | ||||
|   | ||||
| @@ -286,9 +286,9 @@ func NewProxier(ctx context.Context, | ||||
| 	proxier := &Proxier{ | ||||
| 		ipFamily:                 ipFamily, | ||||
| 		svcPortMap:               make(proxy.ServicePortMap), | ||||
| 		serviceChanges:           proxy.NewServiceChangeTracker(newServiceInfo, ipFamily, recorder, nil), | ||||
| 		serviceChanges:           proxy.NewServiceChangeTracker(ipFamily, newServiceInfo, nil), | ||||
| 		endpointsMap:             make(proxy.EndpointsMap), | ||||
| 		endpointsChanges:         proxy.NewEndpointsChangeTracker(hostname, newEndpointInfo, ipFamily, recorder, nil), | ||||
| 		endpointsChanges:         proxy.NewEndpointsChangeTracker(ipFamily, hostname, newEndpointInfo, nil), | ||||
| 		needFullSync:             true, | ||||
| 		syncPeriod:               syncPeriod, | ||||
| 		iptables:                 ipt, | ||||
|   | ||||
| @@ -116,9 +116,9 @@ func NewFakeProxier(ipt utiliptables.Interface) *Proxier { | ||||
| 	p := &Proxier{ | ||||
| 		ipFamily:                 ipfamily, | ||||
| 		svcPortMap:               make(proxy.ServicePortMap), | ||||
| 		serviceChanges:           proxy.NewServiceChangeTracker(newServiceInfo, ipfamily, nil, nil), | ||||
| 		serviceChanges:           proxy.NewServiceChangeTracker(ipfamily, newServiceInfo, nil), | ||||
| 		endpointsMap:             make(proxy.EndpointsMap), | ||||
| 		endpointsChanges:         proxy.NewEndpointsChangeTracker(testHostname, newEndpointInfo, ipfamily, nil, nil), | ||||
| 		endpointsChanges:         proxy.NewEndpointsChangeTracker(ipfamily, testHostname, newEndpointInfo, nil), | ||||
| 		needFullSync:             true, | ||||
| 		iptables:                 ipt, | ||||
| 		masqueradeMark:           "0x4000", | ||||
|   | ||||
| @@ -375,9 +375,9 @@ func NewProxier( | ||||
| 	proxier := &Proxier{ | ||||
| 		ipFamily:              ipFamily, | ||||
| 		svcPortMap:            make(proxy.ServicePortMap), | ||||
| 		serviceChanges:        proxy.NewServiceChangeTracker(newServiceInfo, ipFamily, recorder, nil), | ||||
| 		serviceChanges:        proxy.NewServiceChangeTracker(ipFamily, newServiceInfo, nil), | ||||
| 		endpointsMap:          make(proxy.EndpointsMap), | ||||
| 		endpointsChanges:      proxy.NewEndpointsChangeTracker(hostname, nil, ipFamily, recorder, nil), | ||||
| 		endpointsChanges:      proxy.NewEndpointsChangeTracker(ipFamily, hostname, nil, nil), | ||||
| 		initialSync:           true, | ||||
| 		syncPeriod:            syncPeriod, | ||||
| 		minSyncPeriod:         minSyncPeriod, | ||||
|   | ||||
| @@ -140,9 +140,9 @@ func NewFakeProxier(ctx context.Context, ipt utiliptables.Interface, ipvs utilip | ||||
| 	} | ||||
| 	p := &Proxier{ | ||||
| 		svcPortMap:            make(proxy.ServicePortMap), | ||||
| 		serviceChanges:        proxy.NewServiceChangeTracker(newServiceInfo, ipFamily, nil, nil), | ||||
| 		serviceChanges:        proxy.NewServiceChangeTracker(ipFamily, newServiceInfo, nil), | ||||
| 		endpointsMap:          make(proxy.EndpointsMap), | ||||
| 		endpointsChanges:      proxy.NewEndpointsChangeTracker(testHostname, nil, ipFamily, nil, nil), | ||||
| 		endpointsChanges:      proxy.NewEndpointsChangeTracker(ipFamily, testHostname, nil, nil), | ||||
| 		excludeCIDRs:          excludeCIDRs, | ||||
| 		iptables:              ipt, | ||||
| 		ipvs:                  ipvs, | ||||
|   | ||||
| @@ -250,9 +250,9 @@ func NewProxier(ctx context.Context, | ||||
| 	proxier := &Proxier{ | ||||
| 		ipFamily:            ipFamily, | ||||
| 		svcPortMap:          make(proxy.ServicePortMap), | ||||
| 		serviceChanges:      proxy.NewServiceChangeTracker(newServiceInfo, ipFamily, recorder, nil), | ||||
| 		serviceChanges:      proxy.NewServiceChangeTracker(ipFamily, newServiceInfo, nil), | ||||
| 		endpointsMap:        make(proxy.EndpointsMap), | ||||
| 		endpointsChanges:    proxy.NewEndpointsChangeTracker(hostname, newEndpointInfo, ipFamily, recorder, nil), | ||||
| 		endpointsChanges:    proxy.NewEndpointsChangeTracker(ipFamily, hostname, newEndpointInfo, nil), | ||||
| 		needFullSync:        true, | ||||
| 		syncPeriod:          syncPeriod, | ||||
| 		nftables:            nft, | ||||
|   | ||||
| @@ -118,9 +118,9 @@ func NewFakeProxier(ipFamily v1.IPFamily) (*knftables.Fake, *Proxier) { | ||||
| 	p := &Proxier{ | ||||
| 		ipFamily:            ipFamily, | ||||
| 		svcPortMap:          make(proxy.ServicePortMap), | ||||
| 		serviceChanges:      proxy.NewServiceChangeTracker(newServiceInfo, ipFamily, nil, nil), | ||||
| 		serviceChanges:      proxy.NewServiceChangeTracker(ipFamily, newServiceInfo, nil), | ||||
| 		endpointsMap:        make(proxy.EndpointsMap), | ||||
| 		endpointsChanges:    proxy.NewEndpointsChangeTracker(testHostname, newEndpointInfo, ipFamily, nil, nil), | ||||
| 		endpointsChanges:    proxy.NewEndpointsChangeTracker(ipFamily, testHostname, newEndpointInfo, nil), | ||||
| 		needFullSync:        true, | ||||
| 		nftables:            nft, | ||||
| 		masqueradeMark:      "0x4000", | ||||
|   | ||||
| @@ -23,7 +23,6 @@ import ( | ||||
| 	v1 "k8s.io/api/core/v1" | ||||
| 	"k8s.io/apimachinery/pkg/types" | ||||
| 	"k8s.io/apimachinery/pkg/util/sets" | ||||
| 	"k8s.io/client-go/tools/events" | ||||
| 	"k8s.io/klog/v2" | ||||
| 	"k8s.io/kubernetes/pkg/proxy/metrics" | ||||
| 	proxyutil "k8s.io/kubernetes/pkg/proxy/util" | ||||
| @@ -46,7 +45,6 @@ type ServiceChangeTracker struct { | ||||
| 	processServiceMapChange processServiceMapChangeFunc | ||||
|  | ||||
| 	ipFamily v1.IPFamily | ||||
| 	recorder events.EventRecorder | ||||
| } | ||||
|  | ||||
| type makeServicePortFunc func(*v1.ServicePort, *v1.Service, *BaseServicePortInfo) ServicePort | ||||
| @@ -61,11 +59,10 @@ type serviceChange struct { | ||||
| } | ||||
|  | ||||
| // NewServiceChangeTracker initializes a ServiceChangeTracker | ||||
| func NewServiceChangeTracker(makeServiceInfo makeServicePortFunc, ipFamily v1.IPFamily, recorder events.EventRecorder, processServiceMapChange processServiceMapChangeFunc) *ServiceChangeTracker { | ||||
| func NewServiceChangeTracker(ipFamily v1.IPFamily, makeServiceInfo makeServicePortFunc, processServiceMapChange processServiceMapChangeFunc) *ServiceChangeTracker { | ||||
| 	return &ServiceChangeTracker{ | ||||
| 		items:                   make(map[types.NamespacedName]*serviceChange), | ||||
| 		makeServiceInfo:         makeServiceInfo, | ||||
| 		recorder:                recorder, | ||||
| 		ipFamily:                ipFamily, | ||||
| 		processServiceMapChange: processServiceMapChange, | ||||
| 	} | ||||
|   | ||||
| @@ -577,7 +577,7 @@ func TestServiceToServiceMap(t *testing.T) { | ||||
| 				featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, utilfeature.DefaultFeatureGate, version.MustParse("1.31")) | ||||
| 			} | ||||
| 			featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.LoadBalancerIPMode, tc.ipModeEnabled) | ||||
| 			svcTracker := NewServiceChangeTracker(nil, tc.ipFamily, nil, nil) | ||||
| 			svcTracker := NewServiceChangeTracker(tc.ipFamily, nil, nil) | ||||
| 			// outputs | ||||
| 			newServices := svcTracker.serviceToServiceMap(tc.service) | ||||
|  | ||||
| @@ -624,11 +624,11 @@ type FakeProxier struct { | ||||
| } | ||||
|  | ||||
| func newFakeProxier(ipFamily v1.IPFamily, t time.Time) *FakeProxier { | ||||
| 	ect := NewEndpointsChangeTracker(testHostname, nil, ipFamily, nil, nil) | ||||
| 	ect := NewEndpointsChangeTracker(ipFamily, testHostname, nil, nil) | ||||
| 	ect.trackerStartTime = t | ||||
| 	return &FakeProxier{ | ||||
| 		svcPortMap:       make(ServicePortMap), | ||||
| 		serviceChanges:   NewServiceChangeTracker(nil, ipFamily, nil, nil), | ||||
| 		serviceChanges:   NewServiceChangeTracker(ipFamily, nil, nil), | ||||
| 		endpointsMap:     make(EndpointsMap), | ||||
| 		endpointsChanges: ect, | ||||
| 	} | ||||
|   | ||||
| @@ -796,8 +796,8 @@ func NewProxier( | ||||
| 		terminatedEndpoints:   make(map[string]bool), | ||||
| 	} | ||||
|  | ||||
| 	serviceChanges := proxy.NewServiceChangeTracker(proxier.newServiceInfo, ipFamily, recorder, proxier.serviceMapChange) | ||||
| 	endPointChangeTracker := proxy.NewEndpointsChangeTracker(hostname, proxier.newEndpointInfo, ipFamily, recorder, proxier.endpointsMapChange) | ||||
| 	serviceChanges := proxy.NewServiceChangeTracker(ipFamily, proxier.newServiceInfo, proxier.serviceMapChange) | ||||
| 	endPointChangeTracker := proxy.NewEndpointsChangeTracker(ipFamily, hostname, proxier.newEndpointInfo, proxier.endpointsMapChange) | ||||
| 	proxier.endpointsChanges = endPointChangeTracker | ||||
| 	proxier.serviceChanges = serviceChanges | ||||
|  | ||||
|   | ||||
| @@ -121,9 +121,9 @@ func NewFakeProxier(syncPeriod time.Duration, minSyncPeriod time.Duration, hostn | ||||
| 		terminatedEndpoints:   make(map[string]bool), | ||||
| 	} | ||||
|  | ||||
| 	serviceChanges := proxy.NewServiceChangeTracker(proxier.newServiceInfo, v1.IPv4Protocol, nil, proxier.serviceMapChange) | ||||
| 	endpointsChangeTracker := proxy.NewEndpointsChangeTracker(hostname, proxier.newEndpointInfo, v1.IPv4Protocol, nil, proxier.endpointsMapChange) | ||||
| 	proxier.endpointsChanges = endpointsChangeTracker | ||||
| 	serviceChanges := proxy.NewServiceChangeTracker(v1.IPv4Protocol, proxier.newServiceInfo, proxier.serviceMapChange) | ||||
| 	endpointChangeTracker := proxy.NewEndpointsChangeTracker(v1.IPv4Protocol, hostname, proxier.newEndpointInfo, proxier.endpointsMapChange) | ||||
| 	proxier.endpointsChanges = endpointChangeTracker | ||||
| 	proxier.serviceChanges = serviceChanges | ||||
|  | ||||
| 	return proxier | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Dan Winship
					Dan Winship