xds/resolver: pass route's auto_host_rewrite to LB picker (gRFC A81)#8740
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8740 +/- ##
==========================================
+ Coverage 83.28% 83.47% +0.18%
==========================================
Files 418 418
Lines 32367 32434 +67
==========================================
+ Hits 26958 27073 +115
+ Misses 4034 3991 -43
+ Partials 1375 1370 -5
🚀 New features to boost your workflow:
|
2d08842 to
a6618d6
Compare
|
Sorry for suggesting that we could possibly send the whole route instead of sending only the So, let's keep it simple for now and just add an attribute that carries the |
easwars
left a comment
There was a problem hiding this comment.
Also please remove any mentions to MatchedRoute from the PR description and from comments in the PR.
easwars
left a comment
There was a problem hiding this comment.
LGTM, modulo one minor comment
| autohostRewrite, _ := ctx.Value(autoHostRewriteKey{}).(bool) | ||
| return autohostRewrite |
There was a problem hiding this comment.
Nit: maybe rename the variable with a one letter name. Something like v?
See: go/go-style/decisions#variable-names
TL;Dr
The general rule of thumb is that the length of a name should be proportional to the size of its scope and inversely proportional to the number of times that it is used within that scope
…icy (gRFC A81) (#8779) This PR implements the xDS :authority header rewriting feature as specified in [gRFC A81](https://github.com/grpc/proposal/blob/master/A81-xds-authority-rewriting.md) ### Key Changes: * xds_cluster_impl LB Policy: * Updated the Picker to check for the auto_host_rewrite flag (passed via ConfigSelector). * If enabled, the picker retrieves the hostname attribute from the subchannel . * The picker populates the Metadata field in PickResult with the new :authority value. * changes in stream.go: * Updated stream.go to inspect the PickResult metadata. If an :authority override is present and the user has not explicitly set an authority via CallOption, the `callHdr.Authority` is updated with hostname. * PR relies on the following changes already merged: * Bootstrap config change (#8692): Added the trusted_xds_server server feature to the bootstrap configuration. * xDS resource validation (#8728): Implemented validation and extraction of the auto_host_rewrite field from RDS resources and the hostname field from EDS resources. * Endpoint Structure (#8750): Refactored xdsresource.Endpoint to use resolver.Endpoint, ensuring that attributes (like the endpoint's hostname) are correctly stored and accessible to the picker. * xDS ConfigSelector changes (#8740): Updated the xDS resolver to propagate the auto_host_rewrite flag from the Route Configuration to the Load Balancer via the ConfigSelector. RELEASE NOTES: * xDS: Added support for the :authority rewriting (gRFC A81). When `autoHostRewrite` is enabled in the xDS RouteConfiguration, the client will rewrite the HTTP/2 :authority header to the value of the selected endpoint's hostname.
This PR implements the ConfigSelector changes required for gRFC A81.
It ensures that the
auto_host_rewritefield from the xDS Route Configuration is correctly propagated through the resolver and made available to the Load Balancer picker via the RPC context.Key Changes:
AutoHostRewritefield value fromRoutestruct via RPC context.AutoHostRewriteininternal/xds/balancer/cluserimpl/picker.go.ConfigSelector.SelectConfigto pass theAutoHostRewriteboolean in RPC context.RELEASE NOTES: None