-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial doc for traffic splitting (#1028)
* initial doc for traffic splitting Signed-off-by: jasmingacic <jasmin.gacic@gmail.com> * extended traffic splitting docs added it to side bar Signed-off-by: jasmingacic <jasmin.gacic@gmail.com> Signed-off-by: jasmingacic <jasmin.gacic@gmail.com>
- Loading branch information
1 parent
4aef646
commit 681fbe1
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Traffic splitting | ||
|
||
Traffic splitting in Kusk allows for traffic to be routed to 2 or more targets for the same API. The traffic to the API or API path will be split between services running different version of the same service. | ||
|
||
## How does Traffic splitting work? | ||
|
||
Setting property `x-kusk.upstreams` allows users to configure several endpoints for the API to which traffic will be split according to the value of `service.weight`. | ||
|
||
```yaml | ||
openapi: 3.0.0 | ||
info: | ||
title: simple-api | ||
version: 0.1.0 | ||
x-kusk: | ||
upstreams: | ||
service: | ||
name: simple-api-servicev1 | ||
namespace: default | ||
port: 80 | ||
weight: 50 | ||
service: | ||
name: simple-api-servicev2 | ||
namespace: test-namespace | ||
port: 80 | ||
weight: 50 | ||
.. | ||
``` | ||
|
||
The sum of the weights must be equal to 100. In this example traffic will be split equaly between services. Any number of services can be used as long the total weight equals to 100. | ||
|
||
To debug easily Kusk will set response header `x-kusk-weighted-cluster:[service_name]` for each weighted service. | ||
|
||
The property `x-kusk.upstreams` is mutually exclusive with `x-kusk.upstream` as well with `x-kusk.validation` will not accept multiple upstreams. | ||
|
||
Upstreams can be combination `service` and `host` where each must have weight value assinged. | ||
|
||
```yaml | ||
openapi: 3.0.0 | ||
info: | ||
title: simple-api | ||
version: 0.1.0 | ||
x-kusk: | ||
upstreams: | ||
service: | ||
name: simple-api-servicev1 | ||
namespace: default | ||
port: 80 | ||
weight: 50 | ||
host: | ||
hostname: simple-api-servicev2 | ||
port: 80 | ||
weight: 50 | ||
.. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters