From 363760e162283675e84b7e53ac1267ed52d2b388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=B4=AA=E8=B4=9E?= Date: Tue, 1 Aug 2023 15:39:45 +0800 Subject: [PATCH] distinguish nat ip for central subnet with ecmp and active-standby --- pkg/daemon/gateway.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/daemon/gateway.go b/pkg/daemon/gateway.go index 7ecca9ce755..5f82c23a62d 100644 --- a/pkg/daemon/gateway.go +++ b/pkg/daemon/gateway.go @@ -239,7 +239,11 @@ func (c *Controller) getEgressNatIpByNode(nodeName string) (map[string]string, e for _, cidr := range strings.Split(subnet.Spec.CIDRBlock, ",") { for _, gw := range strings.Split(subnet.Spec.GatewayNode, ",") { if strings.Contains(gw, ":") && util.GatewayContains(gw, nodeName) && util.CheckProtocol(cidr) == util.CheckProtocol(strings.Split(gw, ":")[1]) { - subnetsNatIp[cidr] = strings.TrimSpace(strings.Split(gw, ":")[1]) + if subnet.Spec.EnableEcmp { + subnetsNatIp[cidr] = strings.TrimSpace(strings.Split(gw, ":")[1]) + } else if subnet.Status.ActivateGateway == nodeName { + subnetsNatIp[cidr] = strings.TrimSpace(strings.Split(gw, ":")[1]) + } break } }