Class EnvoyV3RouteBuilder

java.lang.Object
io.deephaven.envoysupport.xds.EnvoyV3RouteBuilder

public class EnvoyV3RouteBuilder extends Object
Encapsulate the logic of building dynamic routes. This class uses the V3 version of the envoy API.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addDhResolverRoutes(@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 void
    addExtraRoutes(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 void
    addGrpcRoute(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 void
    addMainApiRoute(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 void
    addRoute(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 void
    addRoute(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 to addRoute(VirtualHost.Builder, List, String[], int[], String, String, boolean, long, int, boolean, boolean, boolean)
    static void
    addRoute(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 call addRoute(VirtualHost.Builder, List, String, int, String, String, boolean, long, int, boolean, boolean)
    static void
    addStaticRoutes(@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 void
    addWorkerRoutes(@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 void
    enableClusterTls(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.RouteBuilder
    getDhResolverRouteBuilder(@NotNull com.fishlib.io.logger.Logger log, EnvoyV3DiscoveryService.DhResolverContext dhResolverContext, @NotNull String[] apiServiceNames)
     
    static io.deephaven.envoysupport.xds.EnvoyV3DiscoveryService.RouteBuilder
    getExtraRoutesRouteBuilder(@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.RouteBuilder
    getMainApiRouteBuilder(@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.RouteBuilder
    getStaticallyConfiguredRouteBuilder(@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.RouteBuilder
     
    static io.deephaven.envoysupport.xds.EnvoyV3DiscoveryService.RouteBuilder
    Create a RouteBuilder that will add routes for workers provided by the given worker stream provider, encapsulating additional required parameters.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 builder
      clusterList - add new clusters to this list
      mainApiAddress - host address of the web api service
      webApiPort - 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 provider
      virtualHostBuilder - build virtual hosts into this builder
      clusterList - add new clusters to this list
      extraRouteNonce - 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 builder
      clusterList - add new clusters to this list
      extraRoutes - 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 workers
      virtualHostBuilder - build virtual hosts into this builder
      clusterList - 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 call addRoute(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 to addRoute(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 builder
      clusterList - add new clusters to this list
      hosts - array of host components for the endpoints for this route; length should match ports
      ports - array of port components for the endpoints for this route; length should match hosts
      prefix - filter on this prefix
      prefixRewrite - optional prefixRewrite value for envoy
      useTransportSocketTls - does the route need to setup the transport socket as TLS?
      extraRouteNonce - obfuscate the cluster name using this nonce
      timeout - optional timeout for the route. 0 is forever, negative is unset
      isExactPrefix - 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