Skip to content

Commit 69517b4

Browse files
committed
update
1 parent b6f9119 commit 69517b4

10 files changed

Lines changed: 115 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2026 LY Corporation
3+
*
4+
* LY Corporation licenses this file to you under the Apache License,
5+
* version 2.0 (the "License"); you may not use this file except in compliance
6+
* with the License. You may obtain a copy of the License at:
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations
14+
* under the License.
15+
*/
16+
package com.linecorp.centraldogma.client.armeria.xds.configsource;
17+
18+
import com.linecorp.armeria.xds.XdsExtensionFactory;
19+
import com.linecorp.armeria.xds.XdsExtensionFactoryProvider;
20+
21+
/**
22+
* An {@link XdsExtensionFactoryProvider} that provides a
23+
* {@link CentralDogmaSotwConfigSourceSubscriptionFactory}.
24+
*/
25+
public final class CentralDogmaExtensionFactoryProvider implements XdsExtensionFactoryProvider {
26+
27+
@Override
28+
public XdsExtensionFactory newFactory() {
29+
return new CentralDogmaSotwConfigSourceSubscriptionFactory();
30+
}
31+
}

client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/configsource/CentralDogmaSotwConfigSourceSubscriptionFactory.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
import com.fasterxml.jackson.databind.JsonNode;
2727
import com.fasterxml.jackson.databind.node.ObjectNode;
28-
import com.github.xds.centraldogma.v1.CentralDogmaConfigSource;
2928
import com.google.common.collect.ImmutableList;
3029
import com.google.common.collect.ImmutableMap;
3130
import com.google.protobuf.Any;
@@ -48,21 +47,19 @@
4847
import com.linecorp.centraldogma.common.Query;
4948
import com.linecorp.centraldogma.internal.CsrfToken;
5049
import com.linecorp.centraldogma.internal.Jackson;
50+
import com.linecorp.centraldogma.xds.v1.CentralDogmaConfigSource;
5151

5252
import io.envoyproxy.envoy.config.core.v3.ConfigSource;
5353
import io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.SdsSecretConfig;
5454
import io.envoyproxy.envoy.service.discovery.v3.DiscoveryResponse;
5555
import io.netty.util.concurrent.EventExecutor;
5656

57-
/**
58-
* A {@link SotwConfigSourceSubscriptionFactory} that fetches xDS resources from Central Dogma.
59-
*/
60-
public final class CentralDogmaSotwConfigSourceSubscriptionFactory
57+
final class CentralDogmaSotwConfigSourceSubscriptionFactory
6158
implements SotwConfigSourceSubscriptionFactory {
6259

6360
static final String NAME = "centraldogma.config_source";
6461
static final String TYPE_URL =
65-
"type.googleapis.com/com.github.xds.centraldogma.v1.CentralDogmaConfigSource";
62+
"type.googleapis.com/com.linecorp.centraldogma.xds.v1.CentralDogmaConfigSource";
6663

6764
@Override
6865
public String name() {
@@ -80,7 +77,8 @@ public SnapshotStream<DiscoveryResponse> create(ConfigSource configSource,
8077
SnapshotStream<InterestedResources> interestedResources) {
8178
final CentralDogmaConfigSource cdConfig =
8279
factoryContext.validator().unpack(
83-
configSource.getCustomConfigSource(), CentralDogmaConfigSource.class);
80+
configSource.getCustomConfigSource().getTypedConfig(),
81+
CentralDogmaConfigSource.class);
8482
checkArgument(!cdConfig.getClusterName().isEmpty(),
8583
"CentralDogmaConfigSource.cluster_name must not be empty");
8684
final SnapshotStream<ClusterSnapshot> clusterStream =
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2026 LY Corporation
3+
*
4+
* LY Corporation licenses this file to you under the Apache License,
5+
* version 2.0 (the "License"); you may not use this file except in compliance
6+
* with the License. You may obtain a copy of the License at:
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations
14+
* under the License.
15+
*/
16+
package com.linecorp.centraldogma.client.armeria.xds.configsource;
17+
18+
import java.util.List;
19+
20+
import com.linecorp.armeria.xds.XdsTypeRegistryPackageProvider;
21+
22+
/**
23+
* An {@link XdsTypeRegistryPackageProvider} that registers the Central Dogma xDS protobuf types.
24+
*/
25+
public final class CentralDogmaTypeRegistryPackageProvider implements XdsTypeRegistryPackageProvider {
26+
27+
@Override
28+
public Iterable<String> packages() {
29+
return List.of("com.linecorp.centraldogma.xds");
30+
}
31+
}

client/java-armeria-xds/src/main/resources/META-INF/services/com.linecorp.armeria.xds.configsource.SotwConfigSourceSubscriptionFactory renamed to client/java-armeria-xds/src/main/resources/META-INF/services/com.linecorp.armeria.xds.XdsExtensionFactoryProvider

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
com.linecorp.centraldogma.client.armeria.xds.configsource.CentralDogmaSotwConfigSourceSubscriptionFactory
1+
com.linecorp.centraldogma.client.armeria.xds.configsource.CentralDogmaExtensionFactoryProvider
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
com.linecorp.centraldogma.client.armeria.xds.configsource.CentralDogmaTypeRegistryPackageProvider

it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceBearerTokenTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,14 @@ void fetchClusterWithBearerToken() {
123123
dynamic_resources:
124124
cds_config:
125125
custom_config_source:
126-
"@type": type.googleapis.com/com.github.xds\
127-
.centraldogma.v1.CentralDogmaConfigSource
128-
cluster_name: centraldogma-server
129-
bearer_token_credential:
130-
token_secret:
131-
name: centraldogma_token
126+
name: centraldogma.config_source
127+
typed_config:
128+
"@type": type.googleapis.com/com.linecorp.centraldogma\
129+
.xds.v1.CentralDogmaConfigSource
130+
cluster_name: centraldogma-server
131+
bearer_token_credential:
132+
token_secret:
133+
name: centraldogma_token
132134
""".formatted(port, appToken);
133135

134136
final Bootstrap bootstrap = XdsResourceReader.from(yaml, Bootstrap.class);

it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceMtlsTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,11 @@ void fetchClusterWithMtls() throws Exception {
219219
dynamic_resources:
220220
cds_config:
221221
custom_config_source:
222-
"@type": type.googleapis.com/com.github.xds\
223-
.centraldogma.v1.CentralDogmaConfigSource
224-
cluster_name: centraldogma-server
222+
name: centraldogma.config_source
223+
typed_config:
224+
"@type": type.googleapis.com/com.linecorp.centraldogma\
225+
.xds.v1.CentralDogmaConfigSource
226+
cluster_name: centraldogma-server
225227
""".formatted(port,
226228
clientCert.certificateFile().getAbsolutePath(),
227229
clientCert.privateKeyFile().getAbsolutePath(),

it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTemplateTest.java

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@ class CentralDogmaConfigSourceTemplateTest {
5757
"service_name": "${vars.service_name}",
5858
"eds_config": {
5959
"custom_config_source": {
60-
"@type": "type.googleapis.com/com.github.xds\
61-
.centraldogma.v1.CentralDogmaConfigSource",
62-
"cluster_name": "centraldogma-server"
60+
"name": "centraldogma.config_source",
61+
"typed_config": {
62+
"@type": "type.googleapis.com/com.linecorp.centraldogma\
63+
.xds.v1.CentralDogmaConfigSource",
64+
"cluster_name": "centraldogma-server"
65+
}
6366
}
6467
}
6568
}<#list vars as key, value><#if key != "service_name">,
@@ -109,9 +112,11 @@ class CentralDogmaConfigSourceTemplateTest {
109112
service_name: ${vars.service_name}
110113
eds_config:
111114
custom_config_source:
112-
"@type": type.googleapis.com/com.github.xds\
113-
.centraldogma.v1.CentralDogmaConfigSource
114-
cluster_name: centraldogma-server
115+
name: centraldogma.config_source
116+
typed_config:
117+
"@type": type.googleapis.com/com.linecorp.centraldogma\
118+
.xds.v1.CentralDogmaConfigSource
119+
cluster_name: centraldogma-server
115120
<#list vars as key, value><#if key != "service_name">
116121
${key}: ${toJson(value)}
117122
</#if></#list>
@@ -235,14 +240,18 @@ private static String bootstrapYaml() {
235240
dynamic_resources:
236241
cds_config:
237242
custom_config_source:
238-
"@type": type.googleapis.com/com.github.xds\
239-
.centraldogma.v1.CentralDogmaConfigSource
240-
cluster_name: centraldogma-server
243+
name: centraldogma.config_source
244+
typed_config:
245+
"@type": type.googleapis.com/com.linecorp.centraldogma\
246+
.xds.v1.CentralDogmaConfigSource
247+
cluster_name: centraldogma-server
241248
lds_config:
242249
custom_config_source:
243-
"@type": type.googleapis.com/com.github.xds\
244-
.centraldogma.v1.CentralDogmaConfigSource
245-
cluster_name: centraldogma-server
250+
name: centraldogma.config_source
251+
typed_config:
252+
"@type": type.googleapis.com/com.linecorp.centraldogma\
253+
.xds.v1.CentralDogmaConfigSource
254+
cluster_name: centraldogma-server
246255
""".formatted(port);
247256
}
248257

it/xds-client/src/test/java/com/linecorp/centraldogma/xds/it/CentralDogmaConfigSourceTest.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,18 @@ private static String bootstrapYaml() {
229229
dynamic_resources:
230230
cds_config:
231231
custom_config_source:
232-
"@type": type.googleapis.com/com.github.xds\
233-
.centraldogma.v1.CentralDogmaConfigSource
234-
cluster_name: centraldogma-server
232+
name: centraldogma.config_source
233+
typed_config:
234+
"@type": type.googleapis.com/com.linecorp.centraldogma\
235+
.xds.v1.CentralDogmaConfigSource
236+
cluster_name: centraldogma-server
235237
lds_config:
236238
custom_config_source:
237-
"@type": type.googleapis.com/com.github.xds\
238-
.centraldogma.v1.CentralDogmaConfigSource
239-
cluster_name: centraldogma-server
239+
name: centraldogma.config_source
240+
typed_config:
241+
"@type": type.googleapis.com/com.linecorp.centraldogma\
242+
.xds.v1.CentralDogmaConfigSource
243+
cluster_name: centraldogma-server
240244
""".formatted(port);
241245
}
242246

xds-api/src/main/proto/com/github/xds/centraldogma/v1/centraldogma_config_source.proto renamed to xds-api/src/main/proto/centraldogma_config_source.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
// under the License.
1414
syntax = "proto3";
1515

16-
package com.github.xds.centraldogma.v1;
16+
package com.linecorp.centraldogma.xds.v1;
1717

1818
import "envoy/extensions/transport_sockets/tls/v3/secret.proto";
1919

2020
option java_multiple_files = true;
2121
option java_outer_classname = "CentralDogmaConfigSourceProto";
22-
option java_package = "com.github.xds.centraldogma.v1";
22+
option java_package = "com.linecorp.centraldogma.xds.v1";
2323

2424
// Configuration for a Central Dogma-backed xDS config source.
2525
//

0 commit comments

Comments
 (0)