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:
reachability:
mode: CUSTOM
hosts:
- "ns1/*"
- "ns2/*"
- "ns3/*"
- "db/*"
resilience:
circuitBreakerSensitivity: MEDIUM
egress:
host: istio-system/istio-egressgateway
Part of resilience
setting as set in above example is deprecated in
favor of upstreamTrafficSettings
. To achieve the same behavior
using the new upstreamTrafficSettings
:
apiVersion: traffic.tsb.tetrate.io/v2
kind: TrafficSetting
metadata:
name: defaults
group: t1
workspace: w1
tenant: mycompany
organization: myorg
spec:
upstreamTrafficSettings:
- hosts:
- '*'
settings:
resilience:
circuitBreakerSensitivity: MEDIUM
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:
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:
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:
reachability:
mode: GROUP
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 = { |
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 | – |
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 | – |
resilience | tetrateio.api.tsb.traffic.v2.ResilienceSettings | – |
egress | tetrateio.api.tsb.traffic.v2.TrafficSetting.EgressGateway | – |
rateLimiting | tetrateio.api.tsb.gateway.v2.RateLimiting | – |
upstreamTrafficSettings | List of tetrateio.api.tsb.traffic.v2.UpstreamTrafficSettings | – |
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 | – |
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. |