Expand the traffic-split plug-in #12250
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Expand the traffic-split plug-in to solve the following scenarios:
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
}
]
}
]
}
}
}'
`