Skip to content
This repository was archived by the owner on Jul 22, 2026. It is now read-only.

Add opt-in D2 client subscription to the IndisRegistryObserver Cluster - #1176

Merged
harrisonlhl123 merged 7 commits into
masterfrom
hliang/indis-force-observer-cluster-subscription
Jun 26, 2026
Merged

Add opt-in D2 client subscription to the IndisRegistryObserver Cluster#1176
harrisonlhl123 merged 7 commits into
masterfrom
hliang/indis-force-observer-cluster-subscription

Conversation

@harrisonlhl123

@harrisonlhl123 harrisonlhl123 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

This change lets a D2 xDS client subscribe to IndisRegistryObserver cluster, so it receives and caches the live observer endpoint set the same way it learns about any other cluster.

What changed

  • New D2ClientConfig.subscribeToIndisObserverCluster (default false), plumbed through D2ClientBuilder and XdsLoadBalancerWithFacilitiesFactory into XdsToD2PropertiesAdaptor.
  • When enabled, XdsToD2PropertiesAdaptor.start() additionally subscribes to the observer's cluster, service, and URI.

When the flag is off (the default), behavior is unchanged.

Testing

Unit Tests

  • TestXdsToD2PropertiesAdaptor — asserts start() subscribes to the observer cluster, service, and URI when the flag is enabled, and does not when it is off (the default).
  • D2ClientBuilderTest — asserts the flag set on the builder propagates through the D2ClientConfig constructor to the config handed to the load balancer factory, and defaults to false.

Integration (manual, against a live observer)
Ran a real D2 xDS client (via XdsToD2SampleClient, driven through the full D2ClientBuilder path with the flag enabled) against a running local observer. The client subscribed to both observer resources and received the observer's own endpoint over xDS:

143:21:20:20.974 INFO  com.linkedin.d2.xds.XdsClientImpl - Subscribing to NODE resource: /d2/services/indisRegistryObserver
154:21:20:20.975 INFO  com.linkedin.d2.xds.XdsClientImpl - Subscribing to NODE resource: /d2/clusters/IndisRegistryObserver
165:21:20:20.976 INFO  com.linkedin.d2.xds.XdsClientImpl - Subscribing to D2_URI_MAP resource: /d2/uris/IndisRegistryObserver
215:21:20:20.997 INFO  com.linkedin.d2.xds.XdsClientImpl - Received initial data for NODE /d2/services/indisRegistryObserver. Set state to FETCHED.
233:21:20:21.078 INFO  com.linkedin.d2.xds.XdsClientImpl - Received initial data for NODE /d2/clusters/IndisRegistryObserver. Set state to FETCHED.
251:21:20:21.092 INFO  com.linkedin.d2.xds.XdsClientImpl - Received initial data for D2_URI_MAP /d2/uris/IndisRegistryObserver. Set state to FETCHED.

harrisonlhl123 and others added 5 commits June 18, 2026 13:52
…structor

Previously the flag was copied onto the config after construction in D2ClientBuilder,
which was inconsistent with its sibling subscribeToUriGlobCollection (set via the
constructor) and risked being silently dropped by any future construction path.

Thread it through both D2ClientConfig constructors and the builder call, mirroring
subscribeToUriGlobCollection exactly, and remove the copy-after-construction line.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tion

Cover the config-plumbing half of the change: assert that the flag set via
D2ClientBuilder.setSubscribeToIndisObserverCluster is carried through the
D2ClientConfig constructor to the config handed to the load balancer factory
during build() (and defaults to false otherwise). The factory then forwards it
to XdsToD2PropertiesAdaptor, whose subscription behavior TestXdsToD2PropertiesAdaptor
already covers. The tests call build() and assert the factory was invoked so the
propagation assertion actually runs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@harrisonlhl123 harrisonlhl123 changed the title Hliang/indis force observer cluster subscription Add opt-in D2 client subscription to the INDIS observer cluster Jun 24, 2026
@harrisonlhl123 harrisonlhl123 changed the title Add opt-in D2 client subscription to the INDIS observer cluster Add opt-in D2 client subscription to the IndisRegistryObserver Cluster Jun 24, 2026
@harrisonlhl123
harrisonlhl123 marked this pull request as ready for review June 24, 2026 21:26
Comment thread d2/src/main/java/com/linkedin/d2/balancer/D2ClientConfig.java Outdated
Comment thread d2/src/main/java/com/linkedin/d2/xds/XdsToD2PropertiesAdaptor.java Outdated
Comment thread d2/src/test/java/com/linkedin/d2/xds/TestXdsToD2PropertiesAdaptor.java Outdated
Comment thread d2/src/test/java/com/linkedin/d2/xds/TestXdsToD2PropertiesAdaptor.java Outdated
Comment thread d2/src/main/java/com/linkedin/d2/xds/XdsToD2PropertiesAdaptor.java
@harrisonlhl123
harrisonlhl123 merged commit 735bb72 into master Jun 26, 2026
2 of 4 checks passed
@harrisonlhl123
harrisonlhl123 deleted the hliang/indis-force-observer-cluster-subscription branch June 26, 2026 22:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants