Skip to content

Commit

Permalink
distinguish nat ip for central subnet with ecmp and active-standby (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hongzhen-ma authored Aug 3, 2023
1 parent a27ce4c commit 42e0574
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/daemon/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 42e0574

Please sign in to comment.