From a1dbdcd377de98eee8b74b7dcbe3d2a735f4e654 Mon Sep 17 00:00:00 2001 From: ZIK-1337 Date: Sun, 19 Oct 2025 09:40:14 +0300 Subject: [PATCH] cache,server: add stream scoped routes Signed-off-by: Maksim Zashchitin --- .../controlplane/cache/Resources.java | 27 +++++++- .../controlplane/cache/TestResources.java | 14 +++++ .../controlplane/cache/v3/Snapshot.java | 58 ++++++++++++----- .../controlplane/cache/ResourcesTest.java | 2 +- .../cache/v3/SimpleCacheTest.java | 10 ++- .../controlplane/cache/v3/SnapshotTest.java | 30 +++++++++ .../server/V3DiscoveryServer.java | 20 ++++++ .../controlplane/server/EnvoyContainer.java | 2 +- .../controlplane/server/TestMain.java | 2 + ...coveryServerAdsAllowDefaultEmptyEdsIT.java | 4 ++ .../V3DiscoveryServerAdsDeltaResourcesIT.java | 3 + .../server/V3DiscoveryServerAdsIT.java | 1 + ...scoveryServerAdsStreamOpenExceptionIT.java | 1 + .../V3DiscoveryServerAdsWarmingClusterIT.java | 11 +++- .../server/V3DiscoveryServerTest.java | 62 ++++++++++++++++--- .../V3DiscoveryServerXdsDeltaResourcesIT.java | 3 + .../server/V3DiscoveryServerXdsIT.java | 1 + .../controlplane/server/V3TestSnapshots.java | 10 ++- tools/API_SHAS | 4 +- tools/envoy_release | 2 +- 20 files changed, 235 insertions(+), 32 deletions(-) diff --git a/cache/src/main/java/io/envoyproxy/controlplane/cache/Resources.java b/cache/src/main/java/io/envoyproxy/controlplane/cache/Resources.java index b405005aa..0e97f628e 100644 --- a/cache/src/main/java/io/envoyproxy/controlplane/cache/Resources.java +++ b/cache/src/main/java/io/envoyproxy/controlplane/cache/Resources.java @@ -6,6 +6,7 @@ import static io.envoyproxy.controlplane.cache.Resources.ResourceType.ENDPOINT; import static io.envoyproxy.controlplane.cache.Resources.ResourceType.LISTENER; import static io.envoyproxy.controlplane.cache.Resources.ResourceType.ROUTE; +import static io.envoyproxy.controlplane.cache.Resources.ResourceType.SCOPED_ROUTE; import static io.envoyproxy.controlplane.cache.Resources.ResourceType.SECRET; import com.google.common.base.Preconditions; @@ -21,6 +22,7 @@ import io.envoyproxy.envoy.config.listener.v3.FilterChain; import io.envoyproxy.envoy.config.listener.v3.Listener; import io.envoyproxy.envoy.config.route.v3.RouteConfiguration; +import io.envoyproxy.envoy.config.route.v3.ScopedRouteConfiguration; import io.envoyproxy.envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager; import io.envoyproxy.envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.RouteSpecifierCase; import io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.Secret; @@ -42,6 +44,7 @@ public enum ResourceType { ENDPOINT, LISTENER, ROUTE, + SCOPED_ROUTE, SECRET } @@ -64,6 +67,8 @@ public static class V3 { "type.googleapis.com/envoy.config.listener.v3" + ".Listener"; public static final String ROUTE_TYPE_URL = "type.googleapis.com/envoy.config.route.v3" + ".RouteConfiguration"; + public static final String SCOPED_ROUTE_TYPE_URL = + "type.googleapis.com/envoy.config.route.v3" + ".ScopedRouteConfiguration"; public static final String SECRET_TYPE_URL = "type.googleapis.com/envoy.extensions" + ".transport_sockets.tls.v3.Secret"; @@ -73,11 +78,12 @@ public static class V3 { ENDPOINT_TYPE_URL, LISTENER_TYPE_URL, ROUTE_TYPE_URL, + SCOPED_ROUTE_TYPE_URL, SECRET_TYPE_URL); } public static final List RESOURCE_TYPES_IN_ORDER = - ImmutableList.of(CLUSTER, ENDPOINT, LISTENER, ROUTE, SECRET); + ImmutableList.of(CLUSTER, ENDPOINT, LISTENER, ROUTE, SCOPED_ROUTE, SECRET); public static final Map TYPE_URLS_TO_RESOURCE_TYPE = new ImmutableMap.Builder() @@ -85,6 +91,7 @@ public static class V3 { .put(Resources.V3.ENDPOINT_TYPE_URL, ENDPOINT) .put(Resources.V3.LISTENER_TYPE_URL, LISTENER) .put(Resources.V3.ROUTE_TYPE_URL, ROUTE) + .put(Resources.V3.SCOPED_ROUTE_TYPE_URL, SCOPED_ROUTE) .put(Resources.V3.SECRET_TYPE_URL, SECRET) .build(); @@ -94,6 +101,7 @@ public static class V3 { .put(Resources.V3.ENDPOINT_TYPE_URL, ClusterLoadAssignment.class) .put(Resources.V3.LISTENER_TYPE_URL, Listener.class) .put(Resources.V3.ROUTE_TYPE_URL, RouteConfiguration.class) + .put(Resources.V3.SCOPED_ROUTE_TYPE_URL, ScopedRouteConfiguration.class) .put(Resources.V3.SECRET_TYPE_URL, Secret.class) .build(); @@ -119,6 +127,10 @@ public static String getResourceName(Message resource) { return ((RouteConfiguration) resource).getName(); } + if (resource instanceof ScopedRouteConfiguration) { + return ((ScopedRouteConfiguration) resource).getName(); + } + if (resource instanceof Secret) { return ((Secret) resource).getName(); } @@ -173,6 +185,11 @@ public static Set getResourceReferences(Collection Set getResourceReferences(Collection clusters, Iterable endpoints, Iterable listeners, Iterable routes, + Iterable scopedRoutes, Iterable secrets, String version) { @@ -55,6 +58,8 @@ public static Snapshot create( .create(generateSnapshotResourceIterable(listeners), version), SnapshotResources .create(generateSnapshotResourceIterable(routes), version), + SnapshotResources + .create(generateSnapshotResourceIterable(scopedRoutes), version), SnapshotResources .create(generateSnapshotResourceIterable(secrets), version)); } @@ -63,14 +68,16 @@ public static Snapshot create( * Returns a new {@link io.envoyproxy.controlplane.cache.v3.Snapshot} instance that has separate versions for each * resource type. * - * @param clusters the cluster resources in this snapshot - * @param clustersVersion the version of the cluster resources - * @param endpoints the endpoint resources in this snapshot - * @param endpointsVersion the version of the endpoint resources - * @param listeners the listener resources in this snapshot - * @param listenersVersion the version of the listener resources - * @param routes the route resources in this snapshot - * @param routesVersion the version of the route resources + * @param clusters the cluster resources in this snapshot + * @param clustersVersion the version of the cluster resources + * @param endpoints the endpoint resources in this snapshot + * @param endpointsVersion the version of the endpoint resources + * @param listeners the listener resources in this snapshot + * @param listenersVersion the version of the listener resources + * @param routes the route resources in this snapshot + * @param routesVersion the version of the route resources + * @param scopedRoutes the route resources in this snapshot + * @param scopedRoutesVersion the version of the route resources */ public static Snapshot create( Iterable clusters, @@ -81,6 +88,8 @@ public static Snapshot create( String listenersVersion, Iterable routes, String routesVersion, + Iterable scopedRoutes, + String scopedRoutesVersion, Iterable secrets, String secretsVersion) { @@ -94,6 +103,8 @@ public static Snapshot create( listenersVersion), SnapshotResources .create(generateSnapshotResourceIterable(routes), routesVersion), + SnapshotResources + .create(generateSnapshotResourceIterable(scopedRoutes), scopedRoutesVersion), SnapshotResources.create(generateSnapshotResourceIterable(secrets), secretsVersion)); } @@ -105,7 +116,7 @@ public static Snapshot create( */ public static Snapshot createEmpty(String version) { return create(Collections.emptySet(), Collections.emptySet(), - Collections.emptySet(), Collections.emptySet(), Collections.emptySet(), version); + Collections.emptySet(), Collections.emptySet(), Collections.emptySet(), Collections.emptySet(), version); } /** @@ -128,6 +139,11 @@ public static Snapshot createEmpty(String version) { */ public abstract SnapshotResources routes(); + /** + * Returns all scoped route items in the SRDS payload. + */ + public abstract SnapshotResources scopedRoutes(); + /** * Returns all secret items in the SDS payload. */ @@ -154,6 +170,14 @@ public void ensureConsistent() throws SnapshotConsistencyException { ensureAllResourceNamesExist(Resources.V3.LISTENER_TYPE_URL, Resources.V3.ROUTE_TYPE_URL, listenerRouteRefs, routes().versionedResources()); + + Set srdsRefs = Resources.getResourceReferences(scopedRoutes().versionedResources().values()); + ensureAllResourceNamesExist( + Resources.V3.SCOPED_ROUTE_TYPE_URL, + Resources.V3.ROUTE_TYPE_URL, + srdsRefs, + routes().versionedResources() + ); } /** @@ -189,6 +213,8 @@ public Map> resources(String typeUrl) { return (Map) listeners().resources(); case ROUTE: return (Map) routes().resources(); + case SCOPED_ROUTE: + return (Map) scopedRoutes().resources(); case SECRET: return (Map) secrets().resources(); default: @@ -211,6 +237,8 @@ public Map> versionedResources(ResourceType resourc return (Map) listeners().versionedResources(); case ROUTE: return (Map) routes().versionedResources(); + case SCOPED_ROUTE: + return (Map) scopedRoutes().versionedResources(); case SECRET: return (Map) secrets().versionedResources(); default: @@ -266,6 +294,8 @@ public String version(ResourceType resourceType, List resourceNames) { return listeners().version(resourceNames); case ROUTE: return routes().version(resourceNames); + case SCOPED_ROUTE: + return scopedRoutes().version(resourceNames); case SECRET: return secrets().version(resourceNames); default: diff --git a/cache/src/test/java/io/envoyproxy/controlplane/cache/ResourcesTest.java b/cache/src/test/java/io/envoyproxy/controlplane/cache/ResourcesTest.java index a3c7522f2..14fdc1b9e 100644 --- a/cache/src/test/java/io/envoyproxy/controlplane/cache/ResourcesTest.java +++ b/cache/src/test/java/io/envoyproxy/controlplane/cache/ResourcesTest.java @@ -98,7 +98,7 @@ public void getResourceReferencesReturnsExpectedReferencesForValidResourceMessag .put((Collection)ImmutableList.of(ROUTE), ImmutableSet.of()) .put( (Collection) ImmutableList.of(CLUSTER, ENDPOINT, LISTENER, ROUTE), - (Collection) ImmutableSet.of(CLUSTER_NAME, ROUTE_NAME)) + ImmutableSet.of(CLUSTER_NAME, ROUTE_NAME)) .build(); cases.forEach( diff --git a/cache/src/test/java/io/envoyproxy/controlplane/cache/v3/SimpleCacheTest.java b/cache/src/test/java/io/envoyproxy/controlplane/cache/v3/SimpleCacheTest.java index b8654f6ba..8d99fc0bf 100644 --- a/cache/src/test/java/io/envoyproxy/controlplane/cache/v3/SimpleCacheTest.java +++ b/cache/src/test/java/io/envoyproxy/controlplane/cache/v3/SimpleCacheTest.java @@ -2,6 +2,7 @@ import static io.envoyproxy.controlplane.cache.Resources.V3.CLUSTER_TYPE_URL; import static io.envoyproxy.controlplane.cache.Resources.V3.ROUTE_TYPE_URL; +import static io.envoyproxy.controlplane.cache.Resources.V3.SCOPED_ROUTE_TYPE_URL; import static org.assertj.core.api.Assertions.assertThat; import com.google.common.collect.ImmutableList; @@ -19,6 +20,7 @@ import io.envoyproxy.envoy.config.endpoint.v3.ClusterLoadAssignment; import io.envoyproxy.envoy.config.listener.v3.Listener; import io.envoyproxy.envoy.config.route.v3.RouteConfiguration; +import io.envoyproxy.envoy.config.route.v3.ScopedRouteConfiguration; import io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.Secret; import io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest; import java.util.Collections; @@ -39,6 +41,7 @@ public class SimpleCacheTest { private static final String SECONDARY_CLUSTER_NAME = "cluster1"; private static final String LISTENER_NAME = "listener0"; private static final String ROUTE_NAME = "route0"; + private static final String SCOPED_ROUTE_NAME = "scoped_route0"; private static final String SECRET_NAME = "secret0"; private static final String VERSION1 = UUID.randomUUID().toString(); @@ -49,6 +52,7 @@ public class SimpleCacheTest { ImmutableList.of(ClusterLoadAssignment.getDefaultInstance()), ImmutableList.of(Listener.newBuilder().setName(LISTENER_NAME).build()), ImmutableList.of(RouteConfiguration.newBuilder().setName(ROUTE_NAME).build()), + ImmutableList.of(ScopedRouteConfiguration.newBuilder().setName(SCOPED_ROUTE_NAME).build()), ImmutableList.of(Secret.newBuilder().setName(SECRET_NAME).build()), VERSION1); @@ -57,6 +61,7 @@ public class SimpleCacheTest { ImmutableList.of(ClusterLoadAssignment.getDefaultInstance()), ImmutableList.of(Listener.newBuilder().setName(LISTENER_NAME).build()), ImmutableList.of(RouteConfiguration.newBuilder().setName(ROUTE_NAME).build()), + ImmutableList.of(ScopedRouteConfiguration.newBuilder().setName(SCOPED_ROUTE_NAME).build()), ImmutableList.of(Secret.newBuilder().setName(SECRET_NAME).build()), VERSION2); @@ -67,6 +72,7 @@ public class SimpleCacheTest { ClusterLoadAssignment.newBuilder().setClusterName(SECONDARY_CLUSTER_NAME).build()), ImmutableList.of(Listener.newBuilder().setName(LISTENER_NAME).build()), ImmutableList.of(RouteConfiguration.newBuilder().setName(ROUTE_NAME).build()), + ImmutableList.of(ScopedRouteConfiguration.newBuilder().setName(SCOPED_ROUTE_NAME).build()), ImmutableList.of(Secret.newBuilder().setName(SECRET_NAME).build()), VERSION2); @@ -297,6 +303,7 @@ public void successfullyWatchAllResourceTypesWithSetBeforeWatchWithRequestVersio Resources.V3.CLUSTER_TYPE_URL, Resources.V3.ENDPOINT_TYPE_URL, Resources.V3.ENDPOINT_TYPE_URL, Resources.V3.LISTENER_TYPE_URL, Resources.V3.LISTENER_TYPE_URL, ROUTE_TYPE_URL, ROUTE_TYPE_URL, + SCOPED_ROUTE_TYPE_URL, SCOPED_ROUTE_TYPE_URL, Resources.V3.SECRET_TYPE_URL, Resources.V3.SECRET_TYPE_URL); } @@ -460,7 +467,8 @@ public void watchesAreReleasedAfterCancel() { public void watchIsLeftOpenIfNotRespondedImmediately() { SimpleCache cache = new SimpleCache<>(new SingleNodeGroup()); cache.setSnapshot(SingleNodeGroup.GROUP, Snapshot.create( - ImmutableList.of(), ImmutableList.of(), ImmutableList.of(), ImmutableList.of(), ImmutableList.of(), VERSION1)); + ImmutableList.of(), ImmutableList.of(), ImmutableList.of(), ImmutableList.of(), ImmutableList.of(), + ImmutableList.of(), VERSION1)); ResponseTracker responseTracker = new ResponseTracker(); Watch watch = cache.createWatch( diff --git a/cache/src/test/java/io/envoyproxy/controlplane/cache/v3/SnapshotTest.java b/cache/src/test/java/io/envoyproxy/controlplane/cache/v3/SnapshotTest.java index d40b02bd6..1d1d4312d 100644 --- a/cache/src/test/java/io/envoyproxy/controlplane/cache/v3/SnapshotTest.java +++ b/cache/src/test/java/io/envoyproxy/controlplane/cache/v3/SnapshotTest.java @@ -4,6 +4,7 @@ import static io.envoyproxy.controlplane.cache.Resources.V3.ENDPOINT_TYPE_URL; import static io.envoyproxy.controlplane.cache.Resources.V3.LISTENER_TYPE_URL; import static io.envoyproxy.controlplane.cache.Resources.V3.ROUTE_TYPE_URL; +import static io.envoyproxy.controlplane.cache.Resources.V3.SCOPED_ROUTE_TYPE_URL; import static io.envoyproxy.envoy.config.core.v3.ApiVersion.V3; import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; @@ -17,6 +18,7 @@ import io.envoyproxy.envoy.config.endpoint.v3.ClusterLoadAssignment; import io.envoyproxy.envoy.config.listener.v3.Listener; import io.envoyproxy.envoy.config.route.v3.RouteConfiguration; +import io.envoyproxy.envoy.config.route.v3.ScopedRouteConfiguration; import io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.Secret; import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; @@ -28,6 +30,7 @@ public class SnapshotTest { private static final String CLUSTER_NAME = "cluster0"; private static final String LISTENER_NAME = "listener0"; private static final String ROUTE_NAME = "route0"; + private static final String SCOPED_ROUTE_NAME = "scoped_route0"; private static final String SECRET_NAME = "secret0"; private static final int ENDPOINT_PORT = ThreadLocalRandom.current().nextInt(10000, 20000); @@ -40,6 +43,8 @@ public class SnapshotTest { LISTENER = TestResources.createListener(ADS, false, V3, V3, LISTENER_NAME, LISTENER_PORT, ROUTE_NAME); private static final RouteConfiguration ROUTE = TestResources.createRoute(ROUTE_NAME, CLUSTER_NAME); + private static final ScopedRouteConfiguration SCOPED_ROUTE = TestResources.createScopedRoute(SCOPED_ROUTE_NAME, + ROUTE_NAME); private static final Secret SECRET = TestResources.createSecret(SECRET_NAME); @Test @@ -51,6 +56,7 @@ public void createSingleVersionSetsResourcesCorrectly() { ImmutableList.of(ENDPOINT), ImmutableList.of(LISTENER), ImmutableList.of(ROUTE), + ImmutableList.of(SCOPED_ROUTE), ImmutableList.of(SECRET), version); @@ -70,10 +76,15 @@ public void createSingleVersionSetsResourcesCorrectly() { .containsEntry(ROUTE_NAME, ROUTE) .hasSize(1); + assertThat(snapshot.scopedRoutes().resources()) + .containsEntry(SCOPED_ROUTE_NAME, SCOPED_ROUTE) + .hasSize(1); + assertThat(snapshot.clusters().version()).isEqualTo(version); assertThat(snapshot.endpoints().version()).isEqualTo(version); assertThat(snapshot.listeners().version()).isEqualTo(version); assertThat(snapshot.routes().version()).isEqualTo(version); + assertThat(snapshot.scopedRoutes().version()).isEqualTo(version); } @Test @@ -82,6 +93,7 @@ public void createSeparateVersionsSetsResourcesCorrectly() { final String endpointsVersion = UUID.randomUUID().toString(); final String listenersVersion = UUID.randomUUID().toString(); final String routesVersion = UUID.randomUUID().toString(); + final String scopedRoutesVersion = UUID.randomUUID().toString(); final String secretsVersion = UUID.randomUUID().toString(); Snapshot snapshot = Snapshot.create( @@ -89,6 +101,7 @@ public void createSeparateVersionsSetsResourcesCorrectly() { ImmutableList.of(ENDPOINT), endpointsVersion, ImmutableList.of(LISTENER), listenersVersion, ImmutableList.of(ROUTE), routesVersion, + ImmutableList.of(SCOPED_ROUTE), scopedRoutesVersion, ImmutableList.of(SECRET), secretsVersion ); @@ -108,10 +121,15 @@ public void createSeparateVersionsSetsResourcesCorrectly() { .containsEntry(ROUTE_NAME, ROUTE) .hasSize(1); + assertThat(snapshot.scopedRoutes().resources()) + .containsEntry(SCOPED_ROUTE_NAME, SCOPED_ROUTE) + .hasSize(1); + assertThat(snapshot.clusters().version()).isEqualTo(clustersVersion); assertThat(snapshot.endpoints().version()).isEqualTo(endpointsVersion); assertThat(snapshot.listeners().version()).isEqualTo(listenersVersion); assertThat(snapshot.routes().version()).isEqualTo(routesVersion); + assertThat(snapshot.scopedRoutes().version()).isEqualTo(scopedRoutesVersion); } @Test @@ -122,6 +140,7 @@ public void resourcesReturnsExpectedResources() { ImmutableList.of(ENDPOINT), ImmutableList.of(LISTENER), ImmutableList.of(ROUTE), + ImmutableList.of(SCOPED_ROUTE), ImmutableList.of(SECRET), UUID.randomUUID().toString()); @@ -145,6 +164,10 @@ public void resourcesReturnsExpectedResources() { .containsEntry(ROUTE_NAME, VersionedResource.create(ROUTE)) .hasSize(1); + assertThat(snapshot.resources(SCOPED_ROUTE_TYPE_URL)) + .containsEntry(SCOPED_ROUTE_NAME, VersionedResource.create(SCOPED_ROUTE)) + .hasSize(1); + String nullString = null; assertThat(snapshot.resources(nullString)).isEmpty(); assertThat(snapshot.resources("")).isEmpty(); @@ -160,6 +183,7 @@ public void versionReturnsExpectedVersion() { ImmutableList.of(ENDPOINT), ImmutableList.of(LISTENER), ImmutableList.of(ROUTE), + ImmutableList.of(SCOPED_ROUTE), ImmutableList.of(SECRET), version); @@ -167,6 +191,7 @@ public void versionReturnsExpectedVersion() { assertThat(snapshot.version(ENDPOINT_TYPE_URL)).isEqualTo(version); assertThat(snapshot.version(LISTENER_TYPE_URL)).isEqualTo(version); assertThat(snapshot.version(ROUTE_TYPE_URL)).isEqualTo(version); + assertThat(snapshot.version(SCOPED_ROUTE_TYPE_URL)).isEqualTo(version); String nullString = null; assertThat(snapshot.resources(nullString)).isEmpty(); @@ -182,6 +207,7 @@ public void ensureConsistentReturnsWithoutExceptionForConsistentSnapshot() ImmutableList.of(ENDPOINT), ImmutableList.of(LISTENER), ImmutableList.of(ROUTE), + ImmutableList.of(SCOPED_ROUTE), ImmutableList.of(SECRET), UUID.randomUUID().toString()); @@ -195,6 +221,7 @@ public void ensureConsistentThrowsIfEndpointOrRouteRefCountMismatch() { ImmutableList.of(), ImmutableList.of(LISTENER), ImmutableList.of(ROUTE), + ImmutableList.of(SCOPED_ROUTE), ImmutableList.of(SECRET), UUID.randomUUID().toString()); @@ -211,6 +238,7 @@ public void ensureConsistentThrowsIfEndpointOrRouteRefCountMismatch() { ImmutableList.of(ENDPOINT), ImmutableList.of(LISTENER), ImmutableList.of(), + ImmutableList.of(SCOPED_ROUTE), ImmutableList.of(SECRET), UUID.randomUUID().toString()); @@ -233,6 +261,7 @@ public void ensureConsistentThrowsIfEndpointOrRouteNamesMismatch() { ImmutableList.of(TestResources.createEndpoint(otherClusterName, ENDPOINT_PORT)), ImmutableList.of(LISTENER), ImmutableList.of(ROUTE), + ImmutableList.of(SCOPED_ROUTE), ImmutableList.of(SECRET), UUID.randomUUID().toString()); @@ -250,6 +279,7 @@ public void ensureConsistentThrowsIfEndpointOrRouteNamesMismatch() { ImmutableList.of(ENDPOINT), ImmutableList.of(LISTENER), ImmutableList.of(TestResources.createRoute(otherRouteName, CLUSTER_NAME)), + ImmutableList.of(SCOPED_ROUTE), ImmutableList.of(SECRET), UUID.randomUUID().toString()); diff --git a/server/src/main/java/io/envoyproxy/controlplane/server/V3DiscoveryServer.java b/server/src/main/java/io/envoyproxy/controlplane/server/V3DiscoveryServer.java index 3c3621c62..8c6e2f283 100644 --- a/server/src/main/java/io/envoyproxy/controlplane/server/V3DiscoveryServer.java +++ b/server/src/main/java/io/envoyproxy/controlplane/server/V3DiscoveryServer.java @@ -4,6 +4,7 @@ import static io.envoyproxy.envoy.service.endpoint.v3.EndpointDiscoveryServiceGrpc.EndpointDiscoveryServiceImplBase; import static io.envoyproxy.envoy.service.listener.v3.ListenerDiscoveryServiceGrpc.ListenerDiscoveryServiceImplBase; import static io.envoyproxy.envoy.service.route.v3.RouteDiscoveryServiceGrpc.RouteDiscoveryServiceImplBase; +import static io.envoyproxy.envoy.service.route.v3.ScopedRoutesDiscoveryServiceGrpc.ScopedRoutesDiscoveryServiceImplBase; import static io.envoyproxy.envoy.service.secret.v3.SecretDiscoveryServiceGrpc.SecretDiscoveryServiceImplBase; import com.google.common.base.Preconditions; @@ -164,6 +165,25 @@ public StreamObserver deltaRoutes( }; } + /** + * Returns a SRDS implementation that uses this server's {@link ConfigWatcher}. + */ + public ScopedRoutesDiscoveryServiceImplBase getScopedRoutesDiscoveryServiceImpl() { + return new ScopedRoutesDiscoveryServiceImplBase() { + @Override + public StreamObserver streamScopedRoutes( + StreamObserver responseObserver) { + return createRequestHandler(responseObserver, false, Resources.V3.SCOPED_ROUTE_TYPE_URL); + } + + @Override + public StreamObserver deltaScopedRoutes( + StreamObserver responseObserver) { + return createDeltaRequestHandler(responseObserver, false, Resources.V3.SCOPED_ROUTE_TYPE_URL); + } + }; + } + /** * Returns a SDS implementation that uses this server's {@link ConfigWatcher}. */ diff --git a/server/src/test/java/io/envoyproxy/controlplane/server/EnvoyContainer.java b/server/src/test/java/io/envoyproxy/controlplane/server/EnvoyContainer.java index e4ce480cc..f9fedd75c 100644 --- a/server/src/test/java/io/envoyproxy/controlplane/server/EnvoyContainer.java +++ b/server/src/test/java/io/envoyproxy/controlplane/server/EnvoyContainer.java @@ -24,7 +24,7 @@ class EnvoyContainer extends GenericContainer { EnvoyContainer(String config, Supplier controlPlanePortSupplier) { // this version is changed automatically by /tools/update-sha.sh:57 // if you change it make sure to reflect changes there - super("envoyproxy/envoy:v1.34.0"); + super("envoyproxy/envoy:v1.34.10"); this.config = config; this.controlPlanePortSupplier = controlPlanePortSupplier; } diff --git a/server/src/test/java/io/envoyproxy/controlplane/server/TestMain.java b/server/src/test/java/io/envoyproxy/controlplane/server/TestMain.java index 713ff1294..6da5279b7 100644 --- a/server/src/test/java/io/envoyproxy/controlplane/server/TestMain.java +++ b/server/src/test/java/io/envoyproxy/controlplane/server/TestMain.java @@ -34,6 +34,7 @@ public static void main(String[] arg) throws IOException, InterruptedException { ImmutableList.of(), ImmutableList.of(), ImmutableList.of(), + ImmutableList.of(), "1")); V3DiscoveryServer v3DiscoveryServer = new V3DiscoveryServer(cache); @@ -66,6 +67,7 @@ public static void main(String[] arg) throws IOException, InterruptedException { ImmutableList.of(), ImmutableList.of(), ImmutableList.of(), + ImmutableList.of(), "1")); server.awaitTermination(); diff --git a/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsAllowDefaultEmptyEdsIT.java b/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsAllowDefaultEmptyEdsIT.java index a631a566a..76b94dd73 100644 --- a/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsAllowDefaultEmptyEdsIT.java +++ b/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsAllowDefaultEmptyEdsIT.java @@ -14,6 +14,7 @@ import io.envoyproxy.envoy.config.endpoint.v3.ClusterLoadAssignment; import io.envoyproxy.envoy.config.listener.v3.Listener; import io.envoyproxy.envoy.config.route.v3.RouteConfiguration; +import io.envoyproxy.envoy.config.route.v3.ScopedRouteConfiguration; import io.grpc.netty.NettyServerBuilder; import io.restassured.http.ContentType; import java.util.Collections; @@ -58,6 +59,8 @@ protected void configureServerBuilder(NettyServerBuilder builder) { Listener listener = TestResources.createListener(true, false, V3, V3, "listener0", LISTENER_PORT, "route0"); RouteConfiguration route = TestResources.createRoute("route0", "upstream"); + ScopedRouteConfiguration scopedRoute = TestResources.createScopedRoute("scoped_route0", + "route0"); // Construct a snapshot with no_endpoints clusters which does not have EDS data Snapshot snapshot = Snapshot.create( @@ -65,6 +68,7 @@ protected void configureServerBuilder(NettyServerBuilder builder) { ImmutableList.of(endpoint), ImmutableList.of(listener), ImmutableList.of(route), + ImmutableList.of(scopedRoute), ImmutableList.of(), "1"); diff --git a/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsDeltaResourcesIT.java b/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsDeltaResourcesIT.java index 7bc4c4036..c6a08839f 100644 --- a/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsDeltaResourcesIT.java +++ b/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsDeltaResourcesIT.java @@ -54,6 +54,7 @@ protected void configureServerBuilder(NettyServerBuilder builder) { "listener0", LISTENER_PORT, "route0", + "scoped_route0", "1"); LOGGER.info("snapshot={}", snapshot); cache.setSnapshot( @@ -123,6 +124,7 @@ public void validateTestRequestToEchoServerViaEnvoy() throws InterruptedExceptio "listener1", LISTENER_PORT, "route0", + "scoped_route0", "2"); LOGGER.info("snapshot={}", snapshot); cache.setSnapshot( @@ -151,6 +153,7 @@ public void validateTestRequestToEchoServerViaEnvoy() throws InterruptedExceptio "listener1", LISTENER_PORT, "route0", + "scoped_route0", "3"); LOGGER.info("snapshot={}", snapshot); cache.setSnapshot( diff --git a/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsIT.java b/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsIT.java index 98061ef28..15625cfb4 100644 --- a/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsIT.java +++ b/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsIT.java @@ -49,6 +49,7 @@ protected void configureServerBuilder(NettyServerBuilder builder) { "listener0", LISTENER_PORT, "route0", + "scoped_route0", "1")); V3DiscoveryServer server = new V3DiscoveryServer(callbacks, cache); diff --git a/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsStreamOpenExceptionIT.java b/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsStreamOpenExceptionIT.java index 49f5db630..3317e00b4 100644 --- a/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsStreamOpenExceptionIT.java +++ b/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsStreamOpenExceptionIT.java @@ -60,6 +60,7 @@ protected void configureServerBuilder(NettyServerBuilder builder) { "listener0", LISTENER_PORT, "route0", + "scoped_route0", "1")); V3DiscoveryServer server = new V3DiscoveryServer(callbacks, cache); diff --git a/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsWarmingClusterIT.java b/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsWarmingClusterIT.java index 26eeceb69..ab86d6997 100644 --- a/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsWarmingClusterIT.java +++ b/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerAdsWarmingClusterIT.java @@ -18,6 +18,7 @@ import io.envoyproxy.envoy.config.endpoint.v3.ClusterLoadAssignment; import io.envoyproxy.envoy.config.listener.v3.Listener; import io.envoyproxy.envoy.config.route.v3.RouteConfiguration; +import io.envoyproxy.envoy.config.route.v3.ScopedRouteConfiguration; import io.envoyproxy.envoy.extensions.upstreams.http.v3.HttpProtocolOptions; import io.envoyproxy.envoy.service.discovery.v3.DeltaDiscoveryRequest; import io.envoyproxy.envoy.service.discovery.v3.DiscoveryRequest; @@ -82,7 +83,8 @@ public void onV3StreamResponse(long streamId, DiscoveryRequest request, EchoContainer.PORT, "listener0", LISTENER_PORT, - "route0")); + "route0", + "scoped_route0")); V3DiscoveryServer server = new V3DiscoveryServer(callbacks, cache); @@ -145,6 +147,7 @@ private static void createSnapshotWithWorkingClusterWithTheSameEdsVersion() { "listener0", LISTENER_PORT, "route0", + "scoped_route0", "2")); } @@ -154,7 +157,8 @@ private static Snapshot createSnapshotWithNotWorkingCluster(boolean ads, int endpointPort, String listenerName, int listenerPort, - String routeName) { + String routeName, + String scopedRouteName) { ConfigSource edsSource = ConfigSource.newBuilder() .setAds(AggregatedConfigSource.getDefaultInstance()) @@ -184,6 +188,7 @@ private static Snapshot createSnapshotWithNotWorkingCluster(boolean ads, Listener listener = TestResources.createListener(ads, false, V3, V3, listenerName, listenerPort, routeName); RouteConfiguration route = TestResources.createRoute(routeName, clusterName); + ScopedRouteConfiguration scopedRoute = TestResources.createScopedRoute(scopedRouteName, routeName); // here we have new version of resources other than CDS. return Snapshot.create( @@ -195,6 +200,8 @@ private static Snapshot createSnapshotWithNotWorkingCluster(boolean ads, "2", ImmutableList.of(route), "2", + ImmutableList.of(scopedRoute), + "2", ImmutableList.of(), "2"); } diff --git a/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerTest.java b/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerTest.java index 6e41b4282..deb68490e 100644 --- a/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerTest.java +++ b/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerTest.java @@ -27,6 +27,7 @@ import io.envoyproxy.envoy.config.endpoint.v3.ClusterLoadAssignment; import io.envoyproxy.envoy.config.listener.v3.Listener; import io.envoyproxy.envoy.config.route.v3.RouteConfiguration; +import io.envoyproxy.envoy.config.route.v3.ScopedRouteConfiguration; import io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.Secret; import io.envoyproxy.envoy.service.cluster.v3.ClusterDiscoveryServiceGrpc; import io.envoyproxy.envoy.service.cluster.v3.ClusterDiscoveryServiceGrpc.ClusterDiscoveryServiceStub; @@ -41,6 +42,8 @@ import io.envoyproxy.envoy.service.listener.v3.ListenerDiscoveryServiceGrpc.ListenerDiscoveryServiceStub; import io.envoyproxy.envoy.service.route.v3.RouteDiscoveryServiceGrpc; import io.envoyproxy.envoy.service.route.v3.RouteDiscoveryServiceGrpc.RouteDiscoveryServiceStub; +import io.envoyproxy.envoy.service.route.v3.ScopedRoutesDiscoveryServiceGrpc; +import io.envoyproxy.envoy.service.route.v3.ScopedRoutesDiscoveryServiceGrpc.ScopedRoutesDiscoveryServiceStub; import io.envoyproxy.envoy.service.secret.v3.SecretDiscoveryServiceGrpc; import io.envoyproxy.envoy.service.secret.v3.SecretDiscoveryServiceGrpc.SecretDiscoveryServiceStub; import io.grpc.Status; @@ -71,10 +74,11 @@ public class V3DiscoveryServerTest { private static final boolean ADS = ThreadLocalRandom.current().nextBoolean(); - private static final String CLUSTER_NAME = "cluster0"; - private static final String LISTENER_NAME = "listener0"; - private static final String ROUTE_NAME = "route0"; - private static final String SECRET_NAME = "secret0"; + private static final String CLUSTER_NAME = "cluster0"; + private static final String LISTENER_NAME = "listener0"; + private static final String ROUTE_NAME = "route0"; + private static final String SCOPED_ROUTE_NAME = "scoped_route0"; + private static final String SECRET_NAME = "secret0"; private static final int ENDPOINT_PORT = Ports.getAvailablePort(); private static final int LISTENER_PORT = Ports.getAvailablePort(); @@ -94,6 +98,8 @@ public class V3DiscoveryServerTest { ROUTE_NAME); private static final RouteConfiguration ROUTE = TestResources.createRoute(ROUTE_NAME, CLUSTER_NAME); + private static final ScopedRouteConfiguration SCOPED_ROUTE = TestResources.createScopedRoute(SCOPED_ROUTE_NAME, + ROUTE_NAME); private static final Secret SECRET = TestResources.createSecret(SECRET_NAME); @Rule @@ -134,6 +140,12 @@ public void testAggregatedHandler() throws InterruptedException { .addResourceNames(ROUTE_NAME) .build()); + requestObserver.onNext(DiscoveryRequest.newBuilder() + .setNode(NODE) + .setTypeUrl(Resources.V3.SCOPED_ROUTE_TYPE_URL) + .addResourceNames(SCOPED_ROUTE_NAME) + .build()); + requestObserver.onNext(DiscoveryRequest.newBuilder() .setNode(NODE) .setTypeUrl(Resources.V3.SECRET_TYPE_URL) @@ -170,12 +182,15 @@ public void testSeparateHandlers() throws InterruptedException { grpcServer.getServiceRegistry().addService(server.getEndpointDiscoveryServiceImpl()); grpcServer.getServiceRegistry().addService(server.getListenerDiscoveryServiceImpl()); grpcServer.getServiceRegistry().addService(server.getRouteDiscoveryServiceImpl()); + grpcServer.getServiceRegistry().addService(server.getScopedRoutesDiscoveryServiceImpl()); grpcServer.getServiceRegistry().addService(server.getSecretDiscoveryServiceImpl()); ClusterDiscoveryServiceStub clusterStub = ClusterDiscoveryServiceGrpc.newStub(grpcServer.getChannel()); EndpointDiscoveryServiceStub endpointStub = EndpointDiscoveryServiceGrpc.newStub(grpcServer.getChannel()); ListenerDiscoveryServiceStub listenerStub = ListenerDiscoveryServiceGrpc.newStub(grpcServer.getChannel()); RouteDiscoveryServiceStub routeStub = RouteDiscoveryServiceGrpc.newStub(grpcServer.getChannel()); + ScopedRoutesDiscoveryServiceStub scopedRouteStub = ScopedRoutesDiscoveryServiceGrpc.newStub( + grpcServer.getChannel()); SecretDiscoveryServiceStub secretStub = SecretDiscoveryServiceGrpc.newStub(grpcServer.getChannel()); for (String typeUrl : Resources.V3.TYPE_URLS) { @@ -201,6 +216,10 @@ public void testSeparateHandlers() throws InterruptedException { requestObserver = routeStub.streamRoutes(responseObserver); discoveryRequestBuilder.addResourceNames(ROUTE_NAME); break; + case Resources.V3.SCOPED_ROUTE_TYPE_URL: + requestObserver = scopedRouteStub.streamScopedRoutes(responseObserver); + discoveryRequestBuilder.addResourceNames(ROUTE_NAME); + break; case Resources.V3.SECRET_TYPE_URL: requestObserver = secretStub.streamSecrets(responseObserver); discoveryRequestBuilder.addResourceNames(SECRET_NAME); @@ -371,12 +390,15 @@ public void testSeparateHandlersDefaultRequestType() throws InterruptedException grpcServer.getServiceRegistry().addService(server.getEndpointDiscoveryServiceImpl()); grpcServer.getServiceRegistry().addService(server.getListenerDiscoveryServiceImpl()); grpcServer.getServiceRegistry().addService(server.getRouteDiscoveryServiceImpl()); + grpcServer.getServiceRegistry().addService(server.getScopedRoutesDiscoveryServiceImpl()); grpcServer.getServiceRegistry().addService(server.getSecretDiscoveryServiceImpl()); ClusterDiscoveryServiceStub clusterStub = ClusterDiscoveryServiceGrpc.newStub(grpcServer.getChannel()); EndpointDiscoveryServiceStub endpointStub = EndpointDiscoveryServiceGrpc.newStub(grpcServer.getChannel()); ListenerDiscoveryServiceStub listenerStub = ListenerDiscoveryServiceGrpc.newStub(grpcServer.getChannel()); RouteDiscoveryServiceStub routeStub = RouteDiscoveryServiceGrpc.newStub(grpcServer.getChannel()); + ScopedRoutesDiscoveryServiceStub scopedRouteStub = ScopedRoutesDiscoveryServiceGrpc.newStub( + grpcServer.getChannel()); SecretDiscoveryServiceStub secretStub = SecretDiscoveryServiceGrpc.newStub(grpcServer.getChannel()); for (String typeUrl : Resources.V3.TYPE_URLS) { @@ -397,6 +419,9 @@ public void testSeparateHandlersDefaultRequestType() throws InterruptedException case Resources.V3.ROUTE_TYPE_URL: requestObserver = routeStub.streamRoutes(responseObserver); break; + case Resources.V3.SCOPED_ROUTE_TYPE_URL: + requestObserver = scopedRouteStub.streamScopedRoutes(responseObserver); + break; case Resources.V3.SECRET_TYPE_URL: requestObserver = secretStub.streamSecrets(responseObserver); break; @@ -511,6 +536,12 @@ public void onV3StreamResponse(long streamId, DiscoveryRequest request, .addResourceNames(ROUTE_NAME) .build()); + requestObserver.onNext(DiscoveryRequest.newBuilder() + .setNode(NODE) + .setTypeUrl(Resources.V3.SCOPED_ROUTE_TYPE_URL) + .addResourceNames(SCOPED_ROUTE_NAME) + .build()); + requestObserver.onNext(DiscoveryRequest.newBuilder() .setNode(NODE) .setTypeUrl(Resources.V3.SECRET_TYPE_URL) @@ -559,6 +590,14 @@ public void onV3StreamResponse(long streamId, DiscoveryRequest request, .setVersionInfo(VERSION) .build()); + requestObserver.onNext(DiscoveryRequest.newBuilder() + .setNode(NODE) + .setResponseNonce("3") + .setTypeUrl(Resources.V3.SCOPED_ROUTE_TYPE_URL) + .addResourceNames(SCOPED_ROUTE_NAME) + .setVersionInfo(VERSION) + .build()); + requestObserver.onNext(DiscoveryRequest.newBuilder() .setNode(NODE) .setResponseNonce("4") @@ -658,12 +697,15 @@ public void onV3StreamResponse(long streamId, DiscoveryRequest request, grpcServer.getServiceRegistry().addService(server.getEndpointDiscoveryServiceImpl()); grpcServer.getServiceRegistry().addService(server.getListenerDiscoveryServiceImpl()); grpcServer.getServiceRegistry().addService(server.getRouteDiscoveryServiceImpl()); + grpcServer.getServiceRegistry().addService(server.getScopedRoutesDiscoveryServiceImpl()); grpcServer.getServiceRegistry().addService(server.getSecretDiscoveryServiceImpl()); ClusterDiscoveryServiceStub clusterStub = ClusterDiscoveryServiceGrpc.newStub(grpcServer.getChannel()); EndpointDiscoveryServiceStub endpointStub = EndpointDiscoveryServiceGrpc.newStub(grpcServer.getChannel()); ListenerDiscoveryServiceStub listenerStub = ListenerDiscoveryServiceGrpc.newStub(grpcServer.getChannel()); RouteDiscoveryServiceStub routeStub = RouteDiscoveryServiceGrpc.newStub(grpcServer.getChannel()); + ScopedRoutesDiscoveryServiceStub scopedRouteStub = ScopedRoutesDiscoveryServiceGrpc.newStub( + grpcServer.getChannel()); SecretDiscoveryServiceStub secretStub = SecretDiscoveryServiceGrpc.newStub(grpcServer.getChannel()); for (String typeUrl : Resources.V3.TYPE_URLS) { @@ -684,6 +726,9 @@ public void onV3StreamResponse(long streamId, DiscoveryRequest request, case Resources.V3.ROUTE_TYPE_URL: requestObserver = routeStub.streamRoutes(responseObserver); break; + case Resources.V3.SCOPED_ROUTE_TYPE_URL: + requestObserver = scopedRouteStub.streamScopedRoutes(responseObserver); + break; case Resources.V3.SECRET_TYPE_URL: requestObserver = secretStub.streamSecrets(responseObserver); break; @@ -719,11 +764,11 @@ public void onV3StreamResponse(long streamId, DiscoveryRequest request, callbacks.assertThatNoErrors(); - assertThat(callbacks.streamCloseCount).hasValue(5); + assertThat(callbacks.streamCloseCount).hasValue(6); assertThat(callbacks.streamCloseWithErrorCount).hasValue(0); - assertThat(callbacks.streamOpenCount).hasValue(5); - assertThat(callbacks.streamRequestCount).hasValue(5); - assertThat(callbacks.streamResponseCount).hasValue(5); + assertThat(callbacks.streamOpenCount).hasValue(6); + assertThat(callbacks.streamRequestCount).hasValue(6); + assertThat(callbacks.streamResponseCount).hasValue(6); } @Test @@ -1011,6 +1056,7 @@ private static Table> createRespon .put(Resources.V3.ENDPOINT_TYPE_URL, VERSION, ImmutableList.of(ENDPOINT)) .put(Resources.V3.LISTENER_TYPE_URL, VERSION, ImmutableList.of(LISTENER)) .put(Resources.V3.ROUTE_TYPE_URL, VERSION, ImmutableList.of(ROUTE)) + .put(Resources.V3.SCOPED_ROUTE_TYPE_URL, VERSION, ImmutableList.of(SCOPED_ROUTE)) .put(Resources.V3.SECRET_TYPE_URL, VERSION, ImmutableList.of(SECRET)) .build(); } diff --git a/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerXdsDeltaResourcesIT.java b/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerXdsDeltaResourcesIT.java index 15527f30b..f875f9c0d 100644 --- a/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerXdsDeltaResourcesIT.java +++ b/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerXdsDeltaResourcesIT.java @@ -55,6 +55,7 @@ protected void configureServerBuilder(NettyServerBuilder builder) { "listener0", LISTENER_PORT, "route0", + "scoped_route0", "1"); LOGGER.info("snapshot={}", snapshot); cache.setSnapshot( @@ -129,6 +130,7 @@ public void validateTestRequestToEchoServerViaEnvoy() throws InterruptedExceptio "listener1", LISTENER_PORT, "route0", + "scoped_route0", "2"); LOGGER.info("snapshot={}", snapshot); cache.setSnapshot( @@ -157,6 +159,7 @@ public void validateTestRequestToEchoServerViaEnvoy() throws InterruptedExceptio "listener1", LISTENER_PORT, "route0", + "scoped_route0", "2"); LOGGER.info("snapshot={}", snapshot); cache.setSnapshot( diff --git a/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerXdsIT.java b/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerXdsIT.java index c6cb148c9..8c80a0703 100644 --- a/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerXdsIT.java +++ b/server/src/test/java/io/envoyproxy/controlplane/server/V3DiscoveryServerXdsIT.java @@ -46,6 +46,7 @@ protected void configureServerBuilder(NettyServerBuilder builder) { "listener0", LISTENER_PORT, "route0", + "scoped_route0", "1") ); diff --git a/server/src/test/java/io/envoyproxy/controlplane/server/V3TestSnapshots.java b/server/src/test/java/io/envoyproxy/controlplane/server/V3TestSnapshots.java index 44980eea2..0d7f65547 100644 --- a/server/src/test/java/io/envoyproxy/controlplane/server/V3TestSnapshots.java +++ b/server/src/test/java/io/envoyproxy/controlplane/server/V3TestSnapshots.java @@ -9,6 +9,7 @@ import io.envoyproxy.envoy.config.endpoint.v3.ClusterLoadAssignment; import io.envoyproxy.envoy.config.listener.v3.Listener; import io.envoyproxy.envoy.config.route.v3.RouteConfiguration; +import io.envoyproxy.envoy.config.route.v3.ScopedRouteConfiguration; import org.testcontainers.shaded.com.google.common.collect.ImmutableList; class V3TestSnapshots { @@ -22,6 +23,7 @@ static Snapshot createSnapshot( String listenerName, int listenerPort, String routeName, + String scopedRouteName, String version) { Cluster cluster = TestResources.createCluster(clusterName); @@ -30,12 +32,14 @@ static Snapshot createSnapshot( Listener listener = TestResources.createListener(ads, delta, V3, V3, listenerName, listenerPort, routeName); RouteConfiguration route = TestResources.createRoute(routeName, clusterName); + ScopedRouteConfiguration scopedRoute = TestResources.createScopedRoute(scopedRouteName, routeName); return Snapshot.create( ImmutableList.of(cluster), ImmutableList.of(endpoint), ImmutableList.of(listener), ImmutableList.of(route), + ImmutableList.of(scopedRoute), ImmutableList.of(), version); } @@ -49,9 +53,10 @@ static Snapshot createSnapshotNoEds( String listenerName, int listenerPort, String routeName, + String scopedRouteName, String version) { return createSnapshotNoEds(ads, delta, V3, V3, clusterName, endpointAddress, - endpointPort, listenerName, listenerPort, routeName, version); + endpointPort, listenerName, listenerPort, routeName, scopedRouteName, version); } private static Snapshot createSnapshotNoEds( @@ -65,6 +70,7 @@ private static Snapshot createSnapshotNoEds( String listenerName, int listenerPort, String routeName, + String scopedRouteName, String version) { Cluster cluster = TestResources.createCluster(clusterName, endpointAddress, @@ -73,12 +79,14 @@ private static Snapshot createSnapshotNoEds( .createListener(ads, delta, rdsTransportVersion, rdsResourceVersion, listenerName, listenerPort, routeName); RouteConfiguration route = TestResources.createRoute(routeName, clusterName); + ScopedRouteConfiguration scopedRoute = TestResources.createScopedRoute(scopedRouteName, routeName); return Snapshot.create( ImmutableList.of(cluster), ImmutableList.of(), ImmutableList.of(listener), ImmutableList.of(route), + ImmutableList.of(scopedRoute), ImmutableList.of(), version); } diff --git a/tools/API_SHAS b/tools/API_SHAS index 68e448f87..7bc682ffe 100644 --- a/tools/API_SHAS +++ b/tools/API_SHAS @@ -1,9 +1,9 @@ # Update the versions here and run update-api.sh # envoy (source: SHA from https://github.com/envoyproxy/envoy) -ENVOY_SHA="d7809ba2b07fd869d49bfb122b27f6a7977b4d94" +ENVOY_SHA="40ab4828a48f05103573ddee3c807dfa0e3e23f7" -# dependencies (source: https://github.com/envoyproxy/envoy/blob/d7809ba2b07fd869d49bfb122b27f6a7977b4d94/api/bazel/repository_locations.bzl) +# dependencies (source: https://github.com/envoyproxy/envoy/blob/40ab4828a48f05103573ddee3c807dfa0e3e23f7/api/bazel/repository_locations.bzl) GOOGLEAPIS_SHA="fd52b5754b2b268bc3a22a10f29844f206abb327" # 2024-09-16 PGV_VERSION="1.0.4" # 2024-01-17 PROMETHEUS_SHA="0.6.1" # 2024-04-03 diff --git a/tools/envoy_release b/tools/envoy_release index 995ab8e3f..df04b4862 100644 --- a/tools/envoy_release +++ b/tools/envoy_release @@ -1 +1 @@ -v1.34.0 +v1.34.10