Open dsvetl opened 4 years ago
I think this would be super interesting @dsvetl! The tricky part is finding out what you describe as a "zone". I know there are labels that get applied to nodes. So a quick thought would be to parse which endpoint is running on which node, then filter that information back into Envoy so it can make decisions on where to route to next.
We'd need to probably come up with a design doc to outline how this might work, how it might integrate into Contour, as well as how users would configure.
@dsvetl This is a pretty open ended project, and we are not likely to tackle is in the immediate future. If you have a proposal for how zones should be defined and handled in Contour+Envoy, we can help you design and implement that.
I think we can take a simple K8s approach first:
Contour must use the same label for each endpoint to discover zone
That really looks pretty simple and enough to cover most use cases, and make envoy at least aware about zones where it running.
We ignore complex things like Region/Zone and other complex stuff just some label to group by endpoints and envoy hosts.
After that, we can add the ability to change min host count in the zone, because not all applications are really must run 6 instances per zone (for an example most of our are 10-20 pods total in RS)
Both that things for tests, can be implemented by configmap keys for contour controller, like: zone_label: ... min_cluster_size: ...
Another approach is to use priority to do the same stuff, but require to generate per envoy xDS config, because Contour must know in which zone envoy are works, who asks config to reorder priority stuff based on zone locality... that's more tricky part (and afaik that how It works in istio)
Sorry to take a long time to respond here, I've been hoping to spend some time to take a look at some of the newer changes upstream (like NetworkTopology and similar things), before responding, but I have not had bandwidth yet.
I think the rough approach outlined by @Nefelim4ag sound reasonable at first glance, but this one will definitely need a design document that runs through:
Some time has already passed, and we now have some ready instruments to deal with it:
I already spend some time writing in-house side-car zone routing with Envoy (based on Priority). Cases with separate contour controllers from envoy nodes are not so obvious to implement as with sidecar.
I see the following design (I can make a PR on request):
Status: Draft
zone-aware-routing-design.md
.
Zone-aware routing is a GA feature of Kubernetes which is good to support.
This feature was requested in #2859. Contour is heavily used in cloud deployments, where nodes & pods can be distributed across zones. Traffic across zones incurs latency and data charges. Consequently, load distribution with zone-aware traffic routing shall decrease latency and TCO.
Hi, projectcontour,
You need to add the ability to contour to use this functionality in envoy
https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/zone_aware#arch-overview-load-balancing-zone-aware-routing
I wish we can parse pod region/zone to provide this info into xDS API.