Traffic Setting
Traffic Settings allow configuring the behavior of the proxy workloads in a set of namespaces owned by a traffic group. Specifically, it allows configuring the dependencies of proxy workloads on namespaces outside the traffic group as well as reliability settings for outbound calls made by the proxy workloads to other services.
The following example creates a traffic group for the proxy workloads in
ns1
, ns2
and ns3
namespaces owned by its parent workspace
w1
under tenant mycompany
. It then defines a traffic setting
for the all workloads in these namespaces, adding a dependency on
all the services in the shared db
namespace, and forwarding all
unknown traffic via the egress gateway in the istio-system
namespace.
apiVersion: traffic.tsb.tetrate.io/v2
kind: Group
metadata:
name: t1
workspace: w1
tenant: mycompany
organization: myorg
spec:
namespaceSelector:
names:
- "*/ns1"
- "*/ns2"
- "*/ns3"
configMode: BRIDGED
And the associated traffic settings for the proxy workloads:
apiVersion: traffic.tsb.tetrate.io/v2
kind: TrafficSetting
metadata:
name: defaults
group: t1
workspace: w1
tenant: mycompany
organization: myorg
spec:
outbound:
reachability:
mode: CUSTOM
hosts:
- "ns1/*"
- "ns2/*"
- "ns3/*"
- "db/*"
upstreamTrafficSettings:
- hosts:
- '*'
settings:
resilience:
circuitBreakerSensitivity: MEDIUM
egress:
host: istio-system/istio-egressgateway
To setup load balancing algorithm as ROUND_ROBIN
for all outbound requests
to service foo.bar.svc.cluster.local
from clients in t1
traffic group:
apiVersion: traffic.tsb.tetrate.io/v2
kind: TrafficSetting
metadata:
name: defaults
group: t1
workspace: w1
tenant: mycompany
organization: myorg
spec:
outbound:
upstreamTrafficSettings:
- hosts:
- 'foo.bar.svc.cluster.local'
settings:
loadBalancer:
simple: ROUND_ROBIN
upstreamTrafficSettings
can be used to configure the outbound traffic
with grouping a particular group of upstream hosts to have a certain setting.
In the below example all outbound requests to hosts matching wildcard
*.ns1.svc.cluster.local
will use request timeout of 10s while hosts matching
*.ns2.svc.cluster.local
and *.ns3.svc.cluster.local
will use request timeout of 5s.
apiVersion: traffic.tsb.tetrate.io/v2
kind: TrafficSetting
metadata:
name: defaults
group: t1
workspace: w1
tenant: mycompany
organization: myorg
spec:
outbound:
upstreamTrafficSettings:
- hosts:
- '*.ns1.svc.cluster.local'
settings:
resilience:
connectionPool:
http:
requestTimeout: 10s
- hosts:
- '*.ns2.svc.cluster.local'
- '*.ns3.svc.cluster.local'
settings:
resilience:
connectionPool:
http:
requestTimeout: 5s
The following traffic setting confines the reachability of proxy workloads
in the traffic group t1
to other namespaces inside the group. The
resilience and egress gateway settings will be inherited from the
workspace wide traffic setting.
apiVersion: traffic.tsb.tetrate.io/v2
kind: TrafficSetting
metadata:
name: defaults
group: t1
workspace: w1
tenant: mycompany
organization: myorg
spec:
outbound:
reachability:
mode: GROUP
The above fields are now moved to two different sections called inbound
and outbound
to allow better control over these fields. Please refer the
below example to configure a traffic setting for all services in traffic group
t1
configuring similar knobs as explained in earlier examples:
apiVersion: traffic.tsb.tetrate.io/v2
kind: TrafficSetting
metadata:
name: defaults
group: t1
workspace: w1
tenant: mycompany
organization: myorg
spec:
inbound:
resilience:
connectionPool:
tcp:
keepAlive:
idleTime: 300s
outbound:
reachability:
mode: GROUP
upstreamTrafficSettings:
- hosts:
- '*.ns1.svc.cluster.local'
settings:
resilience:
connectionPool:
http:
requestTimeout: 10s
This traffic setting configuration specifies upstream traffic settings
for specific hosts within the client
namespace. It is associated with
the w1
workspace and the t1
traffic group.
apiVersion: traffic.tsb.tetrate.io/v2
kind: TrafficSetting
metadata:
name: client-upstream-traffic-setting
namespace: client
group: t1
workspace: w1
tenant: mycompany
organization: myorg
spec:
outbound:
upstreamTrafficSettings:
- hosts:
- 'httpbin.app1.svc.cluster.local'
- '*.app3.svc.cluster.local'
- '*.app4.svc.cluster.local'
settings:
authentication:
trafficMode: REQUIRED
- hosts:
- '*.app2.svc.cluster.local'
- 'tetrate.app4.svc.cluster.local'
settings:
authentication:
trafficMode: OPTIONAL
This configuration specifies authentication requirements for traffic to the following hosts:
httpbin.app1.svc.cluster.local
requires mTLS authentication.- All non-injected services in
app3
namespace require mTLS authentication. - All non-injected services in
app4
namespace require mTLS authentication, except fortetrate.app4.svc.cluster.local
, which is excluded. - Authentication enforcement is skipped for all non-injected services in
app2
namespace.
AuthenticationSettings
Configuration for connection authentication parameters. This allows the enforcement of mutual TLS connections to upstream services that do not have a sidecar. This ensures that gateways or mesh workloads do not communicate in plain text with services outside the mesh.
Field | Description | Validation Rule |
---|---|---|
trafficMode | tetrateio.api.tsb.traffic.v2.AuthenticationSettings.AuthenticationMode | – |
DownstreamResilienceSettings
DownstreamResilienceSettings control the reliability knobs in Envoy when accepting inbound connections.
Field | Description | Validation Rule |
---|---|---|
connectionPool | tetrateio.api.tsb.traffic.v2.DownstreamResilienceSettings.ConnectionPoolSettings | – |
ConnectionPoolSettings
Connection pool settings for downstream connections.
Field | Description | Validation Rule |
---|---|---|
tcp | tetrateio.api.tsb.traffic.v2.DownstreamResilienceSettings.ConnectionPoolSettings.TCP | – |
TCP
TCP Settings for inbound requests.
Field | Description | Validation Rule |
---|---|---|
keepAlive | tetrateio.api.tsb.traffic.v2.TcpKeepAlive | – |
HTTPRetry
HTTPRetry defines the parameters for retrying API calls to a service.
Field | Description | Validation Rule |
---|---|---|
attempts | int32 Actual number of retries attempted depends on the httpReqTimeout. | int32 = { |
perTryTimeout | google.protobuf.Duration | – |
retryOn | string | string = { |
InboundTrafficSetting
Configuration for inbound traffic.
Field | Description | Validation Rule |
---|---|---|
rateLimiting | tetrateio.api.tsb.gateway.v2.RateLimiting | – |
resilience | tetrateio.api.tsb.traffic.v2.DownstreamResilienceSettings | – |
failoverSettings | tetrateio.api.tsb.types.v2.FailoverSettings | – |
KeepAliveSettings
Keep Alive Settings.
Field | Description | Validation Rule |
---|---|---|
tcp | tetrateio.api.tsb.traffic.v2.TcpKeepAliveSettings | – |
LoadBalancerSettings
Defines Load Balancing policies to be applied on the client requests.
Field | Description | Validation Rule |
---|---|---|
simple | tetrateio.api.tsb.traffic.v2.LoadBalancerSettings.SimpleLB oneof _lb_policy | enum = { |
consistentHash | tetrateio.api.tsb.traffic.v2.LoadBalancerSettings.ConsistentHashLB oneof _lb_policy | – |
ConsistentHashLB
Consistent Hash-based load balancing can be used to provide soft session affinity based on HTTP headers, cookies or other properties. The affinity to a particular destination host may be lost when one or more hosts are added/removed from the destination service.
Note: consistent hashing is less reliable at maintaining affinity than common
"sticky sessions" implementations, which often encode a specific destination in
a cookie, ensuring affinity is maintained as long as the backend remains.
With consistent hash, the guarantees are weaker; any host addition or removal can
break affinity for 1/backends
requests.
Warning: consistent hashing depends on each proxy having a consistent view of endpoints. This is not the case when locality load balancing is enabled. Locality load balancing and consistent hash will only work together when all proxies are in the same locality, or a high level load balancer handles locality affinity.
Field | Description | Validation Rule |
---|---|---|
httpHeaderName | string oneof _hash_key | – |
httpCookie | tetrateio.api.tsb.traffic.v2.LoadBalancerSettings.ConsistentHashLB.HTTPCookie oneof _hash_key | – |
useSourceIp | bool oneof _hash_key | – |
httpQueryParameterName | string oneof _hash_key | – |
ringHash | tetrateio.api.tsb.traffic.v2.LoadBalancerSettings.ConsistentHashLB.RingHash oneof _hash_algorithm | – |
maglev | tetrateio.api.tsb.traffic.v2.LoadBalancerSettings.ConsistentHashLB.MagLev oneof _hash_algorithm | – |
HTTPCookie
Describes a HTTP cookie that will be used as the hash key for the Consistent Hash load balancer. If the cookie is not present, it will be generated.
Field | Description | Validation Rule |
---|---|---|
name | string | string = { |
path | string | – |
ttl | google.protobuf.Duration | duration = { |
MagLev
Implements consistent hashing to upstream hosts.
It can be used as a drop in replacement for RingHash
. It has higher speed than RingHash with faster hash table lookups.
Please refer https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/load_balancers#maglev
Field | Description | Validation Rule |
---|---|---|
tableSize | uint32 | uint32 = { |
RingHash
Implements consistent hashing to upstream hosts. Each upstream host is mapped onto a circle (ring) by hashing its address, each request is then routed using some hash property of the request. Please refer https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/load_balancers#ring-hash
Field | Description | Validation Rule |
---|---|---|
minimumRingSize | uint32 | – |
OutboundTrafficSetting
Configuration for outbound traffic.
Field | Description | Validation Rule |
---|---|---|
reachability | tetrateio.api.tsb.traffic.v2.ReachabilitySettings | – |
egress | tetrateio.api.tsb.traffic.v2.OutboundTrafficSetting.EgressGateway | – |
upstreamTrafficSettings | List of tetrateio.api.tsb.traffic.v2.UpstreamTrafficSettings | – |
EgressGateway
EgressGateway specifies the gateway where traffic external to the mesh will be redirected.
Field | Description | Validation Rule |
---|---|---|
host | string | string = { |
ReachabilitySettings
ReachabilitySettings
define the set of services and hosts
accessed by a workload (and hence its sidecar) in the
mesh. Defining the set of services accessed by a workload (i.e. its
dependencies) in advance reduces the memory and CPU consumption
both the Istio control plane and the individual Envoy proxy workloads in
the data plane.
Field | Description | Validation Rule |
---|---|---|
mode | tetrateio.api.tsb.traffic.v2.ReachabilitySettings.Mode | – |
hosts | List of string
| – |
ResilienceSettings
ResilienceSettings control the reliability knobs in Envoy when making outbound connections from a gateway or proxy workload.
Field | Description | Validation Rule |
---|---|---|
httpRequestTimeout | google.protobuf.Duration | – |
httpRetries | tetrateio.api.tsb.traffic.v2.HTTPRetry | – |
tcpKeepalive | google.protobuf.BoolValue | – |
keepAlive | tetrateio.api.tsb.traffic.v2.KeepAliveSettings | – |
circuitBreakerSensitivity | tetrateio.api.tsb.traffic.v2.ResilienceSettings.Sensitivity | – |
TcpKeepAlive
Field | Description | Validation Rule |
---|---|---|
probes | google.protobuf.UInt32Value | – |
idleTime | google.protobuf.UInt32Value | – |
interval | google.protobuf.UInt32Value | – |
TcpKeepAliveSettings
TCP Keep Alive Settings.
Field | Description | Validation Rule |
---|---|---|
downstream | tetrateio.api.tsb.traffic.v2.TcpKeepAlive | – |
upstream | tetrateio.api.tsb.traffic.v2.TcpKeepAlive | – |
TrafficSetting
A traffic setting applies configuration to a set of proxy workloads in a traffic group or a workspace. When applied to a traffic group, missing fields will inherit values from the workspace-wide setting if any.
Field | Description | Validation Rule |
---|---|---|
reachability | tetrateio.api.tsb.traffic.v2.ReachabilitySettings DEPRECATED. Moved to | – |
resilience | tetrateio.api.tsb.traffic.v2.ResilienceSettings DEPRECATED. Moved to | – |
egress | tetrateio.api.tsb.traffic.v2.TrafficSetting.EgressGateway DEPRECATED. Moved to | – |
rateLimiting | tetrateio.api.tsb.gateway.v2.RateLimiting DEPRECATED. Moved to | – |
upstreamTrafficSettings | List of tetrateio.api.tsb.traffic.v2.UpstreamTrafficSettings DEPRECATED. Moved to | – |
inbound | tetrateio.api.tsb.traffic.v2.InboundTrafficSetting | – |
outbound | tetrateio.api.tsb.traffic.v2.OutboundTrafficSetting | – |
configGenerationMetadata | tetrateio.api.tsb.types.v2.ConfigGenerationMetadata | – |
EgressGateway
EgressGateway specifies the gateway where traffic external to the mesh will be redirected.
Field | Description | Validation Rule |
---|---|---|
host | string | string = { |
port | int32 | – |
UpstreamResilienceSettings
UpstreamResilienceSettings controls the reliability knobs for client connections to the upstream hosts.
Field | Description | Validation Rule |
---|---|---|
connectionPool | tetrateio.api.tsb.traffic.v2.UpstreamResilienceSettings.ConnectionPoolSettings | – |
circuitBreakerSensitivity | tetrateio.api.tsb.traffic.v2.UpstreamResilienceSettings.Sensitivity | enum = { |
ConnectionPoolSettings
Connection pool settings for the upstream host.
Field | Description | Validation Rule |
---|---|---|
http | tetrateio.api.tsb.traffic.v2.UpstreamResilienceSettings.ConnectionPoolSettings.HTTP | – |
tcp | tetrateio.api.tsb.traffic.v2.UpstreamResilienceSettings.ConnectionPoolSettings.TCP | – |
HTTP
HTTP Settings for outbound requests.
Field | Description | Validation Rule |
---|---|---|
requestTimeout | google.protobuf.Duration | – |
retries | tetrateio.api.tsb.traffic.v2.HTTPRetry | – |
maxRequests | uint32 | – |
maxRequestsPerConnection | uint32 | – |
TCP
TCP Settings for outbound requests.
Field | Description | Validation Rule |
---|---|---|
keepAlive | tetrateio.api.tsb.traffic.v2.TcpKeepAlive | – |
maxConnections | uint32 | – |
connectTimeout | google.protobuf.Duration | duration = { |
UpstreamTrafficSettings
Traffic settings for the clients that are downstreams to the defined upstream hosts.
Field | Description | Validation Rule |
---|---|---|
hosts | List of string | repeated = { |
settings | tetrateio.api.tsb.traffic.v2.UpstreamTrafficSettings.Settings | – |
Settings
Traffic settings to be applied to the clients of the upstream hosts.
Field | Description | Validation Rule |
---|---|---|
resilience | tetrateio.api.tsb.traffic.v2.UpstreamResilienceSettings | – |
loadBalancer | tetrateio.api.tsb.traffic.v2.LoadBalancerSettings | – |
authentication | tetrateio.api.tsb.traffic.v2.AuthenticationSettings | – |
AuthenticationMode
AuthenticationMode configures whether to initiate only mutual TLS connections or to allow plaintext traffic as well.
Field | Number | Description |
---|---|---|
UNSET | 0 | Default is UNSET. |
OPTIONAL | 1 | Accept both plaintext and mTLS authenticated connections. |
REQUIRED | 2 | Always initiate mutual TLS authenticated connections, and fail if the upstream does not support it. |
SimpleLB
Standard load balancing algorithms that require no tuning.
Field | Number | Description |
---|---|---|
UNSPECIFIED | 0 | No load balancing algorithm has been specified by the user. An appropriate default will be used. |
RANDOM | 2 | The random load balancer selects a random healthy host. The random load balancer generally performs better than round robin if no health checking policy is configured. |
PASSTHROUGH | 3 | This option will forward the connection to the original IP address requested by the caller without doing any form of load balancing. This option must be used with care. It is meant for advanced use cases. Refer to Original Destination load balancer in Envoy for further details. |
ROUND_ROBIN | 4 | A basic round robin load balancing policy. This is generally unsafe for many scenarios (e.g. when enpoint weighting is used) as it can overburden endpoints. In general, prefer to use LEAST_REQUEST as a drop-in replacement for ROUND_ROBIN. |
LEAST_REQUEST | 5 | The least request load balancer spreads load across endpoints, favoring endpoints with the least outstanding requests. This is generally safer and outperforms ROUND_ROBIN in nearly all cases. Prefer to use LEAST_REQUEST as a drop-in replacement for ROUND_ROBIN. |
Mode
A short cut for defining the common reachability patterns
Field | Number | Description |
---|---|---|
UNSET | 0 | Inherit from parent if possible. Otherwise treated as |
NAMESPACE | 1 | The workload may talk to any service in its own namespace. |
GROUP | 2 | The workload may talk to any service in the traffic group. |
WORKSPACE | 3 | The workload may talk to any service in the workspace. |
CLUSTER | 4 | The workload may talk to any service in the cluster. |
CUSTOM | 5 | The workload may talk to services defined explicitly. |
Sensitivity
Available sensitivity levels for the circuit breaker.
Field | Number | Description |
---|---|---|
UNSET | 0 | Default values will be used. |
LOW | 1 | Tolerate up to 20 consecutive 5xx or connection failures from an endpoint before ejecting it temporarily from the load balancing pool. |
MEDIUM | 2 | Tolerate up to 10 consecutive 5xx or connection failures from an endpoint before ejecting it temporarily from the load balancing pool. |
HIGH | 3 | Tolerate up to 5 consecutive 5xx or connection failures from an endpoint before ejecting it temporarily from the load balancing pool. |
Sensitivity
Available sensitivity levels for the circuit breaker.
Field | Number | Description |
---|---|---|
UNSET | 0 | Default values will be used. |
LOW | 1 | Tolerate up to 20 consecutive 5xx or connection failures from an endpoint before ejecting it temporarily from the load balancing pool. |
MEDIUM | 2 | Tolerate up to 10 consecutive 5xx or connection failures from an endpoint before ejecting it temporarily from the load balancing pool. |
HIGH | 3 | Tolerate up to 5 consecutive 5xx or connection failures from an endpoint before ejecting it temporarily from the load balancing pool. |