From: Takao Yatagai <[email protected]>

A load balancer on a distributed logical router without a distributed
gateway port (DGP) is applied in lr_in_dnat on every chassis, but the
router gets no un-DNAT for the replies: only gateway routers and
routers with a DGP do.  ovn-nb(5) accordingly says that router load
balancers only work without limitations on gateway routers and on
routers with a single DGP.

This series adds an opt-in Load_Balancer options:symmetric_return=true.
With it, the CMS asserts that replies re-enter the router on the
chassis that load balanced the request, and northd adds the same
priority 120 lr_out_undnat flow that DGP routers get, without the DGP
and chassis terms.  OVN does not verify the guarantee.

Motivation
----------

We give clients with overlapping address spaces private access to a
shared service through three routers in series, all peered:

  client LS -- LR1 -- LR2 (router LB, no DGP) -- LR3 -- localnet
               (client's router)    (DGP; one distributed
                                     dnat_and_snat per client)

LR2 maps an address in the client's subnet to the service VIP, which
may even equal the client's own IP.  LR3 gives each client its own
source address on the provider network.  LR3's distributed NAT brings
the replies back to the client's chassis, which is where LR2 load
balanced the request, so DNAT, SNAT and both reverse translations all
run on the client's chassis and the gateway chassis stays out of the
data path.  The only missing piece is LR2's un-DNAT.

Alternatives we tried:

- A router LB on a router with a DGP works, but it is centralized on
  the gateway chassis.
- options:distributed (commit 7b0eb4d9ed05, "northd: Add distributed
  load balancer support.") needs backends that are local logical
  ports (ct_lb_mark_local).  Our backends are outside OVN.
- The LB and the SNAT on one DGP router conflicts with NB_Global
  options:use_common_zone=true (commit b8c40e7593a9), which we need.
  Keeping the LB and the SNAT on separate routers avoids that.
- A switch LB on a transit switch between the routers is never
  applied: northd skips conntrack for traffic from router ports in
  ls_in_pre_lb (skip_port_from_conntrack(), priority 110 above the
  priority 100 LB flow).

Patches
-------

1/2 moves the existing un-DNAT flow of DGP routers and the choice of
    its action into helpers.  No functional change: same match,
    action and flow order.  On main the helper also takes the
    chassisredirect port, so options:distributed is covered
    unchanged.

2/2 adds the option: parsing, one call in the no-DGP branch of
    build_lrouter_nat_flows_for_lb(), ovn-nb.xml, NEWS and an
    ovn-northd.at test.

Testing
-------

- "make check": all of ovn-northd.at and the load balancer tests in
  ovn.at pass at each commit, and the new test passes.
- End to end, on a multi-chassis setup with the userspace datapath
  and use_common_zone=true: the topology above works, the conntrack
  entries for the LB, the SNAT and the ACLs are all on the client's
  chassis, and none are on the gateway.  The existing tests of that
  setup show no regressions.

Takao Yatagai (2):
  northd: Factor out the LB un-DNAT flow of DGP routers.
  northd: Add LB option symmetric_return.

 NEWS                |  3 ++
 northd/lb.c         |  3 ++
 northd/lb.h         |  6 ++++
 northd/northd.c     | 85 +++++++++++++++++++++++++++++++--------------
 ovn-nb.xml          | 30 ++++++++++++++++
 tests/ovn-northd.at | 67 +++++++++++++++++++++++++++++++++++
 6 files changed, 167 insertions(+), 27 deletions(-)

-- 
2.55.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to