feat(NSC): add endpoints that are ready or serving

In order to be compliant with upstream network implementation
expectations we choose to proxy an endpoint as long as it is either
ready OR serving. This means that endpoints that are terminating will
still be proxied which makes kube-router conformant with the upstream
e2e tests.
This commit is contained in:
Aaron U'Ren 2024-03-01 10:39:38 -06:00 committed by Aaron U'Ren
parent efddb2ea2f
commit 16daa08c7b

View File

@ -1081,12 +1081,12 @@ func (nsc *NetworkServicesController) buildEndpointSliceInfo() endpointSliceInfo
// protocol: TCP
//
for _, ep := range es.Endpoints {
// Previously, when we used endpoints, we only looked at subsets.addresses and not subsets.notReadyAddresses
// so here we need to limit our endpoints to only the ones that are ready. In the future, we could consider
// changing this to .Serving which continues to include pods that are in Terminating state. For now we keep
// it the same.
if ep.Conditions.Ready == nil || !*ep.Conditions.Ready {
klog.V(2).Infof("Endpoint (with addresses %s) does not have a ready status, skipping...", ep.Addresses)
// We should only look at serving or ready if we want to be compliant with the upstream expectantions of a
// network provider
if (ep.Conditions.Serving == nil || !*ep.Conditions.Serving) &&
(ep.Conditions.Ready == nil || !*ep.Conditions.Ready) {
klog.V(2).Infof("Endpoint (with addresses %s) does not have a ready or serving status, skipping...",
ep.Addresses)
continue
}