Ingress Gateway
IngressGateway
configures a workload to act as a gateway for
traffic entering the mesh. The ingress gateway also provides basic
API gateway functionalities such as JWT token validation, rate
limiting, and request authorization. Gateways in privileged
workspaces can route to services outside the workspace while those
in unprivileged workspaces can only route to services inside the
workspace.
The following example declares an ingress gateway running on pods
with app: gateway
labels in the ns1
namespace. The gateway
exposes a host bookinfo.com
on https port 9443. TLS is terminated
using the certificates in the Kubernetes secret
bookinfo-certs
. Clients are authenticated using JWT tokens, whose
keys are obtained from the OIDC provider www.googleapis.com
. The
request is then authorized by an the user's authorization engine
hosted at https://internal.example.com
. They are then rate
limited based on the remote address of the client and the x-user-id
header value before being forwarded to the productpage
service in
the backend.
apiVersion: gateway.tsb.tetrate.io/v2
kind: IngressGateway
metadata:
name: ingress-bookinfo
group: g1
workspace: w1
tenant: mycompany
organization: myorg
spec:
workloadSelector:
namespace: ns1
labels:
app: gateway
http:
- name: bookinfo
port: 9443
hostname: bookinfo.com
tls:
mode: SIMPLE
secretName: bookinfo-certs
authentication:
jwt:
issuer: https://www.googleapis.com/oauth2/v1/certs
audience: bookinfo
authorization:
external:
uri: https://company.com/authz
includeRequestHeaders:
- Authorization # forwards the header to the authorization service.
rateLimiting:
domain: abc
failOpen: false
rateLimitServerUri: grpcs://company.com/ratelimitapi
actions:
- remoteAddress
- requestHeaders:
headerName: x-user-id
descriptorKey: userid
routing:
rules:
- route:
host: ns1/productpage.ns1.svc.cluster.local
If the productpage.ns1
service on Kubernetes has a ServiceRoute
with multiple subsets and weights, the traffic will be split across
the subsets accordingly.
Authentication
Field | Description | Validation Rule |
jwt | – |
JWT
Field | Description | Validation Rule |
issuer | string | string = { |
audiences | List of string | – |
jwksUri | string | – |
jwks | string | – |
Authorization
Configuration for authorizing a HTTP request
Field | Description | Validation Rule |
external | tetrateio.api.tsb.gateway.v2.Authorization.ExternalAuthzBackend | – |
local | – |
ExternalAuthzBackend
Use an authorization running at the specified URI. Note that this mode is supported only for HTTPS servers.
Field | Description | Validation Rule |
uri | – | |
includeRequestHeaders | List of string | – |
LocalAuthz
Authorize the request in Envoy based on the JWT claims.
Field | Description | Validation Rule |
rules | – |
CorsPolicy
Field | Description | Validation Rule |
allowOrigin | List of string | – |
allowMethods | List of string | – |
allowHeaders | List of string | – |
exposeHeaders | List of string | – |
maxAge | google.protobuf.Duration | – |
allowCredentials | google.protobuf.BoolValue | – |
HTTPRewrite
Field | Description | Validation Rule |
uri | string | – |
authority | string | – |
Headers
Header manipulation rules.
Field | Description | Validation Rule |
request | tetrateio.api.tsb.gateway.v2.Headers.HeaderOperations | – |
response | tetrateio.api.tsb.gateway.v2.Headers.HeaderOperations | – |
HeaderOperations
HeaderOperations Describes the header manipulations to apply.
Field | Description | Validation Rule |
set | map<string, string> | |
add | map<string, string> | |
remove | List of string | – |
HttpMatchCondition
A single match clause to match all aspects of a request.
Field | Description | Validation Rule |
uri | tetrateio.api.tsb.gateway.v2.StringMatch | – |
headers | map<string, StringMatch> |
HttpModifyAction
HTTP path/url/header modification.
Field | Description | Validation Rule |
rewrite | tetrateio.api.tsb.gateway.v2.HTTPRewrite | – |
headers | tetrateio.api.tsb.gateway.v2.Headers | – |
HttpRouting
Field | Description | Validation Rule |
corsPolicy | tetrateio.api.tsb.gateway.v2.CorsPolicy | – |
rules | List of tetrateio.api.tsb.gateway.v2.HttpRule | repeated = { |
HttpRule
A single HTTP rule.
Field | Description | Validation Rule |
match | List of tetrateio.api.tsb.gateway.v2.HttpMatchCondition | – |
modify | tetrateio.api.tsb.gateway.v2.HttpModifyAction | – |
route | tetrateio.api.tsb.gateway.v2.Route | – |
redirect | tetrateio.api.tsb.gateway.v2.Redirect | – |
HttpServer
Field | Description | Validation Rule |
name | string | string = { |
port | uint32 | uint32 = { |
hostname | string | string = { |
tls | tetrateio.api.tsb.gateway.v2.ServerTLSSettings | – |
authentication | tetrateio.api.tsb.gateway.v2.Authentication | – |
authorization | tetrateio.api.tsb.gateway.v2.Authorization | – |
routing | tetrateio.api.tsb.gateway.v2.HttpRouting | message = { |
rateLimiting | tetrateio.api.tsb.gateway.v2.RateLimiting | – |
IngressGateway
IngressGateway
configures a workload to act as an ingress gateway into the mesh.
Field | Description | Validation Rule |
workloadSelector | tetrateio.api.tsb.types.v2.WorkloadSelector | message = { |
http | List of tetrateio.api.tsb.gateway.v2.HttpServer | repeated = { |
LocalAuthzRule
LocalAuthzRule
Bindings define the subjects that can access the resource a policy is attached to, and the conditions that need to be met for that access to be granted. A policy can have multiple bindings to configure different access controls for specific subjects.
Field | Description | Validation Rule |
name | string | string = { |
from | List of tetrateio.api.tsb.gateway.v2.Subject | – |
to | List of tetrateio.api.tsb.gateway.v2.LocalAuthzRule.HttpOperation | – |
HttpOperation
Field | Description | Validation Rule |
paths | List of string | repeated = { |
methods | List of string | repeated = { |
RateLimitAction
RateLimitAction
RateLimitAction is a set of conditions to match HTTP requests that should be rate limited, and emit a set of keys and values that will then be passed on to the rate limit server. The server is expected to make a rate limit decision based on these keys and values.
Field | Description | Validation Rule |
sourceCluster | tetrateio.api.tsb.gateway.v2.RateLimitAction.SourceCluster | – |
destinationCluster | tetrateio.api.tsb.gateway.v2.RateLimitAction.DestinationCluster | – |
remoteAddress | tetrateio.api.tsb.gateway.v2.RateLimitAction.RemoteAddress | – |
requestHeaders | tetrateio.api.tsb.gateway.v2.RateLimitAction.RequestHeaders | – |
headerValueMatch | tetrateio.api.tsb.gateway.v2.RateLimitAction.HeaderValueMatch | – |
DestinationCluster
Emit as attribute, the destination envoy cluster to which traffic
is bound to. The key-value is ("destination_cluster", "<routed
target cluster>")
Name | Number | Description |
HeaderValueMatch
Emit as attribute, a key-value pair of the form ("header_match",
"<descriptor_value>")
, where descriptor_value
is a user
specified value corresponding to a header match event.
Field | Description | Validation Rule |
descriptorValue | string | string = { |
expectMatch | google.protobuf.BoolValue | – |
headers | map<string, StringMatch> |
RemoteAddress
Emit as attribute, the remote address of the client, extracted
from a trusted X-Forwarded-For header. The key-value is
("remote_address", "<trusted address from x-forwarded-for>")
Name | Number | Description |
RequestHeaders
Emit as attribute, a key-value pair of the form
("<descriptor_key>", "<header_value_queried_from_header>")
where descriptor_key
is a user specified key to emit when the
HTTP header is seen.
Field | Description | Validation Rule |
headerName | string | string = { |
descriptorKey | string | string = { |
skipIfAbsent | bool | – |
SourceCluster
Emit as attribute, the source envoy cluster (corresponding to the
--service-cluster
flag value set by Istio). The key-value is
("source_cluster", "<local service cluster>")
Name | Number | Description |
RateLimiting
RateLimiting
HTTP/gRPC requests can be rate limited based on a variety of attributes in the request such as headers (including cookies), URL path/prefixes, etc. The rate limit backend must expose Envoy's Rate Limit Service gRPC API (https://www.envoyproxy.io/docs/envoy/latest/configuration/other_features/rate_limit#config-rate-limit-service).
If the rate limit service is called, and the response for any of the descriptors is over limit, a 429 response is returned. The rate limit filter also sets the x-envoy-ratelimited header.
If there is an error in calling rate limit service or rate limit service returns an error and failure_mode_deny is set to true, a 500 response is returned.
Field | Description | Validation Rule |
domain | string | string = { |
failOpen | google.protobuf.BoolValue | – |
rateLimitServerUri | string | string = { |
actions | List of tetrateio.api.tsb.gateway.v2.RateLimitAction | repeated = { |
Redirect
Field | Description | Validation Rule |
uri | string | – |
authority | string | – |
Route
One or more destinations in a local/remote cluster for the given request.
Field | Description | Validation Rule |
host | string | string = { |
port | uint32 | – |
ServerTLSSettings
Field | Description | Validation Rule |
mode | tetrateio.api.tsb.gateway.v2.ServerTLSSettings.TLSMode | – |
secretName | string | – |
TLSMode
Name | Number | Description |
DISABLED | 0 | |
SIMPLE | 1 | |
MUTUAL | 2 |
StringMatch
Describes how to match a given string in HTTP headers. Match is case-sensitive.
Field | Description | Validation Rule |
exact | string | – |
prefix | string | – |
regex | string | – |
Subject
Subject
A subject designates an actor (user, service, etc) that attempts to access a target resource. Subjects can be modeled with JWT tokens, service accounts, and decorated with attributes such as HTTP request headers, JWT token claims, etc. The fields that define a subject will be matched to incoming requests, to fully qualify where the request comes from, and to decide if the given request is allowed or not for the target resource. All the fields in a subject are evaluated as AND expressions.
Field | Description | Validation Rule |
jwt | tetrateio.api.tsb.gateway.v2.Subject.JWTClaims | – |
JWTClaims
JWT based subject
JWT based subjects qualify a subject by matching against a JWT token present in the request. By default the token is expected to be present in the 'Authorization' HTTP header, with the 'Bearer" prefix.
Field | Description | Validation Rule |
iss | – | |
sub | – | |
other | map<string, string> |