Skip to content

Commit a3aed17

Browse files
Implemented possibility for configuring traffic splitting, and fallback using aggregate cluster| fixed tests #292
1 parent 919cff0 commit a3aed17

File tree

12 files changed

+81
-82
lines changed

12 files changed

+81
-82
lines changed

envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/EnvoySnapshotFactory.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class EnvoySnapshotFactory(
168168
clusterName = it.getClusterName(),
169169
routeDomains = listOf(it.getRouteDomain()),
170170
settings = it.settings,
171-
clusterWeights = ClusterWeights()
171+
clusterWeights = mapOf()
172172
)
173173
}
174174
)
@@ -179,7 +179,7 @@ class EnvoySnapshotFactory(
179179
clusterName = properties.dynamicForwardProxy.clusterName,
180180
routeDomains = group.proxySettings.outgoing.getDomainPatternDependencies().map { it.domainPattern },
181181
settings = group.proxySettings.outgoing.defaultServiceSettings,
182-
clusterWeights = ClusterWeights()
182+
clusterWeights = mapOf()
183183
)
184184
}
185185

@@ -218,13 +218,13 @@ class EnvoySnapshotFactory(
218218
serviceName: String,
219219
globalSnapshot: GlobalSnapshot,
220220
dependencyServiceName: String
221-
): ClusterWeights {
221+
): Map<String, Int> {
222222
val trafficSplitting = properties.loadBalancing.trafficSplitting
223-
val weights = trafficSplitting.serviceByWeightsProperties[serviceName]
223+
val weights = trafficSplitting.serviceByWeightsProperties[serviceName] ?: mapOf()
224224
val enabledForDependency = globalSnapshot.endpoints[dependencyServiceName]?.endpointsList
225225
?.any { e -> trafficSplitting.zoneName == e.locality.zone }
226226
?: false
227-
return if (enabledForDependency && weights != null) weights else ClusterWeights()
227+
return if (enabledForDependency) weights else mapOf()
228228
}
229229

230230
private fun getServiceWithCustomDomain(it: String): List<String> {
@@ -400,5 +400,5 @@ class RouteSpecification(
400400
val clusterName: String,
401401
val routeDomains: List<String>,
402402
val settings: DependencySettings,
403-
val clusterWeights: ClusterWeights = ClusterWeights()
403+
val clusterWeights: Map<String, Int> = mapOf()
404404
)

envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/SnapshotProperties.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,7 @@ class CanaryProperties {
157157

158158
class TrafficSplittingProperties {
159159
var zoneName = ""
160-
var serviceByWeightsProperties: Map<String, ClusterWeights> = mapOf()
161-
}
162-
163-
class ClusterWeights {
164-
var mainClusterWeight: Int = 0
165-
var secondaryClusterWeight: Int = 0
160+
var serviceByWeightsProperties: Map<String, Map<String, Int>> = mapOf()
166161
}
167162

168163
class LoadBalancingWeightsProperties {

envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/resource/clusters/EnvoyClustersFactory.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ class EnvoyClustersFactory(
8181
const val SECONDARY_CLUSTER_POSTFIX = "secondary"
8282
const val AGGREGATE_CLUSTER_POSTFIX = "aggregate"
8383

84+
@JvmStatic
8485
fun getSecondaryClusterName(serviceName: String): String {
8586
return "$serviceName-$SECONDARY_CLUSTER_POSTFIX"
8687
}
8788

89+
@JvmStatic
8890
fun getAggregateClusterName(serviceName: String): String {
8991
return "$serviceName-$AGGREGATE_CLUSTER_POSTFIX"
9092
}
@@ -266,7 +268,7 @@ class EnvoyClustersFactory(
266268
getSecondaryClusterName(cluster.name)
267269
)
268270
val aggregateCluster =
269-
createAggregateCluster(mainCluster.name, listOf(secondaryCluster.name, mainCluster.name))
271+
createAggregateCluster(mainCluster.name, linkedSetOf(secondaryCluster.name, mainCluster.name))
270272
return listOf(mainCluster, secondaryCluster, aggregateCluster)
271273
.also { logger.debug("Created traffic splitting clusters: {}", it) }
272274
}

envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/resource/endpoints/EnvoyEndpointsFactory.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class EnvoyEndpointsFactory(
8181
egressRouteSpecifications: Collection<RouteSpecification>
8282
): List<ClusterLoadAssignment> {
8383
return egressRouteSpecifications
84-
.filter { it.clusterWeights.mainClusterWeight > 0 && it.clusterWeights.secondaryClusterWeight > 0 }
84+
.filter { it.clusterWeights.isNotEmpty() }
8585
.onEach { logger.debug("Traffic splitting is enabled for cluster: ${it.clusterName}") }
8686
.mapNotNull { routeSpec ->
8787
clusterLoadAssignments[routeSpec.clusterName]?.let { assignment ->

envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/resource/routes/EnvoyEgressRoutesFactory.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,23 +345,21 @@ class EnvoyEgressRoutesFactory(
345345
}
346346

347347
private fun RouteAction.Builder.setCluster(routeSpec: RouteSpecification): RouteAction.Builder {
348-
val clusterWeights = routeSpec.clusterWeights
349-
val hasWeightsConfig = clusterWeights.mainClusterWeight > 0 &&
350-
clusterWeights.secondaryClusterWeight > 0
348+
val hasWeightsConfig = routeSpec.clusterWeights.keys.containsAll(listOf("main", "secondary"))
351349
return if (!hasWeightsConfig) {
352350
this.setCluster(routeSpec.clusterName)
353351
} else {
354352
logger.debug(
355353
"Creating weighted cluster configuration for route spec {}, {}",
356354
routeSpec.clusterName,
357-
clusterWeights
355+
routeSpec.clusterWeights
358356
)
359357
this.setWeightedClusters(
360358
WeightedCluster.newBuilder()
361-
.withClusterWeight(routeSpec.clusterName, clusterWeights.mainClusterWeight)
359+
.withClusterWeight(routeSpec.clusterName, routeSpec.clusterWeights["main"]!!)
362360
.withClusterWeight(
363361
getSecondaryClusterName(routeSpec.clusterName),
364-
clusterWeights.secondaryClusterWeight
362+
routeSpec.clusterWeights["secondary"]!!
365363
)
366364
)
367365
}

envoy-control-core/src/test/kotlin/pl/allegro/tech/servicemesh/envoycontrol/EnvoySnapshotFactoryTest.kt

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -33,35 +33,35 @@ import pl.allegro.tech.servicemesh.envoycontrol.snapshot.resource.routes.EnvoyEg
3333
import pl.allegro.tech.servicemesh.envoycontrol.snapshot.resource.routes.EnvoyIngressRoutesFactory
3434
import pl.allegro.tech.servicemesh.envoycontrol.snapshot.resource.routes.ServiceTagMetadataGenerator
3535
import pl.allegro.tech.servicemesh.envoycontrol.snapshot.serviceDependencies
36-
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.AGGREGATE_CLUSTER_NAME
37-
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.CLUSTER_NAME1
38-
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.CLUSTER_NAME2
36+
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.CLUSTER_NAME
37+
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.CURRENT_ZONE
3938
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.DEFAULT_CLUSTER_WEIGHTS
4039
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.DEFAULT_DISCOVERY_SERVICE_NAME
40+
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.DEFAULT_IDLE_TIMEOUT
4141
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.DEFAULT_SERVICE_NAME
4242
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.EGRESS_HOST
4343
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.EGRESS_PORT
4444
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.INGRESS_HOST
4545
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.INGRESS_PORT
46-
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.MAIN_CLUSTER_NAME
47-
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.SECONDARY_CLUSTER_NAME
46+
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.TRAFFIC_SPLITTING_FORCE_TRAFFIC_ZONE
4847
import pl.allegro.tech.servicemesh.envoycontrol.utils.createCluster
4948
import pl.allegro.tech.servicemesh.envoycontrol.utils.createClusterConfigurations
50-
import pl.allegro.tech.servicemesh.envoycontrol.utils.createLoadAssignments
49+
import pl.allegro.tech.servicemesh.envoycontrol.utils.createEndpoints
5150

5251
class EnvoySnapshotFactoryTest {
5352
companion object {
54-
const val CLUSTER_NAME = "cluster-name"
55-
const val DEFAULT_IDLE_TIMEOUT = 100L
56-
const val CURRENT_ZONE = "dc1"
57-
const val FORCE_TRAFFIC_ZONE = "dc2"
53+
const val MAIN_CLUSTER_NAME = "service-name-2"
54+
const val SECONDARY_CLUSTER_NAME = "service-name-2-secondary"
55+
const val AGGREGATE_CLUSTER_NAME = "service-name-2-aggregate"
56+
const val SERVICE_NAME_2 = "service-name-2"
5857
}
5958

59+
private val defaultClusterWeights = mapOf("main" to 50, "secondary" to 50)
6060
private val snapshotPropertiesWithWeights = SnapshotProperties().also {
6161
it.loadBalancing.trafficSplitting.serviceByWeightsProperties = mapOf(
6262
DEFAULT_SERVICE_NAME to DEFAULT_CLUSTER_WEIGHTS
6363
)
64-
it.loadBalancing.trafficSplitting.zoneName = FORCE_TRAFFIC_ZONE
64+
it.loadBalancing.trafficSplitting.zoneName = TRAFFIC_SPLITTING_FORCE_TRAFFIC_ZONE
6565
}
6666

6767
@Test
@@ -230,13 +230,14 @@ class EnvoySnapshotFactoryTest {
230230
}
231231

232232
@Test
233-
fun `should create traffic splitting configuration`() {
233+
fun `should create weighted snapshot clusters`() {
234234
// given
235235
val envoySnapshotFactory = createSnapshotFactory(snapshotPropertiesWithWeights)
236-
val cluster1 = createCluster(snapshotPropertiesWithWeights, clusterName = CLUSTER_NAME1)
237-
val cluster2 = createCluster(snapshotPropertiesWithWeights, clusterName = CLUSTER_NAME2)
236+
val cluster1 = createCluster(snapshotPropertiesWithWeights, clusterName = DEFAULT_SERVICE_NAME)
237+
val cluster2 =
238+
createCluster(snapshotPropertiesWithWeights, clusterName = SERVICE_NAME_2)
238239
val group: Group = createServicesGroup(
239-
dependencies = arrayOf(cluster1.name to null),
240+
dependencies = arrayOf(cluster2.name to null),
240241
snapshotProperties = snapshotPropertiesWithWeights
241242
)
242243
val globalSnapshot = createGlobalSnapshot(cluster1, cluster2)
@@ -254,29 +255,30 @@ class EnvoySnapshotFactoryTest {
254255
assertThat(it.clusterName).isEqualTo(MAIN_CLUSTER_NAME)
255256
assertThat(it.endpointsList)
256257
.anyMatch { e -> e.locality.zone == CURRENT_ZONE }
257-
.anyMatch { e -> e.locality.zone == FORCE_TRAFFIC_ZONE }
258+
.anyMatch { e -> e.locality.zone == TRAFFIC_SPLITTING_FORCE_TRAFFIC_ZONE }
258259
}
259260
.anySatisfy {
260261
assertThat(it.clusterName).isEqualTo(SECONDARY_CLUSTER_NAME)
261262
assertThat(it.endpointsList)
262-
.allMatch { e -> e.locality.zone == FORCE_TRAFFIC_ZONE }
263+
.allMatch { e -> e.locality.zone == TRAFFIC_SPLITTING_FORCE_TRAFFIC_ZONE }
263264
}
264265
}
265266

266267
@Test
267-
fun `should not create traffic splitting configuration when zone condition isn't complied`() {
268+
fun `should get regular snapshot clusters when traffic splitting zone condition isn't complied`() {
268269
// given
269270
val defaultProperties = SnapshotProperties().also {
271+
it.dynamicListeners.enabled = false
270272
it.loadBalancing.trafficSplitting.serviceByWeightsProperties = mapOf(
271-
DEFAULT_SERVICE_NAME to DEFAULT_CLUSTER_WEIGHTS
273+
DEFAULT_SERVICE_NAME to defaultClusterWeights
272274
)
273275
it.loadBalancing.trafficSplitting.zoneName = "not-matching-dc"
274276
}
275277
val envoySnapshotFactory = createSnapshotFactory(defaultProperties)
276-
val cluster1 = createCluster(defaultProperties, clusterName = CLUSTER_NAME1)
277-
val cluster2 = createCluster(defaultProperties, clusterName = CLUSTER_NAME2)
278+
val cluster1 = createCluster(defaultProperties, clusterName = DEFAULT_SERVICE_NAME)
279+
val cluster2 = createCluster(defaultProperties, clusterName = SERVICE_NAME_2)
278280
val group: Group = createServicesGroup(
279-
dependencies = arrayOf(cluster1.name to null),
281+
dependencies = arrayOf(cluster2.name to null),
280282
snapshotProperties = defaultProperties
281283
)
282284
val globalSnapshot = createGlobalSnapshot(cluster1, cluster2)
@@ -292,11 +294,11 @@ class EnvoySnapshotFactoryTest {
292294
}
293295

294296
@Test
295-
fun `should create traffic splitting configuration for wildcard dependencies`() {
297+
fun `should create weighted snapshot clusters for wildcard dependencies`() {
296298
// given
297299
val envoySnapshotFactory = createSnapshotFactory(snapshotPropertiesWithWeights)
298-
val cluster1 = createCluster(snapshotPropertiesWithWeights, clusterName = CLUSTER_NAME1)
299-
val cluster2 = createCluster(snapshotPropertiesWithWeights, clusterName = CLUSTER_NAME2)
300+
val cluster1 = createCluster(snapshotPropertiesWithWeights, clusterName = DEFAULT_SERVICE_NAME)
301+
val cluster2 = createCluster(snapshotPropertiesWithWeights, clusterName = SERVICE_NAME_2)
300302
val wildcardTimeoutPolicy = outgoingTimeoutPolicy(connectionIdleTimeout = 12)
301303

302304
val group: Group = createAllServicesGroup(
@@ -311,14 +313,9 @@ class EnvoySnapshotFactoryTest {
311313

312314
// then
313315
assertThat(snapshot.clusters().resources())
314-
.containsKeys(
315-
MAIN_CLUSTER_NAME,
316-
SECONDARY_CLUSTER_NAME,
317-
AGGREGATE_CLUSTER_NAME,
318-
CLUSTER_NAME2,
319-
"cluster-2-secondary",
320-
"cluster-2-aggregate"
321-
)
316+
.containsKey(MAIN_CLUSTER_NAME)
317+
.containsKey(SECONDARY_CLUSTER_NAME)
318+
.containsKey(AGGREGATE_CLUSTER_NAME)
322319
}
323320

324321
@Test
@@ -477,17 +474,23 @@ class EnvoySnapshotFactoryTest {
477474
)
478475
}
479476

480-
private fun createGlobalSnapshot(
481-
vararg clusters: Cluster,
482-
securedClusters: List<Cluster> = clusters.asList()
483-
): GlobalSnapshot {
477+
private fun createGlobalSnapshot(vararg clusters: Cluster): GlobalSnapshot {
484478
return GlobalSnapshot(
485479
SnapshotResources.create<Cluster>(clusters.toList(), "pl/allegro/tech/servicemesh/envoycontrol/v3")
486480
.resources(),
487481
clusters.map { it.name }.toSet(),
488482
SnapshotResources.create<ClusterLoadAssignment>(createLoadAssignments(clusters.toList()), "v1").resources(),
489483
createClusterConfigurations(),
490-
SnapshotResources.create<Cluster>(securedClusters, "v3").resources()
484+
SnapshotResources.create<Cluster>(clusters.toList(), "v3").resources()
491485
)
492486
}
487+
488+
private fun createLoadAssignments(clusters: List<Cluster>): List<ClusterLoadAssignment> {
489+
return clusters.map {
490+
ClusterLoadAssignment.newBuilder()
491+
.setClusterName(it.name)
492+
.addAllEndpoints(createEndpoints())
493+
.build()
494+
}
495+
}
493496
}

envoy-control-core/src/test/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/resource/clusters/EnvoyClustersFactoryTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import org.junit.jupiter.api.Test
88
import pl.allegro.tech.servicemesh.envoycontrol.groups.DependencySettings
99
import pl.allegro.tech.servicemesh.envoycontrol.snapshot.GlobalSnapshot
1010
import pl.allegro.tech.servicemesh.envoycontrol.snapshot.SnapshotProperties
11+
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData
1112
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.AGGREGATE_CLUSTER_NAME
1213
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.CLUSTER_NAME1
1314
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.CLUSTER_NAME2
14-
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.DEFAULT_CLUSTER_WEIGHTS
1515
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.DEFAULT_SERVICE_NAME
1616
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.MAIN_CLUSTER_NAME
1717
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.SECONDARY_CLUSTER_NAME
@@ -29,7 +29,7 @@ internal class EnvoyClustersFactoryTest {
2929
private val factory = EnvoyClustersFactory(SnapshotProperties())
3030
private val snapshotPropertiesWithWeights = SnapshotProperties().apply {
3131
loadBalancing.trafficSplitting.serviceByWeightsProperties = mapOf(
32-
DEFAULT_SERVICE_NAME to DEFAULT_CLUSTER_WEIGHTS
32+
DEFAULT_SERVICE_NAME to TestData.DEFAULT_CLUSTER_WEIGHTS
3333
)
3434
loadBalancing.trafficSplitting.zoneName = TRAFFIC_SPLITTING_FORCE_TRAFFIC_ZONE
3535
}

envoy-control-core/src/test/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/resource/endpoints/EnvoyEndpointsFactoryTest.kt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import pl.allegro.tech.servicemesh.envoycontrol.services.ServiceInstance
1717
import pl.allegro.tech.servicemesh.envoycontrol.services.ServiceInstances
1818
import pl.allegro.tech.servicemesh.envoycontrol.services.ServiceName
1919
import pl.allegro.tech.servicemesh.envoycontrol.services.ServicesState
20-
import pl.allegro.tech.servicemesh.envoycontrol.snapshot.ClusterWeights
2120
import pl.allegro.tech.servicemesh.envoycontrol.snapshot.LoadBalancingPriorityProperties
2221
import pl.allegro.tech.servicemesh.envoycontrol.snapshot.LoadBalancingProperties
2322
import pl.allegro.tech.servicemesh.envoycontrol.snapshot.RouteSpecification
@@ -55,14 +54,11 @@ internal class EnvoyEndpointsFactoryTest {
5554

5655
private val serviceName = "service-one"
5756

58-
private val serviceName2 = "service-two"
59-
6057
private val secondaryClusterName = "service-one-secondary"
6158

62-
private val defaultWeights = ClusterWeights().apply {
63-
mainClusterWeight = 50
64-
secondaryClusterWeight = 50
65-
}
59+
private val serviceName2 = "service-two"
60+
61+
private val defaultWeights = mapOf("main" to 50, "secondary" to 50)
6662

6763
private val defaultZone = "DC1"
6864

@@ -541,7 +537,7 @@ internal class EnvoyEndpointsFactoryTest {
541537
}
542538

543539
private fun snapshotPropertiesWithTrafficSplitting(
544-
serviceByWeights: Map<String, ClusterWeights>,
540+
serviceByWeights: Map<String, Map<String, Int>>,
545541
zone: String = defaultZone
546542
) =
547543
SnapshotProperties().apply {
@@ -551,7 +547,7 @@ internal class EnvoyEndpointsFactoryTest {
551547
}
552548
}
553549

554-
private fun String.toRouteSpecification(weights: ClusterWeights = defaultWeights): RouteSpecification {
550+
private fun String.toRouteSpecification(weights: Map<String, Int> = defaultWeights): RouteSpecification {
555551
return RouteSpecification(this, listOf(), DependencySettings(), weights)
556552
}
557553

envoy-control-core/src/test/kotlin/pl/allegro/tech/servicemesh/envoycontrol/utils/ClusterOperations.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ import io.envoyproxy.envoy.config.cluster.v3.Cluster
66
import io.envoyproxy.envoy.config.core.v3.AggregatedConfigSource
77
import io.envoyproxy.envoy.config.core.v3.ConfigSource
88
import io.envoyproxy.envoy.config.core.v3.HttpProtocolOptions
9-
import pl.allegro.tech.servicemesh.envoycontrol.EnvoySnapshotFactoryTest.Companion.CLUSTER_NAME
10-
import pl.allegro.tech.servicemesh.envoycontrol.EnvoySnapshotFactoryTest.Companion.DEFAULT_IDLE_TIMEOUT
119
import pl.allegro.tech.servicemesh.envoycontrol.snapshot.ClusterConfiguration
1210
import pl.allegro.tech.servicemesh.envoycontrol.snapshot.SnapshotProperties
11+
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.CLUSTER_NAME
1312

1413
fun createCluster(
1514
defaultProperties: SnapshotProperties = SnapshotProperties(),
1615
clusterName: String = CLUSTER_NAME,
17-
idleTimeout: Long = DEFAULT_IDLE_TIMEOUT
16+
idleTimeout: Long = TestData.DEFAULT_IDLE_TIMEOUT
1817
): Cluster {
1918
return Cluster.newBuilder().setName(clusterName)
2019
.setType(Cluster.DiscoveryType.EDS)

envoy-control-core/src/test/kotlin/pl/allegro/tech/servicemesh/envoycontrol/utils/EndpointsOperations.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import io.envoyproxy.envoy.config.cluster.v3.Cluster
44
import io.envoyproxy.envoy.config.endpoint.v3.ClusterLoadAssignment
55
import io.envoyproxy.envoy.config.endpoint.v3.LbEndpoint
66
import io.envoyproxy.envoy.config.endpoint.v3.LocalityLbEndpoints
7-
import pl.allegro.tech.servicemesh.envoycontrol.EnvoySnapshotFactoryTest
7+
import pl.allegro.tech.servicemesh.envoycontrol.utils.TestData.CURRENT_ZONE
88

99
fun createLoadAssignments(clusters: List<Cluster>): List<ClusterLoadAssignment> {
1010
return clusters.map {
@@ -17,8 +17,8 @@ fun createLoadAssignments(clusters: List<Cluster>): List<ClusterLoadAssignment>
1717

1818
fun createEndpoints(): List<LocalityLbEndpoints> =
1919
listOf(
20-
createEndpoint(EnvoySnapshotFactoryTest.CURRENT_ZONE),
21-
createEndpoint(EnvoySnapshotFactoryTest.FORCE_TRAFFIC_ZONE)
20+
createEndpoint(CURRENT_ZONE),
21+
createEndpoint(TestData.TRAFFIC_SPLITTING_FORCE_TRAFFIC_ZONE)
2222
)
2323

2424
fun createEndpoint(zone: String): LocalityLbEndpoints {

0 commit comments

Comments
 (0)