RouteTable

Proto: route_table.proto

Package: networking.gloo.solo.io

Types:

DelegateAction

Field Description
routeTables (repeated common.gloo.solo.io.ObjectSelector)

Delegate to the RouteTables that match the given selectors. Selected route tables are ordered by creation time stamp in ascending order to guarantee consistent ordering. Route tables will be selected from the pool of route tables defined within the current workspace, as well as any imported into the workspace.
allowedRoutes (repeated common.gloo.solo.io.RouteFilter)

Optional: Restrict delegation to the RouteTables that match the set of route filter criteria specified. If not specified, any route will be allowed to be referenced by this RouteTable.
sortMethod (DelegateAction.SortMethod)

How routes should be sorted

DirectResponseAction

Field Description
status (uint32)

Required. Specifies an HTTP response status between 100-599 inclusive to be returned.
body (string)

Specifies the content of the response body. If this setting is omitted, no body is included in the generated response.
Note: Headers can be specified using the Header Modification feature in the enclosing Route, ConnectionHandler, or Gateway options.

ForwardToAction

when a route is matched, forward the request to the destinations specified in this action

Field Description
destinations (repeated common.gloo.solo.io.DestinationReference)

Defines the destination upstream for routing Some destinations require additional configuration for the route (e.g. AWS upstreams require a function name to be specified).
pathRewrite (string)

Replace the path specified in the matcher with this value before forwarding the request to the upstream destination. When a prefix matcher is used, only the prefix portion of the path is rewritten. When an exact matcher is used, the whole path is replaced. Rewriting the path when a regex matcher is used is currently unsupported.
hostRewrite (string)

Replace the Authority/Host header with this value before forwarding the request to the upstream destination.

GraphQLAction

Field Description
schema (core.skv2.solo.io.ClusterObjectRef)

Reference to a GraphQLSchema resource that contains the configuration for this subschema.
stitchedSchema (core.skv2.solo.io.ClusterObjectRef)

Reference to a GraphQLStitchedSchema resource that contains the configuration for this subschema.
options (GraphQLAction.Options)

Options that apply to this GraphQL Schema.

GraphQLAction.Options

Field Description
logSensitiveInfo (google.protobuf.BoolValue)

Include information about request/response in the envoy debug logs. This is helpful for debugging GraphQL. Defaults to false.

HTTPRoute

An HTTP route pairs a set of HTTP Request Matchers with an action to take when a request is matched. HTTP Routes can be named and labeled for the purpose of metrics and applying policies.

Field Description
name (string)

unique name of the route (within the route table). used to identify the route for metrics
labels (repeated HTTPRoute.LabelsEntry)

Labels for the route. used to apply policies which implement routeSelectors.
matchers (repeated common.gloo.solo.io.HTTPRequestMatcher)

The set of request matchers which this route will match on. If none are specified, this route will match any HTTP traffic. On a delegated RouteTable, this route will only match traffic that includes both the parent and child's matchers. If these sets conflict, the delegating route on the parent will be replaced with a DirectResponseAction indicating the misconfiguration.
forwardTo (ForwardToAction)

forward traffic to one or more destination services.
delegate (DelegateAction)

delegate the handling of traffic to one or more HTTP Route Tables. This can be used to delegate a subset of the route table's traffic to another route table, which may live in an imported workspace, or to separate routing concerns between objects.
redirect (RedirectAction)

return a redirect response to the downstream client.
directResponse (DirectResponseAction)

respond directly to the client from the proxy.
graphql (GraphQLAction)

handle the HTTP request as a GraphQL request, including query validation, and execution of the GraphQL request. The incoming GraphQL request must either be a GET or POST request, see “Serving over HTTP”.

HTTPRoute.LabelsEntry

Field Description
key (string)

value (string)

RedirectAction

Field Description
hostRedirect (string)

The host portion of the URL will be swapped with this value.
pathRedirect (string)

The entire path portion of the URL will be overwritten with this value.
responseCode (RedirectAction.RedirectResponseCode)

The HTTP status code to use in the redirect response. The default response code is MOVED_PERMANENTLY (301).

RouteTableSpec

RouteTables defines one or more hosts and a set of traffic route rules to handle traffic for these hosts. The traffic route rules can be delegated to other RouteTable based on one or more given hosts or specific paths.

You may deploy a RouteTable resource in any namespace within your workspace. In order for the RouteTable to be used outside of your workspace, you must deploy the RouteTable resource in the root config of your workspace and label it with workspace.solo.io/exported: "true". If your RouteTable delegates some traffic rules to another RouteTable, the delegated RouteTable may reside in the same workspace or different workspace from your RouteTable. If they are in different workspaces, the delegated RouteTable must reside in the root config of their workspaces and labelled with workspace.solo.io/exported: "true".

RouteTable can be used to match traffic originating from a gateway as well as from sidecars within the mesh, depends on the configuration of the virtualGateways field.

The following example defines route configuration for the ‘uk.bookinfo.com’ and ‘eu.bookinfo.com’ hosts, when traffic arriving at the my-gateway virtual gateway which is declared in the my-gateway-ws workspace. When the cookie in the header matches to ‘user=dev-123’, traffic is forwarded to the port 7777 of the v1 of reviews.qa. When the path matches exactly to /reviews/, 80% traffic is forwarded to the port 9080 of reviews.prod and 20% traffic is forwarded to the port 9080 of reviews.qa. All other traffic is sent to the default destination, which is the port 9080 of reviews.prod service in the bookinfo workspace.

apiVersion: networking.gloo.solo.io/v2
kind: RouteTable
metadata:
  name: bookinfo-root-routes
  namespace: bookinfo
spec:
  hosts:
    - 'uk.bookinfo.com'
    - 'eu.bookinfo.com'
  virtualGateways:
    - name: my-gateway
      namespace: my-gateway-ws
  defaultDestination:
    ref:
      name: reviews
      namespace: prod
    port:
      number: 9080
  http:
    - name: reviews-qa
      matchers:
        - headers:
            - name: cookie
              value: 'user=dev-123'
      forwardTo:
        destinations:
          - ref:
              name: reviews
              namespace: qa
            subset: 
              version: v1
            port:
              number: 7777
    - name: reviews
      matchers:
        - name: review-prefix
          uri:
            exact: /reviews/
      forwardTo:
        destinations:
          - weight: 80
          - ref:
              name: reviews
              namespace: qa
            port:
              number: 9080
            weight: 20

The following example defines route configuration for the ‘uk.bookinfo.com’ and ‘eu.bookinfo.com’ hosts, when traffic arriving at the my-gateway virtual gateway which is declared in the my-gateway-ws workspace. When the path matches prefix /lambda, traffic is forwarded to the backing aws-provider CloudProvider, where There is an associated CloudResources resource containing a lambda service named logicalName aws-dest within it. An option, “SYNC”, is also passed to indicate we want to route to the backing cloud function synchronously (though in this case, “SYNC” is the default option and can be safely omitted).

apiVersion: networking.gloo.solo.io/v2
kind: RouteTable
metadata:
  name: bookinfo-root-routes
  namespace: bookinfo
spec:
  hosts:
    - 'uk.bookinfo.com'
    - 'eu.bookinfo.com'
  virtualGateways:
    - name: my-gateway
      namespace: my-gateway-ws
  defaultDestination:
    ref:
      name: reviews
      namespace: prod
    port:
      number: 9080
  http:
    - name: lambda
      matchers:
        - uri:
            prefix: /lambda
      labels:
        route: lambda
      forwardTo:
        destinations:
          - ref:
              name: aws-provider
              namespace: bookinfo
              cluster: cluster-1
            kind: CLOUD_PROVIDER
            function:
              logicalName: aws-dest
              awsLambda:
                invocationStyle: SYNC

The following example defines route configuration for the ‘uk.bookinfo.com’ and ‘eu.bookinfo.com’ hosts, when traffic arriving at the my-gateway virtual gateway which is declared in the my-gateway-ws workspace. When the path matches prefix /lambda, traffic is forwarded to the delegated routetable for handling lambdas. allowedRoutes is included to restrict usage of CloudProvider functionality which routes to cloud functions backend-function-* in region us-east-2 and which assume the dev-team-B-* IAM role.

apiVersion: networking.gloo.solo.io/v2
kind: RouteTable
metadata:
  name: bookinfo-root-routes
  namespace: bookinfo
spec:
  hosts:
    - 'uk.bookinfo.com'
    - 'eu.bookinfo.com'
  virtualGateways:
    - name: my-gateway
      namespace: my-gateway-ws
  defaultDestination:
    ref:
      name: reviews
      namespace: prod
    port:
      number: 9080
  http:
    - name: lambda
      matchers:
        - uri:
            prefix: /lambda
      labels:
        route: lambda
      delegate:
        allowedRoutes:
          - cloudProvider:
              aws:
                lambda_function:
                  - backend-function-.*
                iam_roles:
                  - dev-team-B-.*
                regions:
                  - us-east-2
        routeTables:
          - labels:
              table: lambda
Field Description
hosts (repeated string)

Optional: One or more hosts for which this route table will route traffic. Supports wildcards. To avoid potential misconfigurations, it is recommended to always use fully qualified domain names over short names. Note: It must be empty for a delegated RouteTable.
virtualGateways (repeated common.gloo.solo.io.ObjectReference)

Optional: A list of references to the virtual gateways which should serve this route table. Only valid for route tables which define at least one host. Note: This field must be empty for a delegated RouteTable.
When not specified, the route table applies to either all the sidecars in the workspace or only sidecars for selected workloads (via the workloadSelectors field) in the workspace where the route table is deployed or imported.
The following applies to sidecars of all the workloads for the workspace where the route table is deployed or imported: set virtualGateways to null and workloadSelectors to [].
The following applies to the my-gateway virtual gateway in the gateway workspace and no sidecars: set virtualGateways.name to my-gateway, virtualGateways.namespace to gateway, and workloadSelectors to [].
The following applies to the my-gateway virtual gateway in the gateway workspace and sidecars of all the workloads for the workspace where the route table is deployed or imported: set virtualGateways.name to my-gateway, virtualGateways.namespace to gateway, and workloadSelectors to {}.
The following applies to sidecars of all the app: foo workloads for the workspace where the route table is deployed or imported: set virtualGateways to null and workloadSelectors.selector.labels to app: foo.
The following applies to the my-gateway virtual gateway in the gateway workspace and sidecars of all the app: foo workloads for the workspace where the route table is deployed or imported: set virtualGateways.name to my-gateway, virtualGateways.namespace to gateway, and workloadSelectors.selector.labels to app: foo.
workloadSelectors (repeated common.gloo.solo.io.WorkloadSelector)

Optional: Selectors for source workloads (with sidecars) which will route traffic by this route table. Only valid for route tables which define at least one host. If no workloadSelectors or virtualGateways are specified, all workloads in the workspace will automatically be selected. If VirtualGateways are specified, set workloadSelectors: - {} to select all workloads in the workspace. Note: This field must be empty for a delegated RouteTable. Note: Selection of external workloads (VMs) is currently not supported.
defaultDestination (common.gloo.solo.io.DestinationReference)

Optional: Routes that do not specify a destination will forward traffic to this destination.
http (repeated HTTPRoute)

The set of HTTP routes this route table will serve. If no routes are matched in the route table, the client will get a 404.
weight (int32)

Weight is used when sorting route tables in delegate action or routes when sorted by specificity. Higher integer values are considered higher priority. The default value is 0.
portalMetadata (PortalMetadata)

PortalMetadata is a set of portal-specific metadata that is used to generate documentation for the APIs exposed by this route table if this route table is selected by a user configured Portal resource.

RouteTableStatus

reflects the status of the RouteTable

Field Description
global (common.gloo.solo.io.GenericGlobalStatus)

workspaces (repeated RouteTableStatus.WorkspacesEntry)

The status of the resource in each workspace that it exists in.
appliedRoutePolicies (repeated RouteTableStatus.AppliedRoutePoliciesEntry)

Map of policy GVK to policy references for all policies applied on this resource.
parentRouteTables (repeated common.gloo.solo.io.ObjectReference)

The parents of this route table, if it is a delegated route table.
ownerWorkspace (common.gloo.solo.io.OwnerWorkspace)

Name of Workspace that owns the route table
allowedVirtualGateways (repeated common.gloo.solo.io.ObjectReference)

list of allowed VirtualGateways this RouteTable can select

RouteTableStatus.AppliedRoutePoliciesEntry

Field Description
key (string)

value (common.gloo.solo.io.AppliedRoutePolicies)

RouteTableStatus.WorkspacesEntry

Field Description
key (string)

value (common.gloo.solo.io.WorkspaceStatus)

DelegateAction.SortMethod

Name Number Description
TABLE_WEIGHT 0 Routes are kept in the order that they appear relative to their tables, but tables are sorted by weight. Tables that have the same weight will stay in the same order that they are listed in, which is the list order when given as a reference and by creation timestamp when selected.
ROUTE_SPECIFICITY 1 After processing all routes, including additional route tables delegated to, the resulting routes are sorted by specificity to reduce the chance that a more specific route will be short-circuited by a general route. Matchers with exact path matchers are considered more specific than regex path patchers, which are more specific than prefix path matchers. For prefix and exact, matchers of the same type are sorted by length of the path in descending order. For regex matchers they are all treated equal when sorted. For sort ties, table weights are used across tables & within tables user specified order is preserved. Only the most specific matcher on each route is used.
For example, consider the following two sub-tables that are sorted by specificity and the resulting route list.
Sub-table A, with a table weight of 1 in case of sort ties:
  • prefix: /foo
  • prefix: /foo/more/specific
  • prefix: /foo/even/more/specific
  • exact: /foo/exact
  • exact: /foo/another/exact
  • regex: /foo/*
  • regex: /fooo/*
Sub-table B, with a table weight of 2 in case of sort ties:
  • prefix: /bar
  • prefix: /bar/more/specific
  • prefix: /bar/even/more/specific
  • exact: /bar/exact
  • regex: /bar/*
The resulting routes are sorted in this order:
  • exact: /foo/another/exact
  • exact: /bar/exact
  • exact: /foo/exact
  • regex: /bar/*
  • regex: /foo/*
  • regex: /fooo/*
  • prefix: /bar/even/more/specific
  • prefix: /foo/even/more/specific
  • prefix: /bar/more/specific
  • prefix: /foo/more/specific
  • prefix: /bar
  • prefix: /foo

RedirectAction.RedirectResponseCode

Name Number Description
MOVED_PERMANENTLY 0 Moved Permanently HTTP Status Code - 301.
FOUND 1 Found HTTP Status Code - 302.
SEE_OTHER 2 See Other HTTP Status Code - 303.
TEMPORARY_REDIRECT 3 Temporary Redirect HTTP Status Code - 307.
PERMANENT_REDIRECT 4 Permanent Redirect HTTP Status Code - 308.