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 25, 2023
1 parent 1e06196 commit 19714b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ class EnvoySnapshotFactory(
group: Group,
globalSnapshot: GlobalSnapshot
): Snapshot {
logger.debug("Creating new snapshot for group ${group.serviceName}")
// TODO(dj): This is where serious refactoring needs to be done
val egressDomainRouteSpecifications = getDomainRouteSpecifications(group, globalSnapshot)
val egressServiceRouteSpecification = getServiceRouteSpecifications(group, globalSnapshot)
Expand Down Expand Up @@ -314,7 +313,6 @@ class EnvoySnapshotFactory(
group.proxySettings.incoming.rateLimitEndpoints, globalSnapshot,
egressRouteSpecification
)
// .also { logger.debug("Result endpoints: ${it.toString()}") }

val version = snapshotsVersions.version(group, clusters, endpoints, listeners, routes)
return createSnapshot(
Expand All @@ -327,9 +325,7 @@ class EnvoySnapshotFactory(
listenersVersion = version.listeners,
routes = routes,
routesVersion = version.routes
).also {
logger.debug("Snapshot endpoints: ${it.endpoints()}")
}
)
}

private fun createRoutesWhenUsingTransparentProxy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ internal class EnvoyEndpointsFactoryTest {
listOf(
clusterState(cluster = "DC1"),
clusterState(cluster = "DC2"),
clusterState(cluster = "DC1", sName = serviceName2),
clusterState(cluster = "DC2", sName = serviceName2),
clusterState(cluster = "DC1", serviceName = serviceName2),
clusterState(cluster = "DC2", serviceName = serviceName2),
)
)

Expand Down Expand Up @@ -398,7 +398,7 @@ internal class EnvoyEndpointsFactoryTest {
val multiClusterState = MultiClusterState(
listOf(
clusterState(cluster = defaultZone),
clusterState(cluster = defaultZone, sName = serviceName2),
clusterState(cluster = defaultZone, serviceName = serviceName2),
)
)
val services = setOf(serviceName, serviceName2)
Expand Down Expand Up @@ -428,7 +428,7 @@ internal class EnvoyEndpointsFactoryTest {
val multiClusterState = MultiClusterState(
listOf(
clusterState(cluster = defaultZone),
clusterState(cluster = defaultZone, sName = serviceName2),
clusterState(cluster = defaultZone, serviceName = serviceName2),
)
)
val services = setOf(serviceName, serviceName2)
Expand All @@ -455,7 +455,7 @@ internal class EnvoyEndpointsFactoryTest {
val multiClusterState = MultiClusterState(
listOf(
clusterState(cluster = defaultZone),
clusterState(cluster = defaultZone, sName = serviceName2),
clusterState(cluster = defaultZone, serviceName = serviceName2),
)
)
val services = setOf(serviceName, serviceName2)
Expand Down Expand Up @@ -493,13 +493,13 @@ internal class EnvoyEndpointsFactoryTest {
private fun clusterState(
locality: Locality = Locality.LOCAL,
cluster: String,
sName: String = serviceName
serviceName: String = this.serviceName
): ClusterState {
return ClusterState(
ServicesState(
serviceNameToInstances = concurrentMapOf(
sName to ServiceInstances(
sName, setOf(
serviceName to ServiceInstances(
serviceName, setOf(
ServiceInstance(
id = "id",
tags = setOf("envoy"),
Expand Down

0 comments on commit 19714b3

Please sign in to comment.