xds: generate clusters directly from API gateway snapshot#17391
Conversation
Co-authored-by: John Maguire <john.maguire@hashicorp.com>
Each listener would previously have all upstreams from any route that bound to the listener. This is problematic when a route bound to one listener also binds to other listeners and so includes upstreams for multiple listeners. The list for a given listener would then wind up including upstreams for other listeners.
Co-authored-by: Nathan Coleman <nathan.coleman@hashicorp.com>
…-clustersFromSnapshotAPIGateway
| return nil, err | ||
| } | ||
| res, err := s.clustersFromSnapshotIngressGateway(cfgSnap) | ||
| res, err := s.clustersFromSnapshotAPIGateway(cfgSnap) |
There was a problem hiding this comment.
This is the crux of the whole change that we're making: instead of converting to an ingress gateway snapshot and generating xDS resources from that, we generate xDS resources directly from our API gateway snapshot 🎉
| createdClusters := make(map[proxycfg.UpstreamID]bool) | ||
| readyUpstreamsList := getReadyUpstreams(cfgSnap) | ||
|
|
||
| for _, readyUpstreams := range readyUpstreamsList { |
There was a problem hiding this comment.
Is this where we could add cluster creation to serve 5xx responses for non-ready upstreams to match conformance expectations? Not suggesting that be added to the scope of this PR as we don't do that currently, just curious.
There was a problem hiding this comment.
Yep! We could add any handling we like for listeners that aren't ready in the future
^ I think this is no longer the case, looks like this is branched off from (and targets) that PR branch, so should be fine, tests appear to be passing. |
Description
In order to move the gateway off of using an underlying ingress gateway, add functionality to generate API Gateway natively. Previously this code was all in a single branch, but for ease of tracking and reviewing, breaking this code into 4 separate PRs.
Testing & Reproduction steps
Links
https://hermes.hashicorp.services/document/15kzB5wqhzzPOMWCD8SphpcYUAigUmJvV6R6y2MZUnJU
PR Checklist