Skip to content

Commit b65015c

Browse files
Implemented possibility for configuring traffic splitting, and fallback using aggregate cluster #292
1 parent 2865fb2 commit b65015c

File tree

3 files changed

+5
-30
lines changed

3 files changed

+5
-30
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@ class EnvoyClustersFactory(
266266
): Collection<Cluster> {
267267
return cluster?.let {
268268
if (enableTrafficSplitting(serviceName, cluster.name, dependencies, clusterLoadAssignment)) {
269-
logger.debug("Creating traffic splitting egress cluster config for ${cluster.name}, service: $serviceName")
269+
logger.debug(
270+
"Creating traffic splitting egress cluster config for ${cluster.name}, service: $serviceName")
270271
createSetOfClustersForGroup(dependencySettings, cluster)
271272
} else {
272273
listOf(createClusterForGroup(dependencySettings, cluster))

envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/utils/ClusterNames.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package pl.allegro.tech.servicemesh.envoycontrol.utils
22

3-
import pl.allegro.tech.servicemesh.envoycontrol.utils.ClusterConstants.AGGREGATE_CLUSTER_POSTFIX
4-
import pl.allegro.tech.servicemesh.envoycontrol.utils.ClusterConstants.SECONDARY_CLUSTER_POSTFIX
3+
import pl.allegro.tech.servicemesh.envoycontrol.utils.ClusterNames.AGGREGATE_CLUSTER_POSTFIX
4+
import pl.allegro.tech.servicemesh.envoycontrol.utils.ClusterNames.SECONDARY_CLUSTER_POSTFIX
55

6-
object ClusterConstants {
6+
object ClusterNames {
77
const val SECONDARY_CLUSTER_POSTFIX= "secondary"
88
const val AGGREGATE_CLUSTER_POSTFIX= "aggregate"
99
}

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

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ import pl.allegro.tech.servicemesh.envoycontrol.groups.Outgoing
2727
import pl.allegro.tech.servicemesh.envoycontrol.groups.ProxySettings
2828
import pl.allegro.tech.servicemesh.envoycontrol.groups.ServicesGroup
2929
import pl.allegro.tech.servicemesh.envoycontrol.groups.with
30-
import pl.allegro.tech.servicemesh.envoycontrol.services.ClusterState
31-
import pl.allegro.tech.servicemesh.envoycontrol.services.Locality
32-
import pl.allegro.tech.servicemesh.envoycontrol.services.MultiClusterState
33-
import pl.allegro.tech.servicemesh.envoycontrol.services.ServiceInstance
34-
import pl.allegro.tech.servicemesh.envoycontrol.services.ServiceInstances
35-
import pl.allegro.tech.servicemesh.envoycontrol.services.ServicesState
3630
import pl.allegro.tech.servicemesh.envoycontrol.snapshot.ClusterConfiguration
3731
import pl.allegro.tech.servicemesh.envoycontrol.snapshot.EnvoySnapshotFactory
3832
import pl.allegro.tech.servicemesh.envoycontrol.snapshot.GlobalSnapshot
@@ -47,7 +41,6 @@ import pl.allegro.tech.servicemesh.envoycontrol.snapshot.resource.routes.EnvoyEg
4741
import pl.allegro.tech.servicemesh.envoycontrol.snapshot.resource.routes.EnvoyIngressRoutesFactory
4842
import pl.allegro.tech.servicemesh.envoycontrol.snapshot.resource.routes.ServiceTagMetadataGenerator
4943
import pl.allegro.tech.servicemesh.envoycontrol.snapshot.serviceDependencies
50-
import java.util.concurrent.ConcurrentHashMap
5144

5245
class EnvoySnapshotFactoryTest {
5346
companion object {
@@ -509,25 +502,6 @@ class EnvoySnapshotFactoryTest {
509502
}
510503
}
511504

512-
private fun createMultiClusterState(services: List<String>): List<MultiClusterState> {
513-
return services
514-
.map {
515-
ClusterState(
516-
ServicesState(
517-
ConcurrentHashMap(
518-
mutableMapOf(
519-
it to ServiceInstances(
520-
it,
521-
setOf(ServiceInstance("id", setOf(), "localhost", 8080))
522-
)
523-
)
524-
)
525-
), Locality.LOCAL, it
526-
)
527-
}
528-
.map { MultiClusterState(it) }
529-
}
530-
531505
private fun createCluster(
532506
defaultProperties: SnapshotProperties,
533507
clusterName: String = CLUSTER_NAME,

0 commit comments

Comments
 (0)