Service Route
Service Routes can be used by service owners to configure traffic shifting across different versions of a service in a traffic group. Traffic to this service can originate from sidecars in same or different traffic groups as well as gateways.
The following example creates a traffic group for the proxies in
ns1
, ns2
and ns3
namespaces owned by its parent workspace
w1
under tenant mycompany
and defines a service route for the
reviews
service in ns1
namespace with two subsets v1
and
v2
. 80% of the traffic to the reviews service is sent to v1
while the remaining 20% is sent to v2
.
apiVersion: traffic.tsb.tetrate.io/v2
kind: Group
metadata:
name: t1
workspace: w1
tenant: mycompany
organization: myorg
spec:
namespaceSelectors:
- name: "*/ns1"
- name: "*/ns2"
- name: "*/ns3"
configMode: BRIDGED
And the service route for reviews.com
service in ns1
namespace
apiVersion: traffic.tsb.tetrate.io/v2
kind: ServiceRoute
metadata:
name: reviews
group: t1
workspace: w1
tenant: mycompany
organization: myorg
spec:
service: ns1/reviews.com
subsets:
- name: v1
labels:
version: v1
weight: 80
- name: v2
labels:
version: v2
weight: 20
ServiceRoute
A service route controls routing configurations for traffic to a service in a traffic group.
Field | Description | Validation Rule |
service | string | string = { |
subsets | List of tetrateio.api.tsb.traffic.v2.ServiceRoute.Subset | repeated = { |
stickySession | tetrateio.api.tsb.traffic.v2.ServiceRoute.StickySession | – |
StickySession
If set, all requests from a client will be forward to the same backend.
Field | Description | Validation Rule |
header | string | string = { |
cookie | tetrateio.api.tsb.traffic.v2.ServiceRoute.StickySession.HTTPCookie | – |
useSourceIp | bool | – |
HTTPCookie
Describes a HTTP cookie that will be used for sticky sessions. If the cookie is not present, it will be generated.
Field | Description | Validation Rule |
name | string | string = { |
path | string | string = { |
ttl | google.protobuf.Duration | timestamp = { |
Subset
Subset denotes a specific version of a service. The pods/VMs of a subset should be uniquely identifiable using their labels.
Field | Description | Validation Rule |
name | string | string = { |
labels | map<string, string> | |
weight | uint32 | – |