pkg/proxy: update CategorizeEndpoints to apply ProxyTerminatingEndpoints to all traffic policies

Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
This commit is contained in:
Andrew Sy Kim
2022-03-28 13:48:45 -04:00
parent c64a8cdc2d
commit e2e0b6fca8
2 changed files with 26 additions and 3 deletions

View File

@@ -52,6 +52,19 @@ func CategorizeEndpoints(endpoints []Endpoint, svcInfo ServicePort, nodeLabels m
return true
})
// if there are 0 cluster-wide endpoints, we can try to fallback to any terminating endpoints that are ready.
// When falling back to terminating endpoints, we do NOT consider topology aware routing since this is a best
// effort attempt to avoid dropping connections.
if len(clusterEndpoints) == 0 && utilfeature.DefaultFeatureGate.Enabled(features.ProxyTerminatingEndpoints) {
clusterEndpoints = filterEndpoints(endpoints, func(ep Endpoint) bool {
if ep.IsServing() && ep.IsTerminating() {
return true
}
return false
})
}
// If there are any Ready endpoints anywhere in the cluster, we are
// guaranteed to get one in clusterEndpoints.
if len(clusterEndpoints) > 0 {