xds: generate listeners directly from API gateway snapshot#17398
Merged
sarahalsmiller merged 40 commits intomainfrom May 22, 2023
Merged
xds: generate listeners directly from API gateway snapshot#17398sarahalsmiller merged 40 commits intomainfrom
sarahalsmiller merged 40 commits intomainfrom
Conversation
* XDS primitive generation for endpoints and clusters Co-authored-by: Nathan Coleman <nathan.coleman@hashicorp.com> * server_test * deleted extra file * add missing parents to test --------- Co-authored-by: Nathan Coleman <nathan.coleman@hashicorp.com>
* XDS primitive generation for endpoints and clusters Co-authored-by: Nathan Coleman <nathan.coleman@hashicorp.com> * server_test * deleted extra file * add missing parents to test * checkpoint * delete extra file * httproute flattening code * linting issue * so close on this, calling for tonight * unit test passing * add in header manip to virtual host * upstream rebuild commented out * Use consistent upstream name whether or not we're rebuilding * Start working through route naming logic * Fix typos in test descriptions * Simplify route naming logic * Simplify RebuildHTTPRouteUpstream * Merge additional compiled discovery chains instead of overwriting * Use correct chain for flattened route, clean up + add TODOs * Remove empty conditional branch * Restore previous variable declaration Limit the scope of this PR * Clean up, improve TODO * add logging, clean up todos * clean up function --------- Co-authored-by: Nathan Coleman <nathan.coleman@hashicorp.com>
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.
…-makeAPIGatewayListeners
| return consolidateHTTPRoutes(matches, listener.Name, gateway) | ||
| } | ||
|
|
||
| func RebuildHTTPRouteUpstream(route structs.HTTPRouteConfigEntry, listener structs.APIGatewayListener) structs.Upstream { |
Member
There was a problem hiding this comment.
"rebuild" makes me feel like we're doing something a lot more intense than just initializing a struct. Thoughts on changing to just "build"?
Suggested change
| func RebuildHTTPRouteUpstream(route structs.HTTPRouteConfigEntry, listener structs.APIGatewayListener) structs.Upstream { | |
| func BuildHTTPRouteUpstream(route structs.HTTPRouteConfigEntry, listener structs.APIGatewayListener) structs.Upstream { |
t-eckert
approved these changes
May 19, 2023
Contributor
t-eckert
left a comment
There was a problem hiding this comment.
I love how much more clear the logic reads now! There are still some TODOs which I'm not sure are for after this PR or not. I'll approve anyway so you can move forward.
4 tasks
nathancoleman
requested changes
May 19, 2023
| return nil, err | ||
| } | ||
| listeners, err := s.makeIngressGatewayListeners(a.Address, cfgSnap) | ||
| listeners, err := s.makeAPIGatewayListeners(a.Address, cfgSnap) |
Member
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 🎉
sarahalsmiller
commented
May 19, 2023
Co-authored-by: Nathan Coleman <nathan.coleman@hashicorp.com>
Co-authored-by: Nathan Coleman <nathan.coleman@hashicorp.com>
…teUpstream to BuildHTTPRouteUpstream
…rp/consul into NET-3671-makeAPIGatewayListeners
sarahalsmiller
commented
May 22, 2023
sarahalsmiller
commented
May 22, 2023
…rp/consul into NET-3671-makeAPIGatewayListeners
nathancoleman
approved these changes
May 22, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Instead of converting each API gateway config snapshot into an ingress gateway config snapshot and then generating xDS resources from that, generate xDS resources directly from the API gateway config snapshot.
Testing & Reproduction steps
Links
PR Checklist