Merge pull request #101367 from BinacsLee/binacs-controller-endpointslice-cleanup

code cleanup: append slice without check
This commit is contained in:
Kubernetes Prow Robot 2021-04-23 19:28:00 -07:00 committed by GitHub
commit 0c054510a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -199,16 +199,10 @@ func (r *reconciler) reconcileByAddressType(service *corev1.Service, pods []*cor
Slices: len(existingSlicesByPortMap[portMap]) + len(pmSlicesToCreate) - len(pmSlicesToDelete), Slices: len(existingSlicesByPortMap[portMap]) + len(pmSlicesToCreate) - len(pmSlicesToDelete),
}) })
if len(pmSlicesToCreate) > 0 {
slicesToCreate = append(slicesToCreate, pmSlicesToCreate...) slicesToCreate = append(slicesToCreate, pmSlicesToCreate...)
}
if len(pmSlicesToUpdate) > 0 {
slicesToUpdate = append(slicesToUpdate, pmSlicesToUpdate...) slicesToUpdate = append(slicesToUpdate, pmSlicesToUpdate...)
}
if len(pmSlicesToDelete) > 0 {
slicesToDelete = append(slicesToDelete, pmSlicesToDelete...) slicesToDelete = append(slicesToDelete, pmSlicesToDelete...)
} }
}
// If there are unique sets of ports that are no longer desired, mark // If there are unique sets of ports that are no longer desired, mark
// the corresponding endpoint slices for deletion. // the corresponding endpoint slices for deletion.