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

xds: add xDS transport custom Dialer support

Open danielzhaotongliu opened this issue 1 year ago • 1 comments

Design:

  • go/grpc-go-corp-to-prod-td-doc
  • Add a custom Dialer method that specifies how to dial the xDS server via the credentials bundle without introducing new public APIs.
  • No code change for existing users that do not need a custom Dialer for the xDS transport.

Tested:

  • ./scripts/vet.sh
  • go test -cpu 1,4 -timeout 7m ./...
  • go test -race -cpu 1,4 -timeout 7m ./...
  • Verified end-to-end by running a test gRPC client with a xDS client that used the custom Dialer for the xDS transport to successfully communicate with the xDS server and fetch configs.

RELEASE NOTES:

  • xds: add xDS transport custom Dialer support

danielzhaotongliu avatar Sep 03 '24 18:09 danielzhaotongliu

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.87%. Comparing base (5666049) to head (5ebc9a7). Report is 21 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7586      +/-   ##
==========================================
+ Coverage   81.74%   81.87%   +0.12%     
==========================================
  Files         361      361              
  Lines       27813    27827      +14     
==========================================
+ Hits        22736    22783      +47     
+ Misses       3868     3848      -20     
+ Partials     1209     1196      -13     
Files with missing lines Coverage Δ
internal/xds/bootstrap/bootstrap.go 71.47% <100.00%> (+0.99%) :arrow_up:
xds/internal/xdsclient/transport/transport.go 93.30% <100.00%> (+0.05%) :arrow_up:

... and 39 files with indirect coverage changes

codecov[bot] avatar Sep 03 '24 18:09 codecov[bot]

(Sorry, hit send too soon; updated comment above.)

dfawley avatar Sep 09 '24 17:09 dfawley

Could you add a test that works at an even higher level? I.e. registers the creds builder from outside of the xdsclient package and confirms that a grpc client created using grpc.NewClient will invoke the proper dialer?

Done. In latest commit, I added a new e2e test test/xds/xds_client_custom_dialer_test.go that registers a creds builder (creds bundle with a custom Dialer method that simply acts as a pass-through), sets up a xDS management server, creates a new xDS bootstrap that specifies the creds builder name as part of the channel_creds, creates a xDS resolver that uses the bootstrap, creates a test backend, creates a ClientConn via grpc.NewClient, make a successful RPC call, finally verify the custom Dialer has been called. This works end-to-end as the custom Dialer is just a pass-through.

The test setup is inspired by other tests under test/xds/.

danielzhaotongliu avatar Sep 12 '24 23:09 danielzhaotongliu

+@easwars for a second review

dfawley avatar Sep 13 '24 15:09 dfawley