Merge pull request #109624 from aryan9600/fix-endpointslice-deletion

Ignore EndpointSlices that are marked for deletion
This commit is contained in:
Kubernetes Prow Robot
2022-06-09 00:11:42 -07:00
committed by GitHub
4 changed files with 122 additions and 1 deletions

View File

@@ -84,7 +84,7 @@ func (est *EndpointSliceTracker) ShouldSync(endpointSlice *discovery.EndpointSli
// 1. One or more of the provided EndpointSlices have older generations than the
// corresponding tracked ones.
// 2. The tracker is expecting one or more of the provided EndpointSlices to be
// deleted.
// deleted. (EndpointSlices that have already been marked for deletion are ignored here.)
// 3. The tracker is tracking EndpointSlices that have not been provided.
func (est *EndpointSliceTracker) StaleSlices(service *v1.Service, endpointSlices []*discovery.EndpointSlice) bool {
est.lock.Lock()

View File

@@ -124,6 +124,10 @@ func TestEndpointSliceTrackerStaleSlices(t *testing.T) {
epSlice1NewerGen := epSlice1.DeepCopy()
epSlice1NewerGen.Generation = 2
epTerminatingSlice := epSlice1.DeepCopy()
now := metav1.Now()
epTerminatingSlice.DeletionTimestamp = &now
testCases := []struct {
name string
tracker *EndpointSliceTracker