Package io.deephaven.envoysupport.xds
Class EnvoyV3RouteBuilder
java.lang.Object
io.deephaven.envoysupport.xds.EnvoyV3RouteBuilder
Encapsulate the logic of building dynamic routes. This class uses the V3 version of the envoy API.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddDhResolverRoutes(@NotNull com.fishlib.io.logger.Logger log, EnvoyV3DiscoveryService.DhResolverContext dhResolverContext, io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList, @NotNull String[] apiServiceNames, long extraRouteNonce) static voidaddExtraRoutes(io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList, @NotNull Collection<EnvoyExtraRoute> extraRoutes, long extraRouteNonce) Add dynamic routes as configured by envoy.xds.extra.routes properties.static voidaddGrpcRoute(io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList, @NotNull String[] hosts, @org.jetbrains.annotations.NotNull int[] ports, @NotNull String serviceFullPath, long extraRouteNonce) static voidaddMainApiRoute(io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList, @NotNull String mainApiAddress, int webApiPort) Add a dynamic route for the Main API.static voidaddRoute(io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList, @NotNull String[] hosts, int[] ports, @NotNull String prefix, @Nullable String prefixRewrite, boolean useTransportSocketTls, long extraRouteNonce, int timeout, boolean isExactPrefix, boolean isPathMatch, boolean isWebsocket) Helper class.static voidaddRoute(io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList, @NotNull String host, int port, @NotNull String prefix, @Nullable String prefixRewrite, boolean tls, long extraRouteNonce, int timeout, boolean exactPrefix, boolean pathMatch) Add websocket=true and put the single host and port arguments in single-element arrays for the call toaddRoute(VirtualHost.Builder, List, String[], int[], String, String, boolean, long, int, boolean, boolean, boolean)static voidaddRoute(io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList, @NotNull String host, int port, @NotNull String prefix, @Nullable String prefixRewrite, long extraRouteNonce, int timeout) Add tls=true and exactPrefix=false and and pathMatch=false and calladdRoute(VirtualHost.Builder, List, String, int, String, String, boolean, long, int, boolean, boolean)static voidaddStaticRoutes(@NotNull com.fishlib.configuration.Configuration configuration, io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList, long extraRouteNonce) Add dynamic routes for services that defined statically in configuration for gRPC and Comm cases.static voidaddWorkerRoutes(@NotNull Stream<WorkerStreamProvider.WorkerInfo> workerInfoStream, io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList) Add dynamic routes for the workers supplied by the worker stream.static voidenableClusterTls(io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster.Builder clusterBuilder) Enable TLS on the given cluster builder.static io.deephaven.envoysupport.xds.EnvoyV3DiscoveryService.RouteBuildergetDhResolverRouteBuilder(@NotNull com.fishlib.io.logger.Logger log, EnvoyV3DiscoveryService.DhResolverContext dhResolverContext, @NotNull String[] apiServiceNames) static io.deephaven.envoysupport.xds.EnvoyV3DiscoveryService.RouteBuildergetExtraRoutesRouteBuilder(@NotNull com.fishlib.io.logger.Logger log, @NotNull com.fishlib.configuration.Configuration configuration) Create a RouteBuilder that will add routes defined by envoy.xds.extra.routes properties, encapsulating additional required parameters.static io.deephaven.envoysupport.xds.EnvoyV3DiscoveryService.RouteBuildergetMainApiRouteBuilder(@NotNull com.fishlib.configuration.Configuration configuration) Create a RouteBuilder that will add the Main API route, encapsulating additional required parameters.static io.deephaven.envoysupport.xds.EnvoyV3DiscoveryService.RouteBuildergetStaticallyConfiguredRouteBuilder(@NotNull com.fishlib.configuration.Configuration configuration) Create a RouteBuilder that will add routes defined by static configuration, encapsulating additional required parameters.static io.deephaven.envoysupport.xds.EnvoyV3DiscoveryService.RouteBuilderstatic io.deephaven.envoysupport.xds.EnvoyV3DiscoveryService.RouteBuildergetWorkerProcessorRouteBuilder(@NotNull WorkerStreamProvider workerStreamProvider) Create a RouteBuilder that will add routes for workers provided by the given worker stream provider, encapsulating additional required parameters.
-
Constructor Details
-
EnvoyV3RouteBuilder
public EnvoyV3RouteBuilder()
-
-
Method Details
-
enableClusterTls
public static void enableClusterTls(@NotNull io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster.Builder clusterBuilder) Enable TLS on the given cluster builder.- Parameters:
clusterBuilder- operate on this Cluster.Builder
-
getMainApiRouteBuilder
public static io.deephaven.envoysupport.xds.EnvoyV3DiscoveryService.RouteBuilder getMainApiRouteBuilder(@NotNull @NotNull com.fishlib.configuration.Configuration configuration) Create a RouteBuilder that will add the Main API route, encapsulating additional required parameters.- Returns:
- a RouteBuilder
-
getStaticallyConfiguredRouteBuilder
public static io.deephaven.envoysupport.xds.EnvoyV3DiscoveryService.RouteBuilder getStaticallyConfiguredRouteBuilder(@NotNull @NotNull com.fishlib.configuration.Configuration configuration) Create a RouteBuilder that will add routes defined by static configuration, encapsulating additional required parameters.- Returns:
- a RouteBuilder
-
getDhResolverRouteBuilder
public static io.deephaven.envoysupport.xds.EnvoyV3DiscoveryService.RouteBuilder getDhResolverRouteBuilder(@NotNull @NotNull com.fishlib.io.logger.Logger log, @NotNull EnvoyV3DiscoveryService.DhResolverContext dhResolverContext, @NotNull @NotNull String[] apiServiceNames) -
getExtraRoutesRouteBuilder
public static io.deephaven.envoysupport.xds.EnvoyV3DiscoveryService.RouteBuilder getExtraRoutesRouteBuilder(@NotNull @NotNull com.fishlib.io.logger.Logger log, @NotNull @NotNull com.fishlib.configuration.Configuration configuration) Create a RouteBuilder that will add routes defined by envoy.xds.extra.routes properties, encapsulating additional required parameters.- Returns:
- a RouteBuilder
-
getWorkerProcessorRouteBuilder
public static io.deephaven.envoysupport.xds.EnvoyV3DiscoveryService.RouteBuilder getWorkerProcessorRouteBuilder(@NotNull @NotNull WorkerStreamProvider workerStreamProvider) Create a RouteBuilder that will add routes for workers provided by the given worker stream provider, encapsulating additional required parameters.- Parameters:
workerStreamProvider- Provides a stream of currently running worker hosts and ports- Returns:
- a RouteBuilder
-
getUnknownWorkerRouteBuilder
public static io.deephaven.envoysupport.xds.EnvoyV3DiscoveryService.RouteBuilder getUnknownWorkerRouteBuilder() -
addMainApiRoute
public static void addMainApiRoute(@NotNull io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList, @NotNull @NotNull String mainApiAddress, int webApiPort) Add a dynamic route for the Main API.- Parameters:
virtualHostBuilder- build virtual hosts into this builderclusterList- add new clusters to this listmainApiAddress- host address of the web api servicewebApiPort- port of the web api service
-
addGrpcRoute
public static void addGrpcRoute(@NotNull io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList, @NotNull @NotNull String[] hosts, @NotNull @org.jetbrains.annotations.NotNull int[] ports, @NotNull @NotNull String serviceFullPath, long extraRouteNonce) -
addStaticRoutes
public static void addStaticRoutes(@NotNull @NotNull com.fishlib.configuration.Configuration configuration, @NotNull io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList, long extraRouteNonce) Add dynamic routes for services that defined statically in configuration for gRPC and Comm cases. ConfigurationServer, RemoteQueryDispatchers, DbAclWriteServer, ClientUpdateService- Parameters:
configuration- get additional configuration from this providervirtualHostBuilder- build virtual hosts into this builderclusterList- add new clusters to this listextraRouteNonce- a random nonce to be used for this execution
-
addDhResolverRoutes
public static void addDhResolverRoutes(@NotNull @NotNull com.fishlib.io.logger.Logger log, @NotNull EnvoyV3DiscoveryService.DhResolverContext dhResolverContext, @NotNull io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList, @NotNull @NotNull String[] apiServiceNames, long extraRouteNonce) -
addExtraRoutes
public static void addExtraRoutes(@NotNull io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList, @NotNull @NotNull Collection<EnvoyExtraRoute> extraRoutes, long extraRouteNonce) Add dynamic routes as configured by envoy.xds.extra.routes properties.- Parameters:
virtualHostBuilder- build virtual hosts into this builderclusterList- add new clusters to this listextraRoutes- a collection of extra routes, already parsed from configuration.extraRouteNonce- a random nonce for this execution
-
addWorkerRoutes
public static void addWorkerRoutes(@NotNull @NotNull Stream<WorkerStreamProvider.WorkerInfo> workerInfoStream, @NotNull io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList) Add dynamic routes for the workers supplied by the worker stream.- Parameters:
workerInfoStream- stream of info needed to construct a route for workersvirtualHostBuilder- build virtual hosts into this builderclusterList- add new clusters to this list
-
addRoute
public static void addRoute(@NotNull io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList, @NotNull @NotNull String host, int port, @NotNull @NotNull String prefix, @Nullable @Nullable String prefixRewrite, long extraRouteNonce, int timeout) Add tls=true and exactPrefix=false and and pathMatch=false and calladdRoute(VirtualHost.Builder, List, String, int, String, String, boolean, long, int, boolean, boolean) -
addRoute
public static void addRoute(@NotNull io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList, @NotNull @NotNull String host, int port, @NotNull @NotNull String prefix, @Nullable @Nullable String prefixRewrite, boolean tls, long extraRouteNonce, int timeout, boolean exactPrefix, boolean pathMatch) Add websocket=true and put the single host and port arguments in single-element arrays for the call toaddRoute(VirtualHost.Builder, List, String[], int[], String, String, boolean, long, int, boolean, boolean, boolean) -
addRoute
public static void addRoute(@NotNull io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.route.v3.VirtualHost.Builder virtualHostBuilder, @NotNull @NotNull List<io.deephaven.shadow.envoyproxy.io.envoyproxy.envoy.config.cluster.v3.Cluster> clusterList, @NotNull @NotNull String[] hosts, int[] ports, @NotNull @NotNull String prefix, @Nullable @Nullable String prefixRewrite, boolean useTransportSocketTls, long extraRouteNonce, int timeout, boolean isExactPrefix, boolean isPathMatch, boolean isWebsocket) Helper class. Add the described virtual route to virtualHostBuilder and clusterList.- Parameters:
virtualHostBuilder- build virtual hosts into this builderclusterList- add new clusters to this listhosts- array of host components for the endpoints for this route; length should matchportsports- array of port components for the endpoints for this route; length should matchhostsprefix- filter on this prefixprefixRewrite- optional prefixRewrite value for envoyuseTransportSocketTls- does the route need to setup the transport socket as TLS?extraRouteNonce- obfuscate the cluster name using this noncetimeout- optional timeout for the route. 0 is forever, negative is unsetisExactPrefix- take the prefix and prefixRewrite and use them without adjustment (otherwise, this will forward "/prefix" to "/prefix/"isPathMatch- require exact match on the path, not a prefix match (exactPrefix must be true)isWebsocket- true if this route is for a websocket connection, false otherwise
-