Skip to content

Conversation

@Pranjali-2501
Copy link
Contributor

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

This PR updates the internal xdsresource.Endpoint struct to contain a resolver.Endpoint instead of a []string to store the list of addresses associated with the endpoint gRFC A81. This change standardizes how backend information is stored and ensures that attributes (such as Hostname) are correctly associated with the endpoint hierarchy.

Key Changes:

Struct Update:

  • xdsresource.Endpoint now includes a ResolverEndpoint field (of type resolver.Endpoint) to store addresses and attributes. Remove the existing Address field (of type []string) and store address as a resolver.Endpoint field.

Attribute Handling:

  • Added SetHostname and GetHostname helpers to manage hostname metadata within resolver.Endpoint.Attributes.

Parsing Logic:

  • Updated parseEndpoints in unmarshal_eds.go to correctly populate the resolver.Endpoint object.

RELEASE NOTES: N/A

@Pranjali-2501 Pranjali-2501 added this to the 1.78 Release milestone Dec 6, 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 6, 2025
@codecov
Copy link

codecov bot commented Dec 6, 2025

Codecov Report

❌ Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.36%. Comparing base (4c27cc8) to head (3d77ddb).
⚠️ Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
...nternal/xds/xdsclient/xdsresource/unmarshal_eds.go 82.35% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8750      +/-   ##
==========================================
+ Coverage   83.28%   83.36%   +0.07%     
==========================================
  Files         418      418              
  Lines       32367    32496     +129     
==========================================
+ Hits        26958    27091     +133     
+ Misses       4034     4022      -12     
- Partials     1375     1383       +8     
Files with missing lines Coverage Δ
...rnal/xds/balancer/clusterresolver/configbuilder.go 94.11% <100.00%> (ø)
...nternal/xds/xdsclient/xdsresource/unmarshal_eds.go 92.76% <82.35%> (-1.57%) ⬇️

... and 36 files with indirect coverage changes

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

@Pranjali-2501 Pranjali-2501 self-assigned this Dec 6, 2025
@Pranjali-2501 Pranjali-2501 requested a review from easwars December 7, 2025 15:25
@Pranjali-2501 Pranjali-2501 changed the title xds: refactor xdsresource.Endpoint to embed resolver.Endpoint xds: refactor xdsresource.Endpoint to embed resolver.Endpoint (gRFC A81) Dec 8, 2025
@Pranjali-2501 Pranjali-2501 requested a review from mbissa December 8, 2025 10:09
easwars
easwars previously approved these changes Dec 10, 2025
Copy link
Contributor

@easwars easwars left a 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

// setHostname returns a copy of the given endpoint with hostname added
// as an attribute.
func setHostname(endpoint resolver.Endpoint, hostname string) resolver.Endpoint {
// Only set if non-empty; xds_cluster_impl uses this to trigger :authority rewriting.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please wrap comment sentences at 80-cols. See: go/go-style/decisions#comment-line-length

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.

Comment on lines 576 to 578
ResolverEndpoint: resolver.Endpoint{
Addresses: []resolver.Address{{Addr: "addr-2-2"}},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: There are still a few more places in this file where the literal struct could be specified in a single line.

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 Dec 10, 2025
// Create a copy of endpoint.ResolverEndpoint to avoid race.
resolverEndpoint := endpoint.ResolverEndpoint
resolverEndpoint.Addresses = make([]resolver.Address, len(endpoint.ResolverEndpoint.Addresses))
copy(resolverEndpoint.Addresses, endpoint.ResolverEndpoint.Addresses)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm.. actually hold on. Copying a slice of resolver.Address will create a new slice with new resolver.Address instances, but they might still be referring to the same attributes. We need to discuss this a little bit more.

@easwars easwars dismissed their stale review December 10, 2025 19:54

We need more discussion on safely copying resolver.Endpoint and resolver.Address structs.

@Pranjali-2501 Pranjali-2501 changed the title xds: refactor xdsresource.Endpoint to embed resolver.Endpoint (gRFC A81) xds: refactor xdsresource.Endpoint to add resolver.Endpoint (gRFC A81) Dec 11, 2025
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.

4 participants