From 7e08f1d11f3d6866c07023f4af86ff5de5cc9986 Mon Sep 17 00:00:00 2001 From: kozjan <138656232+kozjan@users.noreply.github.com> Date: Tue, 16 Jul 2024 10:10:23 +0200 Subject: [PATCH] java control plane 1.0.45 (#422) * java control plane 1.0.45 * update envoy in tests * fix OutlierDetectionTest --- CHANGELOG.md | 5 ++ build.gradle | 2 +- .../servicemesh/envoycontrol/SimpleCache.java | 7 +-- .../envoycontrol/groups/GroupChangeWatcher.kt | 18 +++++-- .../envoycontrol/v3/SimpleCacheTest.java | 52 ++++++++++++++----- .../SimpleCacheWithMissingEndpointsTest.java | 4 +- .../snapshot/SnapshotUpdaterTest.kt | 3 +- .../envoycontrol/OutlierDetectionTest.kt | 12 ++++- .../config/envoy/EnvoyContainer.kt | 2 +- tools/envoy/Dockerfile | 2 +- 10 files changed, 80 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ec7c22d2..8350cd7bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ Lists all changes with user impact. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). + +## [0.20.15] +### Changed +- Java-control-plane update to 1.0.45 + ## [0.20.14] ### Changed - Added test to check circuit breaker metric value diff --git a/build.gradle b/build.gradle index a69874cfb..c8a49dac1 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ allprojects { apply plugin: 'io.spring.dependency-management' project.ext.versions = [ - java_controlplane : '1.0.37', + java_controlplane : '1.0.45', spring_boot : '3.1.2', grpc : '1.48.1', ecwid_consul : '1.4.1', diff --git a/envoy-control-core/src/main/java/pl/allegro/tech/servicemesh/envoycontrol/SimpleCache.java b/envoy-control-core/src/main/java/pl/allegro/tech/servicemesh/envoycontrol/SimpleCache.java index 0dbabcc33..d75493edc 100644 --- a/envoy-control-core/src/main/java/pl/allegro/tech/servicemesh/envoycontrol/SimpleCache.java +++ b/envoy-control-core/src/main/java/pl/allegro/tech/servicemesh/envoycontrol/SimpleCache.java @@ -94,7 +94,7 @@ public Watch createWatch( XdsRequest request, Set knownResourceNames, Consumer responseConsumer) { - return createWatch(ads, request, knownResourceNames, responseConsumer, false); + return createWatch(ads, request, knownResourceNames, responseConsumer, false, false); } /** @@ -106,7 +106,8 @@ public Watch createWatch( XdsRequest request, Set knownResourceNames, Consumer responseConsumer, - boolean hasClusterChanged) { + boolean hasClusterChanged, + boolean allowDefaultEmptyEdsUpdate) { Resources.ResourceType requestResourceType = request.getResourceType(); Preconditions.checkNotNull(requestResourceType, "unsupported type URL %s", request.getTypeUrl()); @@ -123,7 +124,7 @@ public Watch createWatch( U snapshot = snapshots.get(group); String version = snapshot == null ? "" : snapshot.version(requestResourceType, request.getResourceNamesList()); - Watch watch = new Watch(ads, request, responseConsumer); + Watch watch = new Watch(ads, allowDefaultEmptyEdsUpdate, request, responseConsumer); if (snapshot != null) { Set requestedResources = ImmutableSet.copyOf(request.getResourceNamesList()); diff --git a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/groups/GroupChangeWatcher.kt b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/groups/GroupChangeWatcher.kt index e95c897b5..522d96eae 100644 --- a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/groups/GroupChangeWatcher.kt +++ b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/groups/GroupChangeWatcher.kt @@ -44,14 +44,22 @@ internal class GroupChangeWatcher( override fun createWatch( ads: Boolean, - request: XdsRequest, - knownResourceNames: MutableSet, - responseConsumer: Consumer, - hasClusterChanged: Boolean + request: XdsRequest?, + knownResourceNames: MutableSet?, + responseConsumer: Consumer?, + hasClusterChanged: Boolean, + allowDefaultEmptyEdsUpdate: Boolean ): Watch { val oldGroups = cache.groups() - val watch = cache.createWatch(ads, request, knownResourceNames, responseConsumer, hasClusterChanged) + val watch = cache.createWatch( + ads, + request, + knownResourceNames, + responseConsumer, + hasClusterChanged, + allowDefaultEmptyEdsUpdate + ) val groups = cache.groups() metrics.setCacheGroupsCount(groups.size) if (oldGroups != groups) { diff --git a/envoy-control-core/src/test/java/pl/allegro/tech/servicemesh/envoycontrol/v3/SimpleCacheTest.java b/envoy-control-core/src/test/java/pl/allegro/tech/servicemesh/envoycontrol/v3/SimpleCacheTest.java index 1a70af568..444b0bd38 100644 --- a/envoy-control-core/src/test/java/pl/allegro/tech/servicemesh/envoycontrol/v3/SimpleCacheTest.java +++ b/envoy-control-core/src/test/java/pl/allegro/tech/servicemesh/envoycontrol/v3/SimpleCacheTest.java @@ -92,7 +92,9 @@ public void invalidNamesListShouldReturnWatcherWithNoResponseInAdsMode() { .build()), Collections.emptySet(), responseTracker, - false); + false, + false + ); assertThatWatchIsOpenWithNoResponses(new WatchAndTracker(watch, responseTracker)); } @@ -114,7 +116,9 @@ public void invalidNamesListShouldReturnWatcherWithResponseInXdsMode() { .build()), Collections.emptySet(), responseTracker, - false); + false, + false + ); assertThat(watch.isCancelled()).isFalse(); assertThat(responseTracker.responses).isNotEmpty(); @@ -138,7 +142,9 @@ public void successfullyWatchAllResourceTypesWithSetBeforeWatch() { .build()), Collections.emptySet(), responseTracker, - false); + false, + false + ); assertThat(watch.request().getTypeUrl()).isEqualTo(typeUrl); assertThat(watch.request().getResourceNamesList()).containsExactlyElementsOf( @@ -166,7 +172,9 @@ public void shouldSendEdsWhenClusterChangedButEdsVersionDidnt() { .build()), Sets.newHashSet(""), responseTracker, - true); + true, + false + ); assertThat(watch.request().getTypeUrl()).isEqualTo(Resources.V3.ENDPOINT_TYPE_URL); assertThat(watch.request().getResourceNamesList()).containsExactlyElementsOf( @@ -194,7 +202,9 @@ public void successfullyWatchAllResourceTypesWithSetAfterWatch() { .build()), Collections.emptySet(), responseTracker, - false); + false, + false + ); return new WatchAndTracker(watch, responseTracker); })); @@ -236,7 +246,9 @@ public void successfullyWatchAllResourceTypesWithSetBeforeWatchWithRequestVersio responseTracker.accept(r); responseOrderTracker.accept(r); }, - false); + false, + false + ); return new WatchAndTracker(watch, responseTracker); })) @@ -288,7 +300,9 @@ public void successfullyWatchAllResourceTypesWithSetBeforeWatchWithSameRequestVe .build()), SNAPSHOT2.resources(typeUrl).keySet(), responseTracker, - false); + false, + false + ); return new WatchAndTracker(watch, responseTracker); })); @@ -333,7 +347,9 @@ public void successfullyWatchAllResourceTypesWithSetBeforeWatchWithSameRequestVe .build()), SNAPSHOT2.resources(typeUrl).keySet(), responseTracker, - false); + false, + false + ); return new WatchAndTracker(watch, responseTracker); })); @@ -366,7 +382,9 @@ public void setSnapshotWithVersionMatchingRequestShouldLeaveWatchOpenWithoutAddi .build()), SNAPSHOT1.resources(typeUrl).keySet(), responseTracker, - false); + false, + false + ); return new WatchAndTracker(watch, responseTracker); })); @@ -403,7 +421,9 @@ public void watchesAreReleasedAfterCancel() { .build()), Collections.emptySet(), responseTracker, - false); + false, + false + ); return new WatchAndTracker(watch, responseTracker); })); @@ -435,7 +455,9 @@ public void watchIsLeftOpenIfNotRespondedImmediately() { .build()), Collections.singleton(ROUTE_NAME), responseTracker, - false); + false, + false + ); assertThatWatchIsOpenWithNoResponses(new WatchAndTracker(watch, responseTracker)); } @@ -475,7 +497,9 @@ public void clearSnapshotWithWatches() { .build()), Collections.emptySet(), r -> { }, - false); + false, + false + ); // clearSnapshot should fail and the snapshot should be left untouched assertThat(cache.clearSnapshot(SingleNodeGroup.GROUP)).isFalse(); @@ -502,7 +526,9 @@ public void groups() { .build()), Collections.emptySet(), r -> { }, - false); + false, + false + ); assertThat(cache.groups()).containsExactly(SingleNodeGroup.GROUP); } diff --git a/envoy-control-core/src/test/java/pl/allegro/tech/servicemesh/envoycontrol/v3/SimpleCacheWithMissingEndpointsTest.java b/envoy-control-core/src/test/java/pl/allegro/tech/servicemesh/envoycontrol/v3/SimpleCacheWithMissingEndpointsTest.java index 77d9ee749..df40d6dcf 100644 --- a/envoy-control-core/src/test/java/pl/allegro/tech/servicemesh/envoycontrol/v3/SimpleCacheWithMissingEndpointsTest.java +++ b/envoy-control-core/src/test/java/pl/allegro/tech/servicemesh/envoycontrol/v3/SimpleCacheWithMissingEndpointsTest.java @@ -61,7 +61,9 @@ public void missingNamesListShouldReturnWatcherWithResponseInAdsMode() { .build()), Collections.emptySet(), responseTracker, - false); + false, + false + ); assertThatWatchReceivesSnapshotWithMissingResources(new WatchAndTracker(watch, responseTracker), SNAPSHOT_WITH_MISSING_RESOURCES); } diff --git a/envoy-control-core/src/test/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/SnapshotUpdaterTest.kt b/envoy-control-core/src/test/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/SnapshotUpdaterTest.kt index 247f879e3..0cba50150 100644 --- a/envoy-control-core/src/test/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/SnapshotUpdaterTest.kt +++ b/envoy-control-core/src/test/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/SnapshotUpdaterTest.kt @@ -1121,7 +1121,8 @@ class SnapshotUpdaterTest { request: XdsRequest, knownResourceNames: MutableSet, responseConsumer: Consumer, - hasClusterChanged: Boolean + hasClusterChanged: Boolean, + allowDefaultEmptyEdsUpdate: Boolean ): Watch { throw UnsupportedOperationException("not used in testing") } diff --git a/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/OutlierDetectionTest.kt b/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/OutlierDetectionTest.kt index 9445320a7..c250b4e0d 100644 --- a/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/OutlierDetectionTest.kt +++ b/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/OutlierDetectionTest.kt @@ -6,6 +6,7 @@ import org.junit.jupiter.api.extension.RegisterExtension import pl.allegro.tech.servicemesh.envoycontrol.assertions.isFrom import pl.allegro.tech.servicemesh.envoycontrol.assertions.isOk import pl.allegro.tech.servicemesh.envoycontrol.assertions.untilAsserted +import pl.allegro.tech.servicemesh.envoycontrol.config.RandomConfigFile import pl.allegro.tech.servicemesh.envoycontrol.config.consul.ConsulExtension import pl.allegro.tech.servicemesh.envoycontrol.config.service.EchoServiceExtension import pl.allegro.tech.servicemesh.envoycontrol.config.envoy.EnvoyExtension @@ -33,9 +34,18 @@ class OutlierDetectionTest { @RegisterExtension val unhealthyService = EchoServiceExtension() + // necessary since Envoy 1.28.0 to keep the same behaviour (https://www.envoyproxy.io/docs/envoy/latest/version_history/v1.28/v1.28.0) + private val outlierEjectionConfig = """ + layered_runtime: + layers: + - name: static_layer + static_layer: + envoy.reloadable_features.check_mep_on_first_eject: false + """.trimIndent() + @JvmField @RegisterExtension - val envoy = EnvoyExtension(envoyControl) + val envoy = EnvoyExtension(envoyControl, config = RandomConfigFile.copy(configOverride = outlierEjectionConfig)) } @Test diff --git a/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/config/envoy/EnvoyContainer.kt b/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/config/envoy/EnvoyContainer.kt index f34c62672..92466b0c5 100644 --- a/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/config/envoy/EnvoyContainer.kt +++ b/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/config/envoy/EnvoyContainer.kt @@ -39,7 +39,7 @@ class EnvoyContainer( private const val ADMIN_PORT = 10000 private const val MIN_SUPPORTED_ENVOY_VERSION = "v1.22.7" - private const val MAX_SUPPORTED_ENVOY_VERSION = "v1.24.0" + private const val MAX_SUPPORTED_ENVOY_VERSION = "v1.30.4" val DEFAULT_IMAGE = run { val version = diff --git a/tools/envoy/Dockerfile b/tools/envoy/Dockerfile index 500e559c0..cde753b9b 100644 --- a/tools/envoy/Dockerfile +++ b/tools/envoy/Dockerfile @@ -1,4 +1,4 @@ -FROM envoyproxy/envoy:v1.24.0 +FROM envoyproxy/envoy:v1.30.4 ENV PORT=9999:9999 ENV PORT=80:80