Skip to content

vr: serve UDP load balancer rules with IPVS - #18

Draft
calvix wants to merge 1 commit into
integration/all-fixes-4.23.0.0from
feature/vr-udp-lb
Draft

calvix wants to merge 1 commit into
integration/all-fixes-4.23.0.0from
feature/vr-udp-lb

Conversation

@calvix

@calvix calvix commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Sketch: UDP load balancer rules on the virtual router, served by IPVS (NAT mode) instead of haproxy.

Changes

  • Management server: UDP LB rules are no longer refused on the VR; only source based stickiness is allowed for them (its expire becomes the IPVS persistence timeout), health check policies are refused. A UDP rule gets a UDP firewall rule, and an update cannot switch a rule between udp and the tcp based protocols.
  • Config to the router: UDP rules are left out of haproxy.cfg and haproxy's (tcp) firewall rules and sent as a new udp_rules list (VIP, port, scheduler, persistence, backends, source CIDRs). Algorithms: roundrobin -> rr, leastconn -> lc, source -> sh.
  • Router (CsLoadBalancer.py): opens the UDP port per source CIDR, syncs the IPVS table with ipvsadm (adds/removes only the differences), sets net.ipv4.vs.conntrack=1.

Tested

Unit tests only (HAProxyConfiguratorTest, NetworkHelperImplTest, LoadBalancingRulesManagerImplTest, VirtualRouterElementTest, ConfigHelperTest), build with -P developer. Not tried on a router yet.

Open

  • check on a real VR: reply path through FORWARD/SNAT, VPC VR INPUT chain
  • hairpin (a guest reaching the LB IP from the same network) does not work with IPVS NAT
  • no health checks; no connection sync on redundant VR failover
  • internal LB VM (ilb.sh) not covered

haproxy cannot balance UDP, so the virtual router refused UDP load
balancer rules although it lists udp as a supported protocol.

UDP rules are now left out of the haproxy configuration and sent to the
router as a separate list. The router serves them with IPVS in NAT mode
(it is the gateway of the backends), keeping the IPVS table in sync with
the rules instead of flushing it, and opens the UDP port in its firewall
for the rule's source CIDRs.

- algorithms map to IPVS schedulers: roundrobin -> rr, leastconn -> lc,
  source -> sh; source based stickiness becomes IPVS persistence with
  its expire value as the timeout
- other stickiness methods and health check policies are refused for
  UDP rules
- a UDP rule gets a UDP firewall rule, and its protocol cannot be
  switched between udp and the tcp based protocols
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant