Skip to content

Commit

Permalink
fix egress node and gateway acl should apply after lb. (#2310)
Browse files Browse the repository at this point in the history
  • Loading branch information
changluyi committed Feb 8, 2023
1 parent 22cc933 commit 8c1edc8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/ovs/ovn-nbctl-legacy.go
Expand Up @@ -1971,7 +1971,7 @@ func (c LegacyClient) CreateGatewayACL(pgName, gateway, cidr string) error {
ipSuffix = "ip6"
}
ingressArgs := []string{MayExist, "--type=port-group", "acl-add", pgName, "to-lport", util.IngressAllowPriority, fmt.Sprintf("%s.src == %s", ipSuffix, gw), "allow-related"}
egressArgs := []string{"--", MayExist, "--type=port-group", "acl-add", pgName, "from-lport", util.EgressAllowPriority, fmt.Sprintf("%s.dst == %s", ipSuffix, gw), "allow-related"}
egressArgs := []string{"--", MayExist, "--type=port-group", "--apply-after-lb", "acl-add", pgName, "from-lport", util.EgressAllowPriority, fmt.Sprintf("%s.dst == %s", ipSuffix, gw), "allow-related"}
ovnArgs := append(ingressArgs, egressArgs...)
if _, err := c.ovnNbCommand(ovnArgs...); err != nil {
return err
Expand All @@ -1992,7 +1992,7 @@ func (c LegacyClient) CreateACLForNodePg(pgName, nodeIpStr, joinIpStr string) er
pgAs := fmt.Sprintf("%s_%s", pgName, ipSuffix)

ingressArgs := []string{MayExist, "--type=port-group", "acl-add", pgName, "to-lport", util.NodeAllowPriority, fmt.Sprintf("%s.src == %s && %s.dst == $%s", ipSuffix, nodeIp, ipSuffix, pgAs), "allow-related"}
egressArgs := []string{"--", MayExist, "--type=port-group", "acl-add", pgName, "from-lport", util.NodeAllowPriority, fmt.Sprintf("%s.dst == %s && %s.src == $%s", ipSuffix, nodeIp, ipSuffix, pgAs), "allow-related"}
egressArgs := []string{"--", MayExist, "--type=port-group", "--apply-after-lb", "acl-add", pgName, "from-lport", util.NodeAllowPriority, fmt.Sprintf("%s.dst == %s && %s.src == $%s", ipSuffix, nodeIp, ipSuffix, pgAs), "allow-related"}
ovnArgs := append(ingressArgs, egressArgs...)
if _, err := c.ovnNbCommand(ovnArgs...); err != nil {
klog.Errorf("failed to add node port-group acl: %v", err)
Expand Down

0 comments on commit 8c1edc8

Please sign in to comment.