Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xds: add xDS transport custom dial options support #7997

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

yousukseung
Copy link

@yousukseung yousukseung commented Jan 9, 2025

This PR extends #7586 to support multiple custom dial options.

The custom dialer option added in PR#7586 is now deprecated but not removed yet. This will be removed in a future PR after dependencies are moved to the new option.

RELEASE NOTES: N/A

@yousukseung
Copy link
Author

@danielzhaotongliu FYI

@yousukseung
Copy link
Author

All tests are passing but codecov is throwing an error:

"error - 2025-01-09 18:18:05,722 -- Report creating failed: {"message":"Token required because branch is protected"}".

I see the same error in other PRs so I assume it's not an issue with this PR.

@purnesh42H purnesh42H added Type: Internal Cleanup Refactors, etc Area: xDS Includes everything xDS related, including LB policies used with xDS. labels Jan 10, 2025
@@ -283,11 +285,17 @@ func (sc *ServerConfig) MarshalJSON() ([]byte, error) {
}

// dialer captures the Dialer method specified via the credentials bundle.
// Deprecated and to be deleted. Use extradDialOptions which takes precedence over this.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Deprecated: use extradDialOptions instead. Will take precedence over this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

type dialer interface {
// Dialer specifies how to dial the xDS server.
Dialer(context.Context, string) (net.Conn, error)
}

// extraDialOptions captures custom dial options specified via the credentials bundle.
Copy link
Contributor

@purnesh42H purnesh42H Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dial options can be anything right? like WithStatsHandler, WithContextDialer etc.? I think WithContextDialer will be specified via credentials bundle?

Copy link
Author

@yousukseung yousukseung Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. In prod we are specifying WithContextDialer now, and will add WithStatsHandler on top of this change.

}

// mockStatsHandler implements `stats.Handler`. It's a no-op mock handler.
type mockStatsHandler struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we usually prefix with test or you can noopStatsHandler

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@purnesh42H
Copy link
Contributor

@yousukseung we are not updating transport to use this instead yet?

@yousukseung
Copy link
Author

yousukseung commented Jan 10, 2025

@yousukseung we are not updating transport to use this instead yet?

I removed JoinDialOptions(), the ServerConfig's DialOptions() already returns []DialOption and this was not necessary.

I don't see any change needed in transport though. All changes I'm making is internal to bootstrap.go and externally it will be the same DialOptions() API. I see they are applied in Build() in grpctransport.

Copy link

codecov bot commented Jan 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.94%. Comparing base (6f41085) to head (5b9e9d7).
Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7997      +/-   ##
==========================================
- Coverage   82.17%   81.94%   -0.23%     
==========================================
  Files         381      381              
  Lines       38539    38541       +2     
==========================================
- Hits        31668    31584      -84     
- Misses       5564     5630      +66     
- Partials     1307     1327      +20     
Files with missing lines Coverage Δ
internal/xds/bootstrap/bootstrap.go 68.86% <100.00%> (+0.16%) ⬆️

... and 23 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: xDS Includes everything xDS related, including LB policies used with xDS. Type: Internal Cleanup Refactors, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants