Skip to content

Commit

Permalink
Implemented possibility for configuring traffic splitting, and fallba…
Browse files Browse the repository at this point in the history
…ck using aggregate cluster #292
  • Loading branch information
nastassia-dailidava committed Aug 24, 2023
1 parent b65015c commit 1f01680
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ class EnvoyClustersFactory(
return cluster?.let {
if (enableTrafficSplitting(serviceName, cluster.name, dependencies, clusterLoadAssignment)) {
logger.debug(
"Creating traffic splitting egress cluster config for ${cluster.name}, service: $serviceName")
"Creating traffic splitting egress cluster config for ${cluster.name}, service: $serviceName"
)
createSetOfClustersForGroup(dependencySettings, cluster)
} else {
listOf(createClusterForGroup(dependencySettings, cluster))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class EnvoyEndpointsFactory(
): List<ClusterLoadAssignment> {
return egressRouteSpecifications
.filter { it.clusterWeights.isNotEmpty() }
.onEach { logger.debug("Traffic splitting is enabled for cluster: ${it.clusterName}") }
.onEach { logger.debug("Traffic splitting is enabled for cluster: ${it.clusterName}") }
.mapNotNull { routeSpec ->
clusterLoadAssignments[routeSpec.clusterName]?.let {
ClusterLoadAssignment.newBuilder(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import pl.allegro.tech.servicemesh.envoycontrol.utils.ClusterNames.AGGREGATE_CLU
import pl.allegro.tech.servicemesh.envoycontrol.utils.ClusterNames.SECONDARY_CLUSTER_POSTFIX

object ClusterNames {
const val SECONDARY_CLUSTER_POSTFIX= "secondary"
const val AGGREGATE_CLUSTER_POSTFIX= "aggregate"
const val SECONDARY_CLUSTER_POSTFIX = "secondary"
const val AGGREGATE_CLUSTER_POSTFIX = "aggregate"
}
fun getSecondaryClusterName(serviceName: String) :String {

fun getSecondaryClusterName(serviceName: String): String {
return "$serviceName-$SECONDARY_CLUSTER_POSTFIX"
}

fun getAggregateClusterName(serviceName: String) :String {
fun getAggregateClusterName(serviceName: String): String {
return "$serviceName-$AGGREGATE_CLUSTER_POSTFIX"
}

0 comments on commit 1f01680

Please sign in to comment.