|
52 | 52 | import io.envoyproxy.envoy.config.bootstrap.v3.Bootstrap;
|
53 | 53 | import io.envoyproxy.envoy.config.bootstrap.v3.Bootstrap.DynamicResources;
|
54 | 54 | import io.envoyproxy.envoy.config.bootstrap.v3.Bootstrap.StaticResources;
|
| 55 | +import io.envoyproxy.envoy.config.bootstrap.v3.ClusterManager; |
55 | 56 | import io.envoyproxy.envoy.config.cluster.v3.Cluster;
|
56 | 57 | import io.envoyproxy.envoy.config.cluster.v3.Cluster.DiscoveryType;
|
57 | 58 | import io.envoyproxy.envoy.config.core.v3.Address;
|
@@ -109,7 +110,7 @@ public final class XdsCentralDogmaBuilder extends AbstractCentralDogmaBuilder<Xd
|
109 | 110 | private String listenerName = DEFAULT_LISTENER_NAME;
|
110 | 111 | private Locality locality = Locality.getDefaultInstance();
|
111 | 112 | // an empty string means no local cluster
|
112 |
| - private String serviceCluster = ""; |
| 113 | + private String localClusterName = ""; |
113 | 114 |
|
114 | 115 | // TODO: @jrhee17 remove this once xDS TLS is fully supported
|
115 | 116 | private Function<Bootstrap, XdsBootstrap> xdsBootstrapFactory = XdsBootstrap::of;
|
@@ -139,17 +140,17 @@ public XdsCentralDogmaBuilder serviceZone(String serviceZone) {
|
139 | 140 | }
|
140 | 141 |
|
141 | 142 | /**
|
142 |
| - * Sets the name of the local service cluster which this client will be located in. |
| 143 | + * Sets the name of the local cluster name which this client will be located in. |
143 | 144 | * This may be used in applying
|
144 | 145 | * <a href="https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/zone_aware">zone aware routing</a>
|
145 | 146 | * and is analogous to
|
146 |
| - * <a href="https://www.envoyproxy.io/docs/envoy/latest/operations/cli#cmdoption-service-cluster">service-cluster</a>. |
147 |
| - * This value will be set to {@link Node#getCluster()} in the {@link Bootstrap}. |
| 147 | + * <a href="https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/bootstrap/v3/bootstrap.proto#envoy-v3-api-field-config-bootstrap-v3-clustermanager-local-cluster-name">service-cluster</a>. |
| 148 | + * This value will be set to {@link ClusterManager#getLocalClusterName()} in the {@link Bootstrap}. |
148 | 149 | */
|
149 | 150 | @UnstableApi
|
150 |
| - public XdsCentralDogmaBuilder serviceCluster(String serviceCluster) { |
151 |
| - requireNonNull(serviceCluster, "serviceCluster"); |
152 |
| - this.serviceCluster = serviceCluster; |
| 151 | + public XdsCentralDogmaBuilder localClusterName(String localClusterName) { |
| 152 | + requireNonNull(localClusterName, "localClusterName"); |
| 153 | + this.localClusterName = localClusterName; |
153 | 154 | return this;
|
154 | 155 | }
|
155 | 156 |
|
@@ -270,9 +271,10 @@ private XdsBootstrap xdsBootstrap() {
|
270 | 271 | DynamicResources.newBuilder().setAdsConfig(apiConfigSource).build();
|
271 | 272 | final Bootstrap bootstrap =
|
272 | 273 | Bootstrap.newBuilder()
|
| 274 | + .setClusterManager(ClusterManager.newBuilder() |
| 275 | + .setLocalClusterName(localClusterName)) |
273 | 276 | .setDynamicResources(dynamicResources)
|
274 | 277 | .setNode(Node.newBuilder()
|
275 |
| - .setCluster(serviceCluster) |
276 | 278 | .setLocality(locality))
|
277 | 279 | .setStaticResources(StaticResources.newBuilder().addClusters(bootstrapCluster()))
|
278 | 280 | .build();
|
|
0 commit comments