qmsk / clusterf

Clustered IPVS load balancer control plane with Docker integration
MIT License
35 stars 4 forks source link

clusterf-ipvs: update Route changes #6

Closed SpComb closed 8 years ago

SpComb commented 8 years ago

Currently the set of active Routes is only applied on Service backend changes. Services also need to be updated if the set of Routes changes, e.g. if a Route for a backend host is withdrawn, then all backends routed via that host should be removed, and vice-versa.

SpComb commented 8 years ago

Fixed with the rewritten config package.

$ etcdctl get /clusterf-dev/routes/37334d3c1c5ca7239f9fafce6937912913342997efceaaa5089b8196d1f7d95a
{"Prefix":"10.6.107.0/24","Gateway":"10.107.107.6","IPVSMethod":"droute"}

2016/05/09 16:41:11 Configure...
2016/05/09 16:41:11 IPVS: New service inet+udp://10.0.107.1:25826
2016/05/09 16:41:11 IPVS: New service inet+udp://10.0.107.1:25826 dest 10.107.107.6:25826
Proto                           Addr:Port
udp                       10.0.107.1:25826 wlc
                    10.107.107.6:25826 droute

$ etcdctl set /clusterf-dev/routes/37334d3c1c5ca7239f9fafce6937912913342997efceaaa5089b8196d1f7d95a '{"Prefix":"10.6.107.0/24","Gateway":"10.107.107.6","IPVSMethod":"tunnel"}'
{"Prefix":"10.6.107.0/24","Gateway":"10.107.107.6","IPVSMethod":"tunnel"}

2016/05/09 16:41:40 config:EtcdSource.watch: set routes/37334d3c1c5ca7239f9fafce6937912913342997efceaaa5089b8196d1f7d95a
2016/05/09 16:41:40 IPVS: Set service inet+udp://10.0.107.1:25826 dest 10.107.107.6:25826
Proto                           Addr:Port
udp                       10.0.107.1:25826 wlc
                    10.107.107.6:25826 tunnel

$ etcdctl rm /clusterf-dev/routes/37334d3c1c5ca7239f9fafce6937912913342997efceaaa5089b8196d1f7d95a '{"Prefix":"10.6.107.0/24","Gateway":"10.107.107.6","IPVSMethod":"tunnel"}'
PrevNode.Value: {"Prefix":"10.6.107.0/24","Gateway":"10.107.107.6","IPVSMethod":"tunnel"}

2016/05/09 16:41:43 config:EtcdSource.watch: delete routes/37334d3c1c5ca7239f9fafce6937912913342997efceaaa5089b8196d1f7d95a
2016/05/09 16:41:43 IPVS: New service inet+udp://10.0.107.1:25826 dest 10.6.107.2:25826
2016/05/09 16:41:43 IPVS: Delete service inet+udp://10.0.107.1:25826 dest 10.107.107.6:25826
Proto                           Addr:Port
udp                       10.0.107.1:25826 wlc
                      10.6.107.2:25826 masq