nanamikon commented on issue #4683:
URL: https://github.com/apache/apisix/issues/4683#issuecomment-887965991
Thanks for suggestion, if I perfer to create a new balance type , the
following issues have to be solved
1. I have to modify the new function of balance type implements, because I
have to pass plugin conf for determining which node to be shielded
And then I have to modify balance.lua to pass plugin conf too.
2. Idc Traffic shield is a global feature, and I think it is not related
with special balance type. Refer to priority.lua , I should add a new
loadbalance type to filter nodes by plugin conf, and then forward to others;
Add new lua file, traffic_shield.lua
```
function _M.new(up_nodes, upstream, plugin_conf, picker_mod)
local filter_nodes = filter_by_meta(up_nodes, plugin_conf)
local picker = picker_mod.new(filter_nodes , upstream)
......
end
```
Modify balance.lua
```
local function create_server_picker(upstream, checker, plugin_conf)
....
if picker then
local traffic_shield_picker =
require("apisix.balancer.traffic_shield")
local up_nodes = fetch_health_nodes(upstream, checker,
filter_idc_ids)
if #up_nodes._priority_index > 1 then
core.log.info("upstream nodes: ",
core.json.delay_encode(up_nodes))
return traffic_shield_picker.new(up_nodes, upstream,
plugin_conf, priority_balancer, picker)
end
core.log.info("upstream nodes: ",
core.json.delay_encode(up_nodes[up_nodes._priority_index[1]]))
return
traffic_shield_picker.new(up_nodes[up_nodes._priority_index[1]], upstream,
plugin_conf, picker)
end
....
end
```
But I think I will run into trouble when merging code from newest apisix
version later, because I modify balance.lua....
So what about adding a new balance filter phase for filter nodes
--
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]