Skip to content

Add CentralDogmaConfigSource for direct xDS resource fetching from repository#1318

Open
jrhee17 wants to merge 3 commits into
line:mainfrom
jrhee17:feat/centraldogma-configsource
Open

Add CentralDogmaConfigSource for direct xDS resource fetching from repository#1318
jrhee17 wants to merge 3 commits into
line:mainfrom
jrhee17:feat/centraldogma-configsource

Conversation

@jrhee17

@jrhee17 jrhee17 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Motivation:

Central Dogma already provides an xDS control plane via its built-in xDS plugin. This change adds a supplementary approach: a custom ConfigSource backed by Central Dogma's watch API that allows clients to subscribe to xDS resources (clusters, listeners, routes, endpoints) directly from the repository — without going through the gRPC-based xDS control plane. This is useful for simpler setups where users want to manage xDS resources as plain files in Central Dogma and get live updates via the watcher mechanism.

Additionally, FreeMarker templates (.ftl files) allow users to define reusable xDS resource templates parameterized via profile files. For example, a shared listener template can have its routes injected from a small YAML profile, eliminating the need for separate Listener and Route resources per service:

/listeners/my-listener.yaml (per-service profile):

routes:
  - match:
      prefix: /api
    route:
      cluster: myproject/xds/clusters/default-outbound.json.ftl?profile=/xds/my-service-eds.yaml
  - match:
      prefix: /
    route:
      cluster: myproject/xds/clusters/default-outbound.json.ftl?profile=/xds/my-service-eds.yaml

The listener is subscribed to as:
myproject/xds/listeners/default-outbound.json.ftl?profile=/listeners/my-listener.yaml

Modifications:

  • Added client/java-armeria-xds module with a CentralDogmaConfigSource protobuf message and a SotwConfigSourceSubscriptionFactory SPI implementation:
    • CentralDogmaSotwConfigSourceSubscriptionFactory — subscribes to Central Dogma resources via the watch API, emitting DiscoveryResponse snapshots that integrate with Armeria's xDS bootstrap
    • ResourcePath — parses xDS resource names encoded as {project}/{repo}/{path}[?profile={variableFile}]
    • PreprocessorCentralDogmaBuilder — creates a CentralDogma client from a ClusterSnapshot's preprocessor
    • SPI registration via META-INF/services
  • Added ToJsonMethod — a custom FreeMarker method (${toJson(obj)}) that serializes template variables to JSON, enabling structured objects (e.g., route match rules) to be embedded in both JSON and YAML templates
  • Injected a centraldogma namespace into the FreeMarker template context (centraldogma.project, centraldogma.repo, centraldogma.path, centraldogma.profile) so templates can derive their own xDS resource names

Result:

  • xDS clients can use CentralDogmaConfigSource in their bootstrap configuration to fetch xDS resources directly from Central Dogma without going through the xDS control plane
  • Resources are watched for changes and updates are pushed to the client automatically
  • Both JSON and YAML resource formats are supported, as well as FreeMarker templates (.json.ftl, .yaml.ftl) with profile-based parameterization
  • Reusable templates eliminate per-service Listener/Route/Cluster boilerplate — users only write small YAML profiles and endpoint data

@jrhee17 jrhee17 added this to the 0.85.0 milestone Jun 23, 2026
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d841dcb0-ab5e-443e-9794-3a0e550b6e37

📥 Commits

Reviewing files that changed from the base of the PR and between b6f9119 and 69517b4.

📒 Files selected for processing (10)
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/CentralDogmaExtensionFactoryProvider.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/CentralDogmaSotwConfigSourceSubscriptionFactory.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/CentralDogmaTypeRegistryPackageProvider.java
  • client/java-armeria-xds/src/main/resources/META-INF/services/com.linecorp.armeria.xds.XdsExtensionFactoryProvider
  • client/java-armeria-xds/src/main/resources/META-INF/services/com.linecorp.armeria.xds.XdsTypeRegistryPackageProvider
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceBearerTokenTest.java
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceMtlsTest.java
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTemplateTest.java
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTest.java
  • xds-api/src/main/proto/centraldogma_config_source.proto
🚧 Files skipped from review as they are similar to previous changes (5)
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceBearerTokenTest.java
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceMtlsTest.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/CentralDogmaSotwConfigSourceSubscriptionFactory.java
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTemplateTest.java
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTest.java

📝 Walkthrough

Walkthrough

Adds a Central Dogma-backed xDS config source with JSON, YAML, and FreeMarker resource support, bearer-token and mTLS integration coverage, xDS SPI registration, protobuf API definitions, and supporting Gradle module and dependency wiring.

Changes

Central Dogma xDS Config Source

Layer / File(s) Summary
Proto contract and resource path parsing
xds-api/..., client/java-armeria-xds/.../configsource/ResourcePath.java
Defines the CentralDogma config-source protobuf messages and parses resource paths, profiles, and JSON/YAML/FreeMarker formats.
FreeMarker helper and context enrichment
server/src/main/java/.../variable/*
Adds toJson and exposes Central Dogma metadata to FreeMarker templates.
Client stream and resource subscription
client/java-armeria-xds/.../configsource/*
Creates CentralDogma clients, watches resources, renders templates, and emits xDS discovery responses.
SPI and module wiring
settings.gradle, build.gradle, dependencies.toml, client/..., xds-api/..., it/xds-client/...
Registers extension providers and configures modules, repositories, dependencies, and service loading.
Integration tests for config source behavior
it/xds-client/src/test/java/.../CentralDogmaConfigSourceTest.java
Covers direct resource resolution, updates, chained listener resources, and multiple cluster subscriptions.
Integration tests for template expansion
it/xds-client/src/test/java/.../CentralDogmaConfigSourceTemplateTest.java
Covers JSON/YAML templates, profiles, route serialization, endpoint updates, and field-name conversion.
Integration tests for authenticated access
it/xds-client/src/test/java/.../CentralDogmaConfigSourceBearerTokenTest.java, CentralDogmaConfigSourceMtlsTest.java
Covers bearer-token and mutual-TLS Central Dogma access.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant XdsBootstrap
  participant CentralDogmaSotwConfigSourceSubscriptionFactory
  participant CentralDogmaClientStream
  participant WatcherStream
  participant DiscoveryResponse
  XdsBootstrap->>CentralDogmaSotwConfigSourceSubscriptionFactory: create config-source subscription
  CentralDogmaSotwConfigSourceSubscriptionFactory->>CentralDogmaClientStream: initialize authenticated client
  XdsBootstrap->>WatcherStream: subscribe to resource
  WatcherStream->>CentralDogmaClientStream: watch Central Dogma resource
  WatcherStream->>DiscoveryResponse: emit watched JSON update
  CentralDogmaSotwConfigSourceSubscriptionFactory->>XdsBootstrap: emit DiscoveryResponse
Loading

Possibly related PRs

Suggested reviewers: trustin, ikhoon, minwoox

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.77% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding CentralDogmaConfigSource for direct xDS resource fetching.
Description check ✅ Passed The description is directly related to the changes and accurately describes the new config source, helpers, and template support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@build.gradle`:
- Line 21: The Sonatype snapshots repository at line 21 is unrestricted,
allowing any artifact to resolve from snapshots, which increases supply-chain
risk. Modify the maven repository declaration to restrict it to only artifacts
from the com.linecorp.armeria group and snapshots using a repositoryContent
block. This ensures only the required armeria snapshots use this repository
while preventing unrelated modules from resolving arbitrary snapshot artifacts.

In
`@client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/CentralDogmaSotwConfigSourceSubscriptionFactory.java`:
- Around line 72-77: After unpacking the CentralDogmaConfigSource with the
validator unpack method, validate that the cluster name obtained from
cdConfig.getClusterName() is not null or empty before passing it to
factoryContext.clusterStream(). Add validation logic immediately after the
unpacking of cdConfig and before the clusterStream creation to fail fast with a
clear configuration error message when the cluster_name is missing or empty,
rather than allowing an invalid value to propagate to downstream stream/watcher
operations.

In
`@client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/ResourcePath.java`:
- Around line 61-67: The current code accepts query strings with multiple
parameters (such as ?profile=/x.yaml&foo=1) without validation, silently
treating the entire suffix as a profile value. After extracting the queryString,
add validation to ensure it only contains the expected PROFILE_PARAM and nothing
else. Specifically, check that the queryString does not contain additional
parameters or unsupported characters (such as the ampersand character), and
throw an IllegalArgumentException with a descriptive message if unexpected
content is detected. This validation should occur in the conditional block that
checks if queryString.startsWith(PROFILE_PARAM) to reject malformed resource
names early.

In
`@client/java-armeria-xds/src/main/proto/com/github/xds/centraldogma/v1/centraldogma_config_source.proto`:
- Line 16: The package declaration in centraldogma_config_source.proto does not
align with its file location, causing a Buf PACKAGE_DIRECTORY_MATCH lint error.
Either adjust the directory structure to match the package
com.github.xds.centraldogma.v1 (ensuring the file path from the Buf module root
corresponds to the package hierarchy), or update the buf.yaml configuration to
set the correct module root so the relative path from that root aligns with the
declared package name. Verify the fix by running Buf lint to confirm the
PACKAGE_DIRECTORY_MATCH error is resolved.

In
`@it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTest.java`:
- Around line 47-57: The scaffold method writes test data to
`/clusters/my-cluster.json` that is shared across all tests in the class, and
since the CentralDogmaExtension runs once per class with no per-test reset, the
file gets modified by different tests (both scaffold for STATIC type and
fullResourceChain for EDS type) causing test execution order to determine which
schema subsequent tests observe. Fix this by either creating unique resource
names for each test method (for example by including the test method name in the
cluster name used in CLUSTER_CHANGE) or by implementing a per-test reset
mechanism that clears or restores the repository state between test methods
using a `@BeforeEach` annotated method that either deletes and recreates the xds
repository or specifically removes the conflicting cluster file before each
test.

In
`@server/src/main/java/com/linecorp/centraldogma/server/internal/api/variable/Templater.java`:
- Around line 285-287: The conditional check for injecting the profile value
into cdContext uses only `variableFile != null`, which allows empty strings to
pass through and be published as the profile value. This can cause downstream
resource parsing failures. Update the condition to also verify that variableFile
is not empty or blank before adding it to cdContext with the "profile" key,
ensuring only non-empty profile values are injected.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 27fe8666-b625-4893-ab34-a348d48b8f4d

📥 Commits

Reviewing files that changed from the base of the PR and between 07b6fdb and 7eba999.

📒 Files selected for processing (14)
  • build.gradle
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/CentralDogmaSotwConfigSourceSubscriptionFactory.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/PreprocessorCentralDogmaBuilder.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/ResourcePath.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/package-info.java
  • client/java-armeria-xds/src/main/proto/com/github/xds/centraldogma/v1/centraldogma_config_source.proto
  • client/java-armeria-xds/src/main/resources/META-INF/services/com.linecorp.armeria.xds.configsource.SotwConfigSourceSubscriptionFactory
  • dependencies.toml
  • it/xds-client/build.gradle
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTemplateTest.java
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTest.java
  • server/src/main/java/com/linecorp/centraldogma/server/internal/api/variable/Templater.java
  • server/src/main/java/com/linecorp/centraldogma/server/internal/api/variable/ToJsonMethod.java
  • settings.gradle

Comment thread build.gradle
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.48921% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.34%. Comparing base (9d10dc0) to head (7eba999).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
...ntralDogmaSotwConfigSourceSubscriptionFactory.java 92.00% 5 Missing and 1 partial ⚠️
.../client/armeria/xds/configsource/ResourcePath.java 82.35% 0 Missing and 6 partials ⚠️
...gma/server/internal/api/variable/ToJsonMethod.java 42.85% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1318      +/-   ##
============================================
- Coverage     69.52%   69.34%   -0.18%     
- Complexity     5540     5545       +5     
============================================
  Files           531      535       +4     
  Lines         23413    23616     +203     
  Branches       2675     2692      +17     
============================================
+ Hits          16277    16377     +100     
- Misses         5666     5742      +76     
- Partials       1470     1497      +27     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jrhee17 jrhee17 force-pushed the feat/centraldogma-configsource branch from c4aacb3 to 1bcaf83 Compare June 24, 2026 07:10

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

♻️ Duplicate comments (2)
it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTest.java (1)

351-359: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Shared resource path /clusters/my-cluster.json causes order-dependent tests.

scaffold() writes /clusters/my-cluster.json as a STATIC cluster, while fullResourceChain(ext="json") overwrites the same path with an EDS cluster. Since CentralDogmaExtension runs once per class with no per-test reset, the execution order determines whether fetchClusterFromCentralDogma observes the STATIC schema it asserts on. Use a unique resource name for the json variant (e.g., include the test name) or reset the repository between tests.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTest.java`
around lines 351 - 359, The shared cluster resource path in fullResourceChain()
is causing order-dependent test failures because it overwrites the STATIC
cluster written by scaffold() at the same /clusters/my-cluster.json location.
Update fullResourceChain(String ext, ChangeFactory factory) to use a unique path
for the json variant (for example, a test-specific cluster name) or add
repository reset logic so fetchClusterFromCentralDogma always sees the intended
cluster schema regardless of test order.
server/src/main/java/com/linecorp/centraldogma/server/internal/api/variable/Templater.java (1)

285-287: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Avoid injecting empty centraldogma.variableFile.

variableFile != null still allows "", and downstream templates check only existence (??), which can emit ?profile= and break resource-name parsing.

Suggested fix
-                    if (variableFile != null) {
+                    if (!Strings.isNullOrEmpty(variableFile)) {
                         cdContext.put("variableFile", variableFile);
                     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@server/src/main/java/com/linecorp/centraldogma/server/internal/api/variable/Templater.java`
around lines 285 - 287, Avoid injecting centraldogma.variableFile when it is
empty, since the current Templater logic only checks variableFile != null and
still stores blank strings. Update the conditional in Templater so it only puts
variableFile into cdContext when it has a real value, preserving downstream ??
checks from emitting empty query parameters and breaking parsing.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In
`@it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTest.java`:
- Around line 351-359: The shared cluster resource path in fullResourceChain()
is causing order-dependent test failures because it overwrites the STATIC
cluster written by scaffold() at the same /clusters/my-cluster.json location.
Update fullResourceChain(String ext, ChangeFactory factory) to use a unique path
for the json variant (for example, a test-specific cluster name) or add
repository reset logic so fetchClusterFromCentralDogma always sees the intended
cluster schema regardless of test order.

In
`@server/src/main/java/com/linecorp/centraldogma/server/internal/api/variable/Templater.java`:
- Around line 285-287: Avoid injecting centraldogma.variableFile when it is
empty, since the current Templater logic only checks variableFile != null and
still stores blank strings. Update the conditional in Templater so it only puts
variableFile into cdContext when it has a real value, preserving downstream ??
checks from emitting empty query parameters and breaking parsing.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 57c33ec0-97ba-456b-9496-8a8a417ac2fb

📥 Commits

Reviewing files that changed from the base of the PR and between c4aacb3 and 1bcaf83.

📒 Files selected for processing (13)
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/CachingStream.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/CentralDogmaSotwConfigSourceSubscriptionFactory.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/PreprocessorCentralDogmaBuilder.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/ResourcePath.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/package-info.java
  • client/java-armeria-xds/src/main/proto/com/github/xds/centraldogma/v1/centraldogma_config_source.proto
  • client/java-armeria-xds/src/main/resources/META-INF/services/com.linecorp.armeria.xds.configsource.SotwConfigSourceSubscriptionFactory
  • it/xds-client/build.gradle
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTemplateTest.java
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTest.java
  • server/src/main/java/com/linecorp/centraldogma/server/internal/api/variable/Templater.java
  • server/src/main/java/com/linecorp/centraldogma/server/internal/api/variable/ToJsonMethod.java
  • settings.gradle
✅ Files skipped from review due to trivial changes (5)
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/CachingStream.java
  • server/src/main/java/com/linecorp/centraldogma/server/internal/api/variable/ToJsonMethod.java
  • it/xds-client/build.gradle
  • settings.gradle
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/package-info.java
🚧 Files skipped from review as they are similar to previous changes (3)
  • client/java-armeria-xds/src/main/resources/META-INF/services/com.linecorp.armeria.xds.configsource.SotwConfigSourceSubscriptionFactory
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/ResourcePath.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/CentralDogmaSotwConfigSourceSubscriptionFactory.java

@jrhee17 jrhee17 marked this pull request as ready for review June 30, 2026 02:51

@ikhoon ikhoon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍👍

// under the License.
syntax = "proto3";

package com.github.xds.centraldogma.v1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a convention for the package names? I'm asking because I'm not sure whether we can use com.github.xds.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is due to the current limitation at https://github.com/line/armeria/blob/8de1a038a3aef5e143a542329af786d7f0a1e21e/xds/src/main/java/com/linecorp/armeria/xds/XdsResourceReader.java#L77-L79

I'm planning on updating to add a fixed namespace com.linecorp.armeria.xds.extensions

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How about com.linecorp.centraldogma.xds.v1; for java_package?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll add an API at XdsResourceReader for customizing which packages to scan, and also add to the FactoryContext for general usage.

Comment thread build.gradle
allprojects {
repositories {
mavenCentral()
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like this was added for testing with the Armeria snapshot but it should be removed before merging.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

5ab0d65 will be reverted once 1.41.0 is released

Clients.builder(ClientPreprocessors.of(preprocessor));
builder.decorator(DecodingClient.newDecorator());
final WebClient client = builder.build(WebClient.class);
return new ArmeriaCentralDogma(CommonPools.blockingTaskExecutor(), client, "anonymous",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this okay for using anonymous?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed at f6685ad

* </ul>
*/
Query<JsonNode> query() {
if (path.endsWith(".yaml") || path.endsWith(".yml")) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: guarding like basePath()?
if (ftl) {}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed at fd24349

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceMtlsTest.java (1)

141-165: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Duplicate TLS client-builder logic.

configureWebClientBuilder and webClient() build the identical TlsKeyPair/ClientTlsConfig twice. Could extract a shared helper.

♻️ Proposed consolidation
+    private static ClientFactory tlsClientFactory() {
+        final TlsKeyPair tlsKeyPair = TlsKeyPair.of(clientCert.privateKey(), clientCert.certificate());
+        final ClientTlsConfig tlsConfig =
+                ClientTlsConfig.builder()
+                               .tlsCustomizer(b -> b.trustManager(serverCert.certificate()))
+                               .build();
+        return ClientFactory.builder()
+                            .tlsProvider(TlsProvider.of(tlsKeyPair), tlsConfig)
+                            .build();
+    }
+
     private static void configureWebClientBuilder(WebClientBuilder builder) {
-        final TlsKeyPair tlsKeyPair = TlsKeyPair.of(clientCert.privateKey(),
-                                                    clientCert.certificate());
-        final ClientTlsConfig tlsConfig =
-                ClientTlsConfig.builder()
-                               .tlsCustomizer(b -> b.trustManager(serverCert.certificate()))
-                               .build();
-        builder.factory(ClientFactory.builder()
-                                     .tlsProvider(TlsProvider.of(tlsKeyPair), tlsConfig)
-                                     .build());
+        builder.factory(tlsClientFactory());
     }

     private static WebClient webClient() {
-        final TlsKeyPair tlsKeyPair = TlsKeyPair.of(clientCert.privateKey(),
-                                                    clientCert.certificate());
-        final ClientTlsConfig tlsConfig =
-                ClientTlsConfig.builder()
-                               .tlsCustomizer(b -> b.trustManager(serverCert.certificate()))
-                               .build();
         return WebClient.builder("https://127.0.0.1:" + dogma.serverAddress().getPort())
-                        .factory(ClientFactory.builder()
-                                              .tlsProvider(TlsProvider.of(tlsKeyPair), tlsConfig)
-                                              .build())
+                        .factory(tlsClientFactory())
                         .build();
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceMtlsTest.java`
around lines 141 - 165, The TLS client setup is duplicated in
configureWebClientBuilder and webClient(), where both build the same TlsKeyPair
and ClientTlsConfig. Extract that shared TLS/client factory construction into a
common helper and have both methods call it, keeping the existing clientCert and
serverCert wiring unchanged while removing the repeated builder logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceMtlsTest.java`:
- Around line 141-165: The TLS client setup is duplicated in
configureWebClientBuilder and webClient(), where both build the same TlsKeyPair
and ClientTlsConfig. Extract that shared TLS/client factory construction into a
common helper and have both methods call it, keeping the existing clientCert and
serverCert wiring unchanged while removing the repeated builder logic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 98426cc0-1a3d-43ad-89ab-bc672b59e1f3

📥 Commits

Reviewing files that changed from the base of the PR and between 2103e3b and fd24349.

📒 Files selected for processing (7)
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/CentralDogmaSotwConfigSourceSubscriptionFactory.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/PreprocessorBasedCentralDogma.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/ResourcePath.java
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceBearerTokenTest.java
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceMtlsTest.java
  • xds-api/build.gradle
  • xds-api/src/main/proto/com/github/xds/centraldogma/v1/centraldogma_config_source.proto
🚧 Files skipped from review as they are similar to previous changes (2)
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/ResourcePath.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/CentralDogmaSotwConfigSourceSubscriptionFactory.java

@minwoox minwoox left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 👍
Please fix the CI failure.

@jrhee17 jrhee17 force-pushed the feat/centraldogma-configsource branch from fd24349 to b6f9119 Compare July 2, 2026 01:58

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceMtlsTest.java (1)

141-165: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Duplicate TLS client-setup logic.

configureWebClientBuilder and webClient build the same TlsKeyPair/ClientTlsConfig inline; consider factoring the shared TLS config construction into one helper to avoid drift if cert wiring changes.

♻️ Suggested consolidation
+    private static ClientFactory tlsClientFactory() {
+        final TlsKeyPair tlsKeyPair = TlsKeyPair.of(clientCert.privateKey(), clientCert.certificate());
+        final ClientTlsConfig tlsConfig =
+                ClientTlsConfig.builder()
+                               .tlsCustomizer(b -> b.trustManager(serverCert.certificate()))
+                               .build();
+        return ClientFactory.builder()
+                             .tlsProvider(TlsProvider.of(tlsKeyPair), tlsConfig)
+                             .build();
+    }
+
     private static void configureWebClientBuilder(WebClientBuilder builder) {
-        final TlsKeyPair tlsKeyPair = TlsKeyPair.of(clientCert.privateKey(),
-                                                    clientCert.certificate());
-        final ClientTlsConfig tlsConfig =
-                ClientTlsConfig.builder()
-                               .tlsCustomizer(b -> b.trustManager(serverCert.certificate()))
-                               .build();
-        builder.factory(ClientFactory.builder()
-                                     .tlsProvider(TlsProvider.of(tlsKeyPair), tlsConfig)
-                                     .build());
+        builder.factory(tlsClientFactory());
     }

     private static WebClient webClient() {
-        final TlsKeyPair tlsKeyPair = TlsKeyPair.of(clientCert.privateKey(),
-                                                    clientCert.certificate());
-        final ClientTlsConfig tlsConfig =
-                ClientTlsConfig.builder()
-                               .tlsCustomizer(b -> b.trustManager(serverCert.certificate()))
-                               .build();
         return WebClient.builder("https://127.0.0.1:" + dogma.serverAddress().getPort())
-                        .factory(ClientFactory.builder()
-                                              .tlsProvider(TlsProvider.of(tlsKeyPair), tlsConfig)
-                                              .build())
+                        .factory(tlsClientFactory())
                         .build();
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceMtlsTest.java`
around lines 141 - 165, The TLS client setup is duplicated between
configureWebClientBuilder and webClient, which can drift if cert wiring changes.
Extract the shared TlsKeyPair and ClientTlsConfig construction into a single
helper used by both methods, then have each method only apply that shared TLS
configuration through ClientFactory/TlsProvider.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceMtlsTest.java`:
- Around line 141-165: The TLS client setup is duplicated between
configureWebClientBuilder and webClient, which can drift if cert wiring changes.
Extract the shared TlsKeyPair and ClientTlsConfig construction into a single
helper used by both methods, then have each method only apply that shared TLS
configuration through ClientFactory/TlsProvider.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ba98a828-76ee-4e4a-836b-638bfe2b7955

📥 Commits

Reviewing files that changed from the base of the PR and between fd24349 and b6f9119.

📒 Files selected for processing (18)
  • build.gradle
  • client/java-armeria-xds/build.gradle
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/CentralDogmaSotwConfigSourceSubscriptionFactory.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/PreprocessorBasedCentralDogma.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/ResourcePath.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/package-info.java
  • client/java-armeria-xds/src/main/resources/META-INF/services/com.linecorp.armeria.xds.configsource.SotwConfigSourceSubscriptionFactory
  • dependencies.toml
  • it/xds-client/build.gradle
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceBearerTokenTest.java
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceMtlsTest.java
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTemplateTest.java
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTest.java
  • server/src/main/java/com/linecorp/centraldogma/server/internal/api/variable/Templater.java
  • server/src/main/java/com/linecorp/centraldogma/server/internal/api/variable/ToJsonMethod.java
  • settings.gradle
  • xds-api/build.gradle
  • xds-api/src/main/proto/com/github/xds/centraldogma/v1/centraldogma_config_source.proto
✅ Files skipped from review due to trivial changes (2)
  • build.gradle
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/package-info.java
🚧 Files skipped from review as they are similar to previous changes (13)
  • xds-api/build.gradle
  • dependencies.toml
  • client/java-armeria-xds/build.gradle
  • it/xds-client/build.gradle
  • server/src/main/java/com/linecorp/centraldogma/server/internal/api/variable/ToJsonMethod.java
  • settings.gradle
  • client/java-armeria-xds/src/main/resources/META-INF/services/com.linecorp.armeria.xds.configsource.SotwConfigSourceSubscriptionFactory
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/PreprocessorBasedCentralDogma.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/ResourcePath.java
  • server/src/main/java/com/linecorp/centraldogma/server/internal/api/variable/Templater.java
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTest.java
  • it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTemplateTest.java
  • client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/CentralDogmaSotwConfigSourceSubscriptionFactory.java

@jrhee17 jrhee17 modified the milestones: 0.85.0, 0.86.0 Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants