Custom upstream load-balancing service to return the upstream host
#27 666 ouverte le 29 mai 2023
Métriques du dépôt
- Stars
- (27 997 stars)
- Métriques de merge PR
- (Merge moyen 8j) (378 PRs mergées en 30 j)
Description
Title: Custom upstream load-balancing service
Description: We have a requirement to select the upstream host based on the custom load balancing parameters. With the current Envoy proxy load balancing support, it is only possible by updating the Envoy configuration.
While going through the envoy load balancer handling, I came across overrideHostToSelect, which is returned when the http router filter is invoked, and envoy proxy sends the request to the overridden host.
/**
- Returns the host the load balancer should select directly. If the expected host exists and * the host can be selected directly, the load balancer can bypass the load balancing algorithm. * and return the corresponding host directly. */ virtual absl::optional overrideHostToSelect() const PURE;
Proposed Solution: Add a new "custom load balancer" http filter that will be invoked before the router filter. The "custom load balancer" http filter configuration will expect the "customer LB" service endpoint. The custom LB service will return the upstream host. The HTTP filter in turn will override the upstream host with the host returned by the "custom LB service". If the "custom LB" service doesn't return any hosts, then the existing cluster LB algorithm will be kicked in to select the appropriate host.