-
Notifications
You must be signed in to change notification settings - Fork 4.6k
xdsclient/xdsresource: add AutoHostRewrite and Endpoint Hostname support #8728
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8728 +/- ##
==========================================
- Coverage 83.21% 83.19% -0.02%
==========================================
Files 419 419
Lines 32443 32454 +11
==========================================
+ Hits 26997 27001 +4
- Misses 4056 4064 +8
+ Partials 1390 1389 -1
🚀 New features to boost your workflow:
|
easwars
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description says:
- This string value is included as a per-endpoint resolver attribute (hostname) in the parsed resource struct.
But the PR only stores it as a string, and not as a resolver attribute. The per-endpoint resolver attribute is defined here:
Line 191 in 69769dc
| Attributes *attributes.Attributes |
This means that the parsed Endpoint struct defined here:
| type Endpoint struct { |
resolver.Endpoint instead of a slice of address strings, and the newly added HostName field and some of the other existing things like Weight and HashKey also need to move into the endpoint attributes. This is probably big enough to be made as a separate PR though. Let's discuss this offline.
But for now, maybe the PR description need to be modified though to state that we are only storing it as a string for now and that in a follow-up PR we will change it to be an endpoint attribute.
internal/xds/xdsclient/xdsresource/route_config_resource_type.go
Outdated
Show resolved
Hide resolved
easwars
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo minor nits
|
|
||
| tests := []struct { | ||
| name string | ||
| isTrusted bool // Corresponds to ServerConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Can we make this field be of type xdsclient.ServerFeature instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| got := update.VirtualHosts[0].Routes[0].AutoHostRewrite | ||
| if got != test.wantResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: The assignment and the conditional can be on the same line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
This PR implements the validation logic and extracting per endpoint Hostname attributes from xDS resources for gRFC A81
Key Changes:
RDS Resource Validation :
RouteAction.auto_host_rewriteis extracted from the RDS resource and stored in route structtruein the parsed route struct if thetrusted_xds_serveroption is present in theServerConfigand the global environment variable for authority overriding is enabled.EDS Resource Validation:
Endpoint.hostnamefield is extracted from the EDS resource and will be stored as ahostnamestring in parsed endpoint struct. It will be changed to be an per-endpoint resolver attribute in a follow-up PR.RELEASE NOTES: None