-
Notifications
You must be signed in to change notification settings - Fork 4.6k
xds/resolver: pass route's auto_host_rewrite to LB picker (gRFC A81) #8740
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
base: master
Are you sure you want to change the base?
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.22% -0.07%
==========================================
Files 418 418
Lines 32367 32378 +11
==========================================
- Hits 26958 26947 -11
+ Misses 4034 4028 -6
- Partials 1375 1403 +28
🚀 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also please remove any mentions to MatchedRoute from the PR description and from comments in the PR.
| return autohostRewrite | ||
| } | ||
|
|
||
| // GetAutoHostRewriteForTesting returns the value of autoHostRewrite feild; |
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: s/feild/field ?
| type autoHostRewriteKey struct{} | ||
|
|
||
| // AutoHostRewrite retrieves the autoHostRewrite value from the provided context. | ||
| func AutoHostRewrite(ctx context.Context) bool { |
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.
This need not be exported, right?
| return autohostRewrite | ||
| } | ||
|
|
||
| // GetAutoHostRewriteForTesting returns the value of autoHostRewrite feild; |
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.
We need to still not have the Get prefix here: go/go-style/decisions#getters
| // TestResolver_AutoHostRewrite verifies the propagation of the AutoHostRewrite | ||
| // field from the xDS RouteConfiguration to the internal MatchedRoute. |
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.
We need to be clear here that we are only testing if the xDS resolver correctly propagates the value of the auto_host_rewrite field, and makes it available to the picker.
| // TestResolver_AutoHostRewrite verifies the propagation of the AutoHostRewrite | ||
| // field from the xDS RouteConfiguration to the internal MatchedRoute. |
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.
There is no more MatchedRoute struct. Please update.
| wantAutoHostRewrite: false, | ||
| }, | ||
| { | ||
| name: "Disable_UntrustedServer", |
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.
Test name is wrong. The env var is enabled here.
| wantAutoHostRewrite: false, | ||
| }, | ||
| { | ||
| name: "Disable_Routeconfig", |
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.
Same here.
| wantAutoHostRewrite bool | ||
| }{ | ||
| { | ||
| name: "Enabled", |
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.
I think I sort of understand the naming of these sub-tests now. But, I think it's quite confusing. How about the following approach:
- EnvVarDisabled_NonTrustedServer_AutoHostRewriteOff
- EnvVarDisabled_NonTrustedServer_AutoHostRewriteOn
- EnvVarDisabled_TrustedServer_AutoHostRewriteOff
- EnvVarDisabled_TrustedServer_AutoHostRewriteOn
- EnvVarEnabled_NonTrustedServer_AutoHostRewriteOff
- EnvVarEnabled_NonTrustedServer_AutoHostRewriteOn
- EnvVarEnabled_TrustedServer_AutoHostRewriteOff
- EnvVarEnabled_TrustedServer_AutoHostRewriteOn
| ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) | ||
| defer cancel() | ||
| nodeID := uuid.New().String() | ||
| mgmtServer, _, _, _ := setupManagementServerForTest(t, nodeID) |
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.
You probably don't need this helper function here, since you don't use any of the returned channels from that helper function. You could instead manually start the management server here with e2e.StartManagementServer.
| }}, | ||
| }}, | ||
| }} | ||
| configureAllResourcesOnManagementServer(ctx, t, mgmtServer, nodeID, listeners, routes, clusters, endpoints) |
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.
Clusters and endpoints are not required for the purposes of this test. So, you should directly call the Update method on the management server and just give it the listener and the route (you could also inline the route configuration), and set the SkipValidation field in the UpdateOptions field to true. That will make it possible to not specify all resources.
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:
AutoHostRewritefield value fromRoutestruct via RPC context.AutoHostRewriteininternal/xds/balancer/cluserimpl/picker.go.ConfigSelector.SelectConfigto pass theAutoHostRewriteboolean in RPC context.RELEASE NOTES: None