route_table.proto

Package: gateway.solo.io

Types:

Source File: github.com/solo-io/gloo/projects/gateway/api/v1/route_table.proto

RouteTable

The RouteTable is a child routing object for the Gloo Gateway.

A RouteTable gets built into the complete routing configuration when it is referenced by a delegateAction, either in a parent VirtualService or another RouteTable.

Routes specified in a RouteTable must have their paths start with the prefix provided in the parent’s matcher.

For example, the following configuration:

virtualService: mydomain.com
match: /a
delegate: a-routes
---
routeTable: a-routes
match: /1

would not be valid, while

virtualService: mydomain.com
match: /a
delegate: a-routes
---
routeTable: a-routes
match: /a/1

would be valid.

A complete configuration might look as follows:

apiVersion: gateway.solo.io/v1
kind: VirtualService
metadata:
  name: 'any'
  namespace: 'any'
spec:
  virtualHost:
    domains:
    - 'any.com'
    routes:
    - matchers:
      - prefix: '/a' # delegate ownership of routes for `any.com/a`
      delegateAction:
        ref:
          name: 'a-routes'
          namespace: 'a'
    - matchers:
      - prefix: '/b' # delegate ownership of routes for `any.com/b`
      delegateAction:
        ref:
          name: 'b-routes'
          namespace: 'b'
apiVersion: gateway.solo.io/v1
kind: RouteTable
metadata:
  name: 'a-routes'
  namespace: 'a'
spec:
  routes:
    - matchers:
      # the path matchers in this RouteTable must begin with the prefix `/a/`
      - prefix: '/a/1'
      routeAction:
        single:
          upstream:
            name: 'foo-upstream'

    - matchers:
      - prefix: '/a/2'
      routeAction:
        single:
          upstream:
            name: 'bar-upstream'
apiVersion: gateway.solo.io/v1
kind: RouteTable
metadata:
  name: 'b-routes'
  namespace: 'b'
spec:
  routes:
    - matchers:
      # the path matchers in this RouteTable must begin with the prefix `/b/`
      - regex: '/b/3'
      routeAction:
        single:
          upstream:
            name: 'bar-upstream'
    - matchers:
      - prefix: '/b/c/'
      # routes in the RouteTable can perform any action, including a delegateAction
      delegateAction:
        ref:
          name: 'c-routes'
          namespace: 'c'

apiVersion: gateway.solo.io/v1
kind: RouteTable
metadata:
  name: 'c-routes'
  namespace: 'c'
spec:
  routes:
    - matchers:
      - exact: '/b/c/4'
      routeAction:
        single:
          upstream:
            name: 'qux-upstream'

Would produce the following route config for mydomain.com:

/a/1 -> foo-upstream
/a/2 -> bar-upstream
/b/3 -> baz-upstream
/b/c/4 -> qux-upstream
"routes": []gateway.solo.io.Route
"weight": .google.protobuf.Int32Value
"status": .core.solo.io.Status
"metadata": .core.solo.io.Metadata

Field Type Description Default
routes []gateway.solo.io.Route The list of routes for the route table.
weight .google.protobuf.Int32Value When a delegated route defines a RouteTableSelector that matches multiple route tables, Gloo will inspect this field to determine the order in which the route tables are to be evaluated. This determines the order in which the routes will appear on the final Proxy resource. The field is optional; if no value is specified, the weight defaults to 0 (zero). Gloo will process the route tables matched by a selector in ascending order by weight and collect the routes of each route table in the order they are defined. If multiple route tables define the same weight, Gloo will sort the routes which belong to those tables to avoid short-circuiting (e.g. making sure /foo/bar comes before /foo). In this scenario, Gloo will also alert the user by adding a warning to the status of the parent resource (the one that specifies the RouteTableSelector).
status .core.solo.io.Status Status indicates the validation status of this resource. Status is read-only by clients, and set by gloo during validation.
metadata .core.solo.io.Metadata Metadata contains the object metadata for this resource.