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
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://company.com/authz
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.
routing:
rules:
- route:
host: ns1/productpage.ns1.svc.cluster.local
rateLimiting:
settings:
# Ratelimit at 10 requests/hour for clients with a remote address of 1.2.3.4
- rules:
- remoteAddress:
value: 1.2.3.4
limit:
requestsPerUnit: 10
unit: HOUR
# Ratelimit at 50 requests/second for every unique value in the user-agent header
- rules:
- header:
name: user-agent
limit:
requestsPerUnit: 50
unit: MINUTE
# Ratelimit at 100 requests/second for every unique client remote address
# with the HTTP requests having a GET method and the path prefix of /productpage
- rules:
- remoteAddress:
value: *
- header:
name: :path
value:
prefix: /productpage
- header:
name: :method
value:
exact: GET
limit:
requestsPerUnit: 100
unit: SECOND
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
Configuration for an URL rewrite rule.
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
An HTTP server exposed in an ingress gateway.
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 = { |
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 | – |
tlsPassthrough | List of tetrateio.api.tsb.gateway.v2.TLSPassthroughServer | – |
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 = { |
RateLimitRule
RateLimitRule
RateLimitRule is a condition to match HTTP requests that should be rate limited.
Field | Description | Validation Rule |
remoteAddress | tetrateio.api.tsb.gateway.v2.RateLimitRule.RemoteAddress | – |
header | tetrateio.api.tsb.gateway.v2.RateLimitRule.Header | – |
Header
RateLimit based on certain headers
Field | Description | Validation Rule |
name | string | string = { |
value | tetrateio.api.tsb.gateway.v2.StringMatch | – |
RemoteAddress
RateLimit based on the client's remote address, extracted from the trusted X-Forwarded-For header.
Field | Description | Validation Rule |
value | string | string = { |
RateLimitSetting
RateLimitSetting
RateLimitSetting is the block to define each ratelimit configuration.
Field | Description | Validation Rule |
rules | List of tetrateio.api.tsb.gateway.v2.RateLimitRule | repeated = { |
limit | tetrateio.api.tsb.gateway.v2.RateLimitValue | message = { |
RateLimitValue
RateLimitValue
RateLimitValue specifies the values that will be used to determine the rate limit.
Field | Description | Validation Rule |
requestsPerUnit | uint32 | – |
unit | tetrateio.api.tsb.gateway.v2.RateLimitValue.Unit | enum = { |
Unit
Units of time.
Name | Number | Description |
UNKNOWN | 0 | |
SECOND | 1 | |
MINUTE | 2 | |
HOUR | 3 | |
DAY | 4 |
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, client remote address etc. A list of rate limit settings can be configured, with each setting a list of rules can be defined. If the rules match, and the requests exceed the limit, a 429 response is returned.
Field | Description | Validation Rule |
settings | List of tetrateio.api.tsb.gateway.v2.RateLimitSetting | 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> |
TLSPassthroughServer
A TLS server exposed in an ingress gateway. For TLS servers the gateways don't terminate connections and use SNI based routing.
Field | Description | Validation Rule |
name | string | string = { |
port | uint32 | uint32 = { |
hostname | string | string = { |
route | tetrateio.api.tsb.gateway.v2.Route | message = { |