grpc-go icon indicating copy to clipboard operation
grpc-go copied to clipboard

xds/resolver: pass route's auto_host_rewrite to LB picker (gRFC A81)

Open Pranjali-2501 opened this issue 1 month ago • 2 comments

This PR implements the ConfigSelector changes required for gRFC A81.

It ensures that the auto_host_rewrite field 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:

  • Pass the AutoHostRewrite field value from Route struct via RPC context.
  • Add helper functions for AutoHostRewrite in internal/xds/balancer/cluserimpl/picker.go.
  • Update ConfigSelector.SelectConfig to pass the AutoHostRewrite boolean in RPC context.

RELEASE NOTES: None

Pranjali-2501 avatar Dec 03 '25 14:12 Pranjali-2501

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 83.47%. Comparing base (4c27cc8) to head (9cbcc98). :warning: Report is 8 commits behind head on master.

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     
Files with missing lines Coverage Δ
internal/xds/balancer/clusterimpl/picker.go 97.40% <100.00%> (+0.25%) :arrow_up:
internal/xds/resolver/serviceconfig.go 88.05% <100.00%> (+0.08%) :arrow_up:
internal/xds/resolver/xds_resolver.go 88.63% <100.00%> (+0.06%) :arrow_up:

... and 31 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Dec 03 '25 15:12 codecov[bot]

Sorry for suggesting that we could possibly send the whole route instead of sending only the auto_host_rewrite field, as specified in A60. After reading A60, I realized that sending the whole route down is not as simple as just stashing a pointer to the route in an attribute. We need to take into account things like reference counts to the route and the selected cluster and the whole cluster map.

So, let's keep it simple for now and just add an attribute that carries the auto_host_rewrite just like how we pass the selected cluster name from the config selector to the LB policy. Thanks.

easwars avatar Dec 04 '25 00:12 easwars