SouthwestAsiaFloat opened a new pull request, #7963:
URL: https://github.com/apache/shenyu/pull/7963
### Summary
Adds optional, disabled-by-default Canary routing to the Divide plugin.
- Add `CanaryConfig` with request conditions, traffic percentage, sticky
key, partition labels, and an empty-pool fallback policy.
- Validate configuration in Admin before persistence and in the gateway
before cache replacement.
- Use deterministic bucketing to assign requests to Stable or Canary, then
reuse existing circuit breaking and load balancing within that partition.
- Preserve legacy routing when Canary configuration is absent. A present but
disabled configuration routes to Stable.
Partition-aware failover retries and metrics remain separate changes in the
future. This PR rejects positive failover retries on rules containing Canary
configuration.
### Example
```json
{
"loadBalance": "roundRobin",
"timeout": 3000,
"retry": 0,
"canary": {
"enabled": true,
"conditions": [
{"paramType": "header", "paramName": "X-Region", "operator": "=",
"paramValue": "east"}
],
"matchMode": 0,
"percentage": 10,
"stickyKey": {"paramType": "header", "paramName": "X-User-Id"},
"stableLabels": {"release": "stable"},
"canaryLabels": {"release": "canary"},
"fallbackPolicy": "STABLE"
}
}
```
### Architecture
```mermaid
flowchart TD
A["Admin: RuleServiceImpl"] --> B["CanaryConfigValidator"]
B --> C["Existing rule.handle storage and data sync"]
C --> D["DividePluginDataHandler: validate and cache"]
R["Request matched by Selector / Rule"] --> E["DividePlugin"]
D -. "Read configuration" .-> E
E --> F["DefaultCanaryDecisionService<br/>Conditions + sticky-key
bucketing"]
F --> G["Select Stable / Canary nodes by labels"]
U["DivideUpstreamDataHandler<br/>Cache both upstream pools"] --> G
G --> H["Existing circuit breaker / half-open probes"]
H --> I["Existing load balancer"]
I --> J["HTTP forwarding"]
```
- [x] You have read the [contribution
guidelines](https://shenyu.apache.org/community/contributor-guide).
- [x] You submit test cases (unit or integration tests) that back your
changes.
- [x] Your local test passed `./mvnw clean install
-Dmaven.javadoc.skip=true`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]