-
Notifications
You must be signed in to change notification settings - Fork 4.6k
xds/clusterresolver: implement gRFC A61 changes for LOGICAL_DNS clusters #8733
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❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8733 +/- ##
==========================================
- Coverage 83.15% 83.11% -0.04%
==========================================
Files 414 414
Lines 32727 32730 +3
==========================================
- Hits 27214 27204 -10
+ Misses 4088 4082 -6
- Partials 1425 1444 +19
🚀 New features to boost your workflow:
|
|
This change probably needs a release note. |
internal/xds/balancer/clusterresolver/e2e_test/dns_impl_test.go
Outdated
Show resolved
Hide resolved
| localityStr := xdsinternal.LocalityString(clients.Locality{}) | ||
| retEndpoint = hierarchy.SetInEndpoint(retEndpoint, []string{pName, localityStr}) | ||
| // Set the locality weight to 1. This is required because the child policy | ||
| // like wrr which relies on locality weights to distribute traffic. These |
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 is also weighted_target (which has a parent policy of wrr_locality, whose only responsibility is to build the config for weighted_target) and not wrr (which is weighted_round_robin and is a completely different policy).
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.
| endpoints[i] = resolver.Endpoint{Addresses: []resolver.Address{a}} | ||
| endpoints[i].Attributes = a.BalancerAttributes | ||
| } | ||
| endpoints = []resolver.Endpoint{{Addresses: state.Addresses}} |
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.
@arjan-bal recently made a change #8812 to ensure that the DNS resolver returns endpoints. So, I think we don't need a special case here for len(endpoints) == 0. Please correct me if I'm wrong.
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.
Right, we don't need that special case.
| Cluster: testClusterName2, | ||
| ChildPolicy: tt.xdsLBPolicy, | ||
| } | ||
| if diff := cmp.Diff(gotConfig, wantConfig); diff != "" { |
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.
When using cmp.Diff, it makes more sense to pass the want as the first argument and the got as the second. And in the error string have (-want, +got). When we do this, and see an error string with some lines which have a prefix of -, we can say that those lines were expected but missing in the output. And similarly, when we see some lines with a prefix of +, we can say that those lines were not expected, but were seen in the output. See go/go-style/decisions#types-of-equality
Here and elsewhere where cmp.Diff is used in this PR.
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.
| server2 := stubserver.StartTestService(t, nil) | ||
| defer server2.Stop() | ||
|
|
||
| // Register a manual resolver with the "dns" scheme to mock DNS resolution. |
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 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.
resolve conflicts
Fixes : #8153
This PR implements the "Changes to Logical DNS Clusters" section of gRFC A61 (IPv4/IPv6 Dual-stack Backends).
Currently,
LOGICAL_DNSclusters in the xDS cluster resolver have their Load Balancing policy hard-coded topick_first. This ensures the semantics of connecting to only one address at a time.This PR updates the
xds_cluster_resolverlogic. ThebuildClusterImplConfigForDNSfunction removes the hard-codedpick_firstpolicy restriction forLOGICAL_DNSclusters, allowing them to use the configured LB policy.Also, in the DNS update handler, all resolved addresses are now grouped into a single
resolver.Endpoint. This ensures that regardless of the configured parent LB policy, the child policy sees a single "backend" endpoint containing all addresses.RELEASE NOTES:
LOGICAL_DNSclusters now honor the LB policy configured in the cluster resource, rather than defaulting to a hardcodedpick_firstpolicy.