Skip to content

Commit

Permalink
#624 Set flat priority only for services with traffic splitting (adde…
Browse files Browse the repository at this point in the history
…d log)
  • Loading branch information
nastassia-dailidava committed Apr 3, 2024
1 parent 31d7e4b commit 6e23fc5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,12 @@ class EnvoySnapshotFactory(
)

val version = snapshotsVersions.version(group, clusters, endpoints, listeners, routes)
// TODO REMOVE THIS LOG
if (group.serviceName == "service-mesh-service-second") {
endpoints
.find{ it.clusterName == "service-mesh-service-first"}
?.let { logger.info("Snapshot endpoints (${it.endpointsList.size}): ${it.endpointsList.toString()}") }
}
return createSnapshot(
clusters = clusters,
clustersVersion = version.clusters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import pl.allegro.tech.servicemesh.envoycontrol.config.service.EchoServiceExtens
import verifyCallsCountCloseTo
import verifyCallsCountEq
import verifyIsReachable
import java.io.File
import java.time.Duration

class LocalityWeightedLoadBalancingTest {
Expand Down Expand Up @@ -100,10 +101,13 @@ class LocalityWeightedLoadBalancingTest {
consul.serverSecond.operations.registerService(upstreamServiceDC2, name = UPSTREAM_SERVICE_NAME)
downstreamServiceEnvoy.verifyIsReachable(upstreamServiceDC2, UPSTREAM_SERVICE_NAME)

consul.serverThird.operations.registerService(upstreamServiceDC3, name = UPSTREAM_SERVICE_NAME)
envoyDC3.verifyIsReachable(upstreamServiceDC3, UPSTREAM_SERVICE_NAME)

downstreamServiceEnvoy.callUpstreamServiceRepeatedly(upstreamServiceDC1, upstreamServiceDC2)
.verifyCallsCountCloseTo(upstreamServiceDC1, 75)
.verifyCallsCountCloseTo(upstreamServiceDC2, 25)
.verifyCallsCountEq(upstreamServiceDC3, 0)
.verifyCallsCountEq(upstreamServiceDC3, 0)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import pl.allegro.tech.servicemesh.envoycontrol.config.consul.ConsulMultiCluster
import pl.allegro.tech.servicemesh.envoycontrol.config.envoy.EnvoyExtension
import pl.allegro.tech.servicemesh.envoycontrol.config.envoycontrol.EnvoyControlClusteredExtension
import pl.allegro.tech.servicemesh.envoycontrol.config.service.EchoServiceExtension
import pl.allegro.tech.servicemesh.envoycontrol.trafficsplitting.LocalityWeightedLoadBalancingTest.Companion.upstreamServiceDC3
import verifyCallsCountEq
import verifyIsReachable
import java.time.Duration
Expand Down Expand Up @@ -87,6 +86,5 @@ class LocalityWeightedLoadBalancingUnlistedServiceTest {
echoEnvoyDC1.callUpstreamServiceRepeatedly(upstreamServiceDC1, upstreamServiceDC2)
.verifyCallsCountEq(upstreamServiceDC1, 100)
.verifyCallsCountEq(upstreamServiceDC2, 0)
.verifyCallsCountEq(upstreamServiceDC3, 0)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import pl.allegro.tech.servicemesh.envoycontrol.config.service.EchoServiceExtens
internal object TrafficSplitting {
const val UPSTREAM_SERVICE_NAME = "service-1"
const val SERVICE_NAME = "echo2"
const val DELTA_PERCENTAGE = 20.0
const val DELTA_PERCENTAGE = 10.0
const val FORCE_TRAFFIC_ZONE = "dc2"
val DEFAULT_PRIORITIES = mapOf(
"dc1" to mapOf(
Expand Down

0 comments on commit 6e23fc5

Please sign in to comment.