Skip to content

Conversation

@Pranjali-2501
Copy link
Contributor

@Pranjali-2501 Pranjali-2501 commented Dec 1, 2025

Fixes : #8153

This PR implements the "Changes to Logical DNS Clusters" section of gRFC A61 (IPv4/IPv6 Dual-stack Backends).

Currently, LOGICAL_DNS clusters in the xDS cluster resolver have their Load Balancing policy hard-coded to pick_first. This ensures the semantics of connecting to only one address at a time.

This PR updates the xds_cluster_resolver logic. The buildClusterImplConfigForDNS function removes the hard-coded pick_first policy restriction for LOGICAL_DNS clusters, 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:

  • xds: LOGICAL_DNS clusters now honor the LB policy configured in the cluster resource, rather than defaulting to a hardcoded pick_first policy.

@Pranjali-2501 Pranjali-2501 added this to the 1.78 Release milestone Dec 1, 2025
@Pranjali-2501 Pranjali-2501 added Type: Feature New features or improvements in behavior Area: xDS Includes everything xDS related, including LB policies used with xDS. labels Dec 1, 2025
@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.11%. Comparing base (19ace67) to head (83317b1).

Files with missing lines Patch % Lines
...rnal/xds/balancer/clusterresolver/configbuilder.go 84.61% 0 Missing and 2 partials ⚠️
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     
Files with missing lines Coverage Δ
...rnal/xds/balancer/clusterresolver/configbuilder.go 76.64% <84.61%> (-17.39%) ⬇️

... and 20 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@easwars
Copy link
Contributor

easwars commented Dec 1, 2025

This change probably needs a release note.

@easwars easwars assigned Pranjali-2501 and unassigned easwars and arjan-bal Dec 1, 2025
@Pranjali-2501 Pranjali-2501 requested a review from easwars December 3, 2025 17:59
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
Copy link
Contributor

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).

Copy link
Contributor Author

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}}
Copy link
Contributor

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.

Copy link
Contributor Author

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 != "" {
Copy link
Contributor

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.

Copy link
Contributor Author

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.
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@easwars easwars assigned Pranjali-2501 and unassigned easwars Jan 22, 2026
@easwars easwars assigned Pranjali-2501 and unassigned easwars Jan 29, 2026
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: Feature New features or improvements in behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Behavior change for A61 update: remove special case for LOGICAL_DNS clusters

5 participants