Custom upstream load-balancing service to return the upstream host
#27.666 aberto em 29 de mai. de 2023
Métricas do repositório
- Stars
- (27.997 stars)
- Métricas de merge de PR
- (Mesclagem média 8d) (378 fundiu PRs em 30d)
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.