Skip to content

Expand the traffic-split plug-in #12250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lordcheng10
Copy link

Description

Expand the traffic-split plug-in to solve the following scenarios:

  1. Service A is deployed in two regions, and the region-aware configuration of Eureka is enabled;
  2. Use the traffic-split plug-in to split the traffic of the service in different regions;

configuration modification

eureka-fileter: host: - https://xxx prefix: /eureka/ fetch_interval: 15 weight: 100 timeout: connect: 2000 send: 2000 read: 5000

Use the command as follows:

`
curl http://127.0.0.1:9180/apisix/admin/upstreams/zone1_provider -H "X-API-KEY: dd" -X PUT -d '{
"type": "roundrobin",
"name": "gcp_provider",
"discovery_type": "eureka-filter",
"service_name": "SERVICE-PROVIDER",
"discovery_args": {
"zone": "zone1"
}
}'

curl -i http://127.0.0.1:9180/apisix/admin/upstreams/zone2_provider -H "X-API-KEY: dd" -X PUT -d '{
"type": "roundrobin",
"name": "aws_provider",
"discovery_type": "eureka-filter",
"service_name": "SERVICE-PROVIDER",
"discovery_args": {
"zone": "zone2"
}
}'

curl -i http://127.0.0.1:9180/apisix/admin/routes/zone_traffic_split_test -H "X-API-KEY: dd" -X PUT -d '
{
"uri": "/hello",
"plugins": {
"traffic-split": {
"rules": [
{
"weighted_upstreams": [
{
"upstream_id": "zone1_provider",
"weight": 90
},
{
"upstream_id": "zone2_provider",
"weight": 10
}
]
}
]
}
}
}'
`

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels May 24, 2025
@lordcheng10
Copy link
Author

@membphis @nic-6443 @nic-chen PTL,thanks!

Copy link
Contributor

@shreemaan-abhishek shreemaan-abhishek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two things:

  • advisable to discuss the proposal first with the community
  • need to add docs and test cases after ⬆️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants