endpoints controller: don't consider terminal endpoints

Terminal pods, whose phase its Failed or Succeeded, are guaranteed
to never regress and to be stopped, so their IPs never should
be published on the Endpoints.
This commit is contained in:
Antonio Ojea
2022-05-22 12:21:24 +02:00
parent b905c2870b
commit aa35f6f160
3 changed files with 239 additions and 115 deletions

View File

@@ -135,7 +135,7 @@ func DeepHashObjectToString(objectToWrite interface{}) string {
return hex.EncodeToString(hasher.Sum(nil)[0:])
}
// ShouldPodBeInEndpointSlice returns true if a specified pod should be in an EndpointSlice object.
// ShouldPodBeInEndpointSlice returns true if a specified pod should be in an Endpoint or EndpointSlice object.
// Terminating pods are only included if includeTerminating is true
func ShouldPodBeInEndpointSlice(pod *v1.Pod, includeTerminating bool) bool {
// "Terminal" describes when a Pod is complete (in a succeeded or failed phase).