From 543e7627807bb48d05e2b851de8ef54ab48fe18a Mon Sep 17 00:00:00 2001 From: jrhee17 Date: Thu, 22 Aug 2024 16:52:07 +0900 Subject: [PATCH] accept local cluster instead of service name --- .../armeria/xds/XdsCentralDogmaBuilder.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/XdsCentralDogmaBuilder.java b/client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/XdsCentralDogmaBuilder.java index 93b5c9d97d..6f464b2a8a 100644 --- a/client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/XdsCentralDogmaBuilder.java +++ b/client/java-armeria-xds/src/main/java/com/linecorp/centraldogma/client/armeria/xds/XdsCentralDogmaBuilder.java @@ -52,6 +52,7 @@ import io.envoyproxy.envoy.config.bootstrap.v3.Bootstrap; import io.envoyproxy.envoy.config.bootstrap.v3.Bootstrap.DynamicResources; import io.envoyproxy.envoy.config.bootstrap.v3.Bootstrap.StaticResources; +import io.envoyproxy.envoy.config.bootstrap.v3.ClusterManager; import io.envoyproxy.envoy.config.cluster.v3.Cluster; import io.envoyproxy.envoy.config.cluster.v3.Cluster.DiscoveryType; import io.envoyproxy.envoy.config.core.v3.Address; @@ -109,7 +110,7 @@ public final class XdsCentralDogmaBuilder extends AbstractCentralDogmaBuilder xdsBootstrapFactory = XdsBootstrap::of; @@ -139,17 +140,17 @@ public XdsCentralDogmaBuilder serviceZone(String serviceZone) { } /** - * Sets the name of the local service cluster which this client will be located in. + * Sets the name of the local cluster name which this client will be located in. * This may be used in applying * zone aware routing * and is analogous to - * service-cluster. - * This value will be set to {@link Node#getCluster()} in the {@link Bootstrap}. + * service-cluster. + * This value will be set to {@link ClusterManager#getLocalClusterName()} in the {@link Bootstrap}. */ @UnstableApi - public XdsCentralDogmaBuilder serviceCluster(String serviceCluster) { - requireNonNull(serviceCluster, "serviceCluster"); - this.serviceCluster = serviceCluster; + public XdsCentralDogmaBuilder localClusterName(String localClusterName) { + requireNonNull(localClusterName, "localClusterName"); + this.localClusterName = localClusterName; return this; } @@ -270,9 +271,10 @@ private XdsBootstrap xdsBootstrap() { DynamicResources.newBuilder().setAdsConfig(apiConfigSource).build(); final Bootstrap bootstrap = Bootstrap.newBuilder() + .setClusterManager(ClusterManager.newBuilder() + .setLocalClusterName(localClusterName)) .setDynamicResources(dynamicResources) .setNode(Node.newBuilder() - .setCluster(serviceCluster) .setLocality(locality)) .setStaticResources(StaticResources.newBuilder().addClusters(bootstrapCluster())) .build();