Skip to content

Commit

Permalink
Added setting localityAware flag on subsetConfig for clusters with tr…
Browse files Browse the repository at this point in the history
…affic splitting (#416)

* allegro-internal/flex-roadmap#601 Added localitWeightAware flag
  • Loading branch information
nastassia-dailidava authored Apr 29, 2024
1 parent 019639d commit 1f83855
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
## [0.20.14]
### Changed
- Added test to check circuit breaker metric value
- Set "localityAware=true" for cluster subset config

## [0.20.13]
### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ class EnvoyClustersFactory(
.setLocalityWeightedLbConfig(Cluster.CommonLbConfig.LocalityWeightedLbConfig.getDefaultInstance())
.build()
)
.setLbSubsetConfig(
Cluster.LbSubsetConfig.newBuilder(cluster.lbSubsetConfig)
.setLocalityWeightAware(true)
.setScaleLocalityWeight(true)
)
.also {
logger.debug("Created cluster config for traffic splitting: {}", it.toString())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal class EnvoyClustersFactoryTest {
DEFAULT_SERVICE_NAME to DEFAULT_CLUSTER_WEIGHTS
)
loadBalancing.trafficSplitting.zoneName = TRAFFIC_SPLITTING_ZONE
loadBalancing.trafficSplitting.zonesAllowingTrafficSplitting = listOf(CURRENT_ZONE)
}
}

Expand Down Expand Up @@ -112,7 +113,11 @@ internal class EnvoyClustersFactoryTest {
.anySatisfy {
assertThat(it.name).isEqualTo(CLUSTER_NAME1)
assertThat(it.edsClusterConfig).isEqualTo(cluster1.edsClusterConfig)
assertThat(it.commonLbConfig).isNotNull
assertThat(it.commonLbConfig.localityWeightedLbConfig).isNotNull
assertThat(it.lbSubsetConfig).isNotNull
assertThat(it.lbSubsetConfig.localityWeightAware).isTrue()
assertThat(it.lbSubsetConfig.scaleLocalityWeight).isTrue()
}
}

Expand All @@ -133,6 +138,8 @@ internal class EnvoyClustersFactoryTest {
assertThat(it.name).isEqualTo(CLUSTER_NAME1)
assertThat(it.edsClusterConfig).isEqualTo(cluster1.edsClusterConfig)
assertThat(it.commonLbConfig.hasLocalityWeightedLbConfig()).isFalse()
assertThat(it.lbSubsetConfig.localityWeightAware).isFalse()
assertThat(it.lbSubsetConfig.scaleLocalityWeight).isFalse()
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pl.allegro.tech.servicemesh.envoycontrol

import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.RegisterExtension
import pl.allegro.tech.servicemesh.envoycontrol.assertions.isFrom
Expand Down Expand Up @@ -81,6 +82,7 @@ internal class ClusterCircuitBreakerDefaultSettingsTest {
assertThat(remainingRqMetric).isNotNull()
}

@Tag("flaky")
@Test
fun `should have decreased remaining pending rq`() {
consul.server.operations.registerServiceWithEnvoyOnIngress(name = "echo", extension = envoy)
Expand Down

0 comments on commit 1f83855

Please sign in to comment.