move the ignore logic higher up to the reconciler

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
This commit is contained in:
Sanskar Jaiswal
2022-04-26 03:24:18 +05:30
parent 7d8048dd59
commit 4314e58ae5
4 changed files with 117 additions and 15 deletions

View File

@@ -100,9 +100,6 @@ func (est *EndpointSliceTracker) StaleSlices(service *v1.Service, endpointSlices
providedSlices[endpointSlice.UID] = endpointSlice.Generation
g, ok := gfs[endpointSlice.UID]
if ok && (g == deletionExpected || g > endpointSlice.Generation) {
if endpointSlice.DeletionTimestamp != nil {
continue
}
return true
}
}

View File

@@ -212,18 +212,6 @@ func TestEndpointSliceTrackerStaleSlices(t *testing.T) {
serviceParam: &v1.Service{ObjectMeta: metav1.ObjectMeta{Name: "svc1", Namespace: "ns1"}},
slicesParam: []*discovery.EndpointSlice{},
expectNewer: true,
}, {
name: "slice in params is has non nil deletion timestamp",
tracker: &EndpointSliceTracker{
generationsByService: map[types.NamespacedName]GenerationsBySlice{
{Name: "svc1", Namespace: "ns1"}: {
epSlice1.UID: epSlice1.Generation,
},
},
},
serviceParam: &v1.Service{ObjectMeta: metav1.ObjectMeta{Name: "svc1", Namespace: "ns1"}},
slicesParam: []*discovery.EndpointSlice{epTerminatingSlice},
expectNewer: false,
}}
for _, tc := range testCases {