Skip to content

Conversation

@eshitachandwani
Copy link
Member

@eshitachandwani eshitachandwani commented Dec 26, 2025

Part of A74 changes.
This PR adds the functions to subscribe to clusters which increases the refcount and to unsubscribe to the cluster which decreases the refcount. These functions will be used in a later PR to start cluster watches for dynamic clusters. Will also be used by xds_resolver to make sure PRCs subscribe to clusters they are routed to and that the watches for those clusters remain active.
RELEASE NOTES: None

@eshitachandwani eshitachandwani added this to the 1.79 Release milestone Dec 26, 2025
@eshitachandwani eshitachandwani added Type: Internal Cleanup Refactors, etc Area: xDS Includes everything xDS related, including LB policies used with xDS. labels Dec 26, 2025
@codecov
Copy link

codecov bot commented Dec 26, 2025

Codecov Report

❌ Patch coverage is 68.18182% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.07%. Comparing base (572fdca) to head (4da7df9).
⚠️ Report is 26 commits behind head on master.

Files with missing lines Patch % Lines
internal/xds/xdsdepmgr/xds_dependency_manager.go 66.25% 16 Missing and 11 partials ⚠️
internal/xds/resolver/xds_resolver.go 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8792      +/-   ##
==========================================
- Coverage   83.31%   82.07%   -1.24%     
==========================================
  Files         414      414              
  Lines       32753    32838      +85     
==========================================
- Hits        27288    26952     -336     
- Misses       4064     4120      +56     
- Partials     1401     1766     +365     
Files with missing lines Coverage Δ
internal/xds/resolver/xds_resolver.go 72.63% <87.50%> (-16.13%) ⬇️
internal/xds/xdsdepmgr/xds_dependency_manager.go 62.60% <66.25%> (-17.82%) ⬇️

... and 43 files with indirect coverage changes

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

Copy link
Contributor

@arjan-bal arjan-bal left a comment

Choose a reason for hiding this comment

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

LGTM!

@eshitachandwani eshitachandwani removed their assignment Jan 13, 2026
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.

Can you please make the PR description a bit more detailed to clearly indicate what is included in this PR and what will follow in subsequent ones.

clusterResourcesSeen := make(map[string]bool)
haveAllResources := true

// Get all clusters to be watched: from route config and from cluster
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we be treating the dynamic clusters differently here? i.e., if we haven't received an update for a dynamic cluster subscription, that should not cause an update to existing cluster from the route config to be blocked.

See https://github.com/grpc/proposal/blob/master/A74-xds-config-tears.md#changes-in-cds-lb-policy. Specifically, the following paragraph:
Note that when a cds LB policy obtains a dynamic subscription to a cluster, there may be subsequent updates from the xds resolver that do not yet include the newly subscribed-to cluster. Therefore, the cds policy will need to ignore updates in which the XdsConfig does not contain the cluster. However, this case should not occur with non-dynamic clusters, because the xds resolver ensures that those clusters are being subscribed to until they are removed from the LB policy config.

So, I think we should run the loop (currently starting in line 252) two times, one for clusters from route config and one for clusters from dynamic subscriptions. And in the second loop, we should not set haveAllResources to false if a dynamic cluster hasn't been resolved yet (and instead keep going).

And we need a test for this scenario as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

I dont' think it is necessary as only one out of WeightedCluster or ClusterSpecifierPlugin will be set as mentioned in our comments. The only way that we have clusters in both the arrays is in the case where we have cluster A referenced by RPCs and not in route(it will be in clusterSubscriptions map) and cluster B currently in routeconfig (it will be in clustersFromRouteConfig )

Copy link
Contributor

Choose a reason for hiding this comment

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

Based on our offline discussion yesterday, I thought we agreed that dynamic clusters have to be handled differently compared to route clusters. The only thing that we did not completely have a handle on was the why and I thought we decided to ask other grpc maintainers about that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed.

@easwars easwars assigned eshitachandwani and unassigned easwars Jan 21, 2026
@easwars
Copy link
Contributor

easwars commented Jan 29, 2026

@eshitachandwani
Please update the PR description as per our offline discussion.

clusterResourcesSeen := make(map[string]bool)
haveAllResources := true

// Get all clusters to be watched: from route config and from cluster
Copy link
Contributor

Choose a reason for hiding this comment

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

Based on our offline discussion yesterday, I thought we agreed that dynamic clusters have to be handled differently compared to route clusters. The only thing that we did not completely have a handle on was the why and I thought we decided to ask other grpc maintainers about that.

@easwars easwars removed their assignment Jan 29, 2026
@eshitachandwani
Copy link
Member Author

@eshitachandwani Please update the PR description as per our offline discussion.

Done.

@easwars easwars assigned eshitachandwani and unassigned easwars Jan 31, 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: Internal Cleanup Refactors, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants