@@ -39,9 +39,6 @@ func (h *EventHandler) OnAdd(obj any, _ bool) {
39
39
40
40
var changed bool
41
41
for _ , point := range endpoints .Endpoints {
42
- if len (point .Addresses ) == 0 {
43
- continue
44
- }
45
42
for _ , address := range point .Addresses {
46
43
if _ , ok := h .endpoints [address ]; ! ok {
47
44
h .endpoints [address ] = lang .Placeholder
@@ -68,9 +65,6 @@ func (h *EventHandler) OnDelete(obj any) {
68
65
69
66
var changed bool
70
67
for _ , point := range endpoints .Endpoints {
71
- if len (point .Addresses ) == 0 {
72
- continue
73
- }
74
68
for _ , address := range point .Addresses {
75
69
if _ , ok := h .endpoints [address ]; ok {
76
70
delete (h .endpoints , address )
@@ -86,23 +80,23 @@ func (h *EventHandler) OnDelete(obj any) {
86
80
87
81
// OnUpdate handles the endpoints update events.
88
82
func (h * EventHandler ) OnUpdate (oldObj , newObj any ) {
89
- oldEndpoints , ok := oldObj .(* discoveryv1.EndpointSlice )
83
+ oldEndpointSlices , ok := oldObj .(* discoveryv1.EndpointSlice )
90
84
if ! ok {
91
85
logx .Errorf ("%v is not an object with type *discoveryv1.EndpointSlice" , oldObj )
92
86
return
93
87
}
94
88
95
- newEndpoints , ok := newObj .(* discoveryv1.EndpointSlice )
89
+ newEndpointSlices , ok := newObj .(* discoveryv1.EndpointSlice )
96
90
if ! ok {
97
91
logx .Errorf ("%v is not an object with type *discoveryv1.EndpointSlice" , newObj )
98
92
return
99
93
}
100
94
101
- if oldEndpoints .ResourceVersion == newEndpoints .ResourceVersion {
95
+ if oldEndpointSlices .ResourceVersion == newEndpointSlices .ResourceVersion {
102
96
return
103
97
}
104
98
105
- h .Update (newEndpoints )
99
+ h .Update (newEndpointSlices )
106
100
}
107
101
108
102
// Update updates the endpoints.
@@ -113,9 +107,6 @@ func (h *EventHandler) Update(endpoints *discoveryv1.EndpointSlice) {
113
107
old := h .endpoints
114
108
h .endpoints = make (map [string ]lang.PlaceholderType )
115
109
for _ , point := range endpoints .Endpoints {
116
- if len (point .Addresses ) == 0 {
117
- continue
118
- }
119
110
for _ , address := range point .Addresses {
120
111
h .endpoints [address ] = lang .Placeholder
121
112
}
0 commit comments