Skip to content

Commit

Permalink
Merge branch 'master' into flex-roadmap-traffic-splitting
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
nastassia-dailidava committed Sep 11, 2023
2 parents 637b507 + 689078b commit 92f3c6e
Show file tree
Hide file tree
Showing 47 changed files with 531 additions and 316 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'

- name: Cache Gradle packages
uses: actions/cache@v2
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/flaky.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Flaky tests

on:
workflow_dispatch:

push:
paths-ignore:
- 'readme.md'

jobs:
flaky_test:
name: flaky_test
runs-on: ubuntu-latest
env:
GRADLE_OPTS: '-Dfile.encoding=utf-8 -Dorg.gradle.daemon=false'

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}

- uses: gradle/wrapper-validation-action@v1

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Flaky tests
run: ./gradlew clean -Penvironment=integration :envoy-control-tests:flakyTest

- name: Junit report
uses: mikepenz/action-junit-report@v2
if: always()
with:
report_paths: '**/build/test-results/test/TEST-*.xml'

- name: Cleanup Gradle Cache
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
4 changes: 2 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
with:
fetch-depth: 0
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'
- name: Release
if: github.ref == 'refs/heads/master'
run: ./gradlew release -Prelease.customPassword=${GITHUB_TOKEN} -Prelease.customUsername=${GITHUB_ACTOR} -Prelease.forceVersion=${FORCE_VERSION}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/resilence.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'

- name: Cache Gradle packages
uses: actions/cache@v3
Expand Down
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,28 @@

Lists all changes with user impact.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
## [0.19.36]
## [0.20.1]

### Changed
- Implemented configuring traffic splitting and fallback using aggregate cluster functionality


## [0.20.00]

### Changed
- Spring Boot upgraded to 3.1.2
- Java upgraded to 17
- Kotlin upgraded to 1.8.2
- Gradle upgraded to 8.3

### Fixed
- Random port generation for testcontainers

## [0.19.36]

### Changed
- Added debug endpoint, which returns current groups

## [0.19.35]

### Changed
Expand Down
56 changes: 23 additions & 33 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ plugins {
id 'signing'

id 'pl.allegro.tech.build.axion-release' version '1.13.3'
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
id 'org.jetbrains.kotlin.plugin.spring' version '1.6.10'
id 'org.jetbrains.kotlin.plugin.allopen' version '1.6.10'
id 'org.jetbrains.kotlin.jvm' version '1.8.22'
id 'org.jetbrains.kotlin.plugin.spring' version '1.8.22'
id 'org.jetbrains.kotlin.plugin.allopen' version '1.8.22'
id "org.jlleitschuh.gradle.ktlint" version "10.2.1"
id "org.jlleitschuh.gradle.ktlint-idea" version "10.2.0"
id "io.gitlab.arturbosch.detekt" version "1.18.0"
id 'io.github.gradle-nexus.publish-plugin' version '1.0.0'
id 'org.springframework.boot' version '3.1.2' apply false

}

Expand All @@ -44,34 +45,25 @@ allprojects {

apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
apply plugin: 'io.spring.dependency-management'

project.ext.versions = [
kotlin : '1.6.10',
java_controlplane : '1.0.37',
spring_boot : '2.3.4.RELEASE',
spring_boot : '3.1.2',
grpc : '1.48.1',
jaxb : '2.3.1',
javaxactivation : '1.2.0',
micrometer : '1.5.5',
dropwizard : '4.1.12.1',
ecwid_consul : '1.4.1',
awaitility : '4.0.3',
embedded_consul : '2.0.0',
junit : '5.6.2',
assertj : '3.17.2',
jackson : '2.11.2',
toxiproxy : '2.1.3',
testcontainers : '1.16.0',
reactor : '3.3.10.RELEASE',
consul_recipes : '0.9.1',
mockito : '3.3.3',
cglib : '3.2.9',
logback : '1.2.3',
slf4j : '1.7.30',
re2j : '1.3',
xxhash : '0.10.1',
okhttp : '4.9.0'
]

dependencyManagement {
imports {
mavenBom org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES
}
}
}


Expand All @@ -91,7 +83,6 @@ subprojects {
apply plugin: 'io.gitlab.arturbosch.detekt'
apply plugin: 'signing'

sourceCompatibility = JavaVersion.VERSION_11
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

ktlint {
Expand Down Expand Up @@ -167,23 +158,22 @@ subprojects {
compile.exclude group: 'log4j', module: 'log4j'
}

compileKotlin {
kotlinOptions {
jvmTarget = '11'
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

compileTestKotlin {
kotlinOptions {
jvmTarget = '11'
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

dependencies {
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: versions.junit
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: versions.junit
testImplementation group: 'org.assertj', name: 'assertj-core', version: versions.assertj
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: versions.junit
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params'
testImplementation group: 'org.assertj', name: 'assertj-core'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine'
}

detekt {
Expand All @@ -195,5 +185,5 @@ subprojects {
}

wrapper {
gradleVersion = '7.1.1'
gradleVersion = '8.3'
}
2 changes: 2 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Envoy Control is a [Kotlin](https://kotlinlang.org/) application, it requires JD
```./gradlew integrationTest```
* Reliability tests
```./gradlew clean -i -Penvironment=integration :envoy-control-tests:reliabilityTest -DRELIABILITY_FAILURE_DURATION_SECONDS=20```
* Flaky tests
```./gradlew -Penvironment=integration :envoy-control-tests:flakyTest```

## Running Lua tests locally (not inside docker) for debugging purposes

Expand Down
33 changes: 18 additions & 15 deletions envoy-control-core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
plugins {
id 'org.springframework.boot' apply false
}

dependencies {
api project(':envoy-control-services')

implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: versions.kotlin
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8', version: versions.kotlin
api group: 'com.fasterxml.jackson.module', name: 'jackson-module-afterburner', version: versions.jackson
api group: 'com.fasterxml.jackson.module', name: 'jackson-module-kotlin', version: versions.jackson
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: versions.kotlin
api group: 'io.dropwizard.metrics', name: 'metrics-core', version: versions.dropwizard
api group: 'io.micrometer', name: 'micrometer-core', version: versions.micrometer
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib'
api group: 'com.fasterxml.jackson.module', name: 'jackson-module-afterburner'
api group: 'com.fasterxml.jackson.module', name: 'jackson-module-kotlin'
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-reflect'
api group: 'io.dropwizard.metrics', name: 'metrics-core'
api group: 'io.micrometer', name: 'micrometer-core'
implementation group: 'com.google.re2j', name: 're2j', version: versions.re2j

api group: 'io.envoyproxy.controlplane', name: 'server', version: versions.java_controlplane

implementation group: 'io.grpc', name: 'grpc-netty', version: versions.grpc

implementation group: 'io.projectreactor', name: 'reactor-core', version: versions.reactor
implementation group: 'io.projectreactor', name: 'reactor-core'

implementation group: 'org.slf4j', name: 'jcl-over-slf4j', version: versions.slf4j
implementation group: 'ch.qos.logback', name: 'logback-classic', version: versions.logback
implementation group: 'org.slf4j', name: 'jcl-over-slf4j'
implementation group: 'ch.qos.logback', name: 'logback-classic'

testImplementation group: 'io.grpc', name: 'grpc-testing', version: versions.grpc
testImplementation group: 'io.projectreactor', name: 'reactor-test', version: versions.reactor
testImplementation group: 'org.mockito', name: 'mockito-core', version: versions.mockito
testImplementation group: 'io.projectreactor', name: 'reactor-test'
testImplementation group: 'org.mockito', name: 'mockito-core'
testImplementation group: 'cglib', name: 'cglib-nodep', version: versions.cglib

testImplementation group: 'org.awaitility', name: 'awaitility', version: versions.awaitility
testImplementation group: 'org.awaitility', name: 'awaitility'

testImplementation group: 'org.testcontainers', name: 'testcontainers', version: versions.testcontainers
testImplementation group: 'org.testcontainers', name: 'junit-jupiter', version: versions.testcontainers
testImplementation group: 'org.testcontainers', name: 'testcontainers'
testImplementation group: 'org.testcontainers', name: 'junit-jupiter'
}

tasks.withType(GroovyCompile) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class SnapshotUpdater(
private fun updateSnapshotForGroup(group: Group, globalSnapshot: GlobalSnapshot) {
try {
val groupSnapshot = snapshotFactory.getSnapshotForGroup(group, globalSnapshot)
snapshotTimer(group.serviceName).record {
snapshotTimer(group.serviceName).recordCallable {
cache.setSnapshot(group, groupSnapshot)
}
} catch (e: Throwable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ class GlobalStateChanges(
private val meterRegistry: MeterRegistry,
private val properties: SyncProperties
) {
private val scheduler = Schedulers.newElastic("global-service-changes-combinator")
private val scheduler = Schedulers.newBoundedElastic(
Int.MAX_VALUE, Int.MAX_VALUE, "global-service-changes-combinator"
)

fun combined(): Flux<MultiClusterState> {
val clusterStatesStreams: List<Flux<MultiClusterState>> = clusterStateChanges.map { it.stream() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class RemoteServices(
fun getChanges(interval: Long): Flux<MultiClusterState> {
val aclFlux: Flux<MultiClusterState> = Flux.create({ sink ->
scheduler.scheduleWithFixedDelay({
meterRegistry.timer("sync-dc.get-multi-cluster-states.time").record {
meterRegistry.timer("sync-dc.get-multi-cluster-states.time").recordCallable {
getChanges(sink::next, interval)
}
}, 0, interval, TimeUnit.SECONDS)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package pl.allegro.tech.servicemesh.envoycontrol.utils

import java.net.ServerSocket
import pl.allegro.tech.servicemesh.envoycontrol.logger

object Ports {
private val usedPorts: MutableSet<Int> = mutableSetOf()
val logger by logger()

@Synchronized
fun nextAvailable(): Int {
var randomPort: Int
do {
randomPort = ServerSocket(0).use { it.localPort }
} while (usedPorts.contains(randomPort))
usedPorts.add(randomPort)
logger.info("Generated port: {}", randomPort)
logger.info("Used ports: {}", usedPorts)

return randomPort
}
}
Loading

0 comments on commit 92f3c6e

Please sign in to comment.