@@ -39,9 +39,6 @@ func (h *EventHandler) OnAdd(obj any, _ bool) {
3939
4040 var changed bool
4141 for _ , point := range endpoints .Endpoints {
42- if len (point .Addresses ) == 0 {
43- continue
44- }
4542 for _ , address := range point .Addresses {
4643 if _ , ok := h .endpoints [address ]; ! ok {
4744 h .endpoints [address ] = lang .Placeholder
@@ -68,9 +65,6 @@ func (h *EventHandler) OnDelete(obj any) {
6865
6966 var changed bool
7067 for _ , point := range endpoints .Endpoints {
71- if len (point .Addresses ) == 0 {
72- continue
73- }
7468 for _ , address := range point .Addresses {
7569 if _ , ok := h .endpoints [address ]; ok {
7670 delete (h .endpoints , address )
@@ -86,23 +80,23 @@ func (h *EventHandler) OnDelete(obj any) {
8680
8781// OnUpdate handles the endpoints update events.
8882func (h * EventHandler ) OnUpdate (oldObj , newObj any ) {
89- oldEndpoints , ok := oldObj .(* discoveryv1.EndpointSlice )
83+ oldEndpointSlices , ok := oldObj .(* discoveryv1.EndpointSlice )
9084 if ! ok {
9185 logx .Errorf ("%v is not an object with type *discoveryv1.EndpointSlice" , oldObj )
9286 return
9387 }
9488
95- newEndpoints , ok := newObj .(* discoveryv1.EndpointSlice )
89+ newEndpointSlices , ok := newObj .(* discoveryv1.EndpointSlice )
9690 if ! ok {
9791 logx .Errorf ("%v is not an object with type *discoveryv1.EndpointSlice" , newObj )
9892 return
9993 }
10094
101- if oldEndpoints .ResourceVersion == newEndpoints .ResourceVersion {
95+ if oldEndpointSlices .ResourceVersion == newEndpointSlices .ResourceVersion {
10296 return
10397 }
10498
105- h .Update (newEndpoints )
99+ h .Update (newEndpointSlices )
106100}
107101
108102// Update updates the endpoints.
@@ -113,9 +107,6 @@ func (h *EventHandler) Update(endpoints *discoveryv1.EndpointSlice) {
113107 old := h .endpoints
114108 h .endpoints = make (map [string ]lang.PlaceholderType )
115109 for _ , point := range endpoints .Endpoints {
116- if len (point .Addresses ) == 0 {
117- continue
118- }
119110 for _ , address := range point .Addresses {
120111 h .endpoints [address ] = lang .Placeholder
121112 }
0 commit comments