Updating e2e test to check EndpointSlices and Endpoints as well

This commit is contained in:
Rob Scott
2022-05-27 21:10:59 +00:00
parent 3a8edca2d8
commit aa02b7a434
5 changed files with 39 additions and 8 deletions

View File

@@ -135,15 +135,17 @@ func DeepHashObjectToString(objectToWrite interface{}) string {
return hex.EncodeToString(hasher.Sum(nil)[0:])
}
// 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 {
// ShouldPodBeInEndpoints returns true if a specified pod should be in an
// Endpoints or EndpointSlice resource. Terminating pods are only included if
// includeTerminating is true.
func ShouldPodBeInEndpoints(pod *v1.Pod, includeTerminating bool) bool {
// "Terminal" describes when a Pod is complete (in a succeeded or failed phase).
// This is distinct from the "Terminating" condition which represents when a Pod
// is being terminated (metadata.deletionTimestamp is non nil).
if podutil.IsPodTerminal(pod) {
return false
}
if len(pod.Status.PodIP) == 0 && len(pod.Status.PodIPs) == 0 {
return false
}