Skip to content

Commit

Permalink
perf: remove default acl rules
Browse files Browse the repository at this point in the history
(cherry picked from commit 292bf4c)
  • Loading branch information
oilbeater committed Oct 17, 2020
1 parent 2ad7110 commit 34952c8
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions pkg/ovs/ovn-nbctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,12 @@ func (c Client) CreateLogicalSwitch(ls, protocol, subnet, gateway string, exclud
_, err = c.ovnNbCommand(MayExist, "ls-add", ls, "--",
"set", "logical_switch", ls, fmt.Sprintf("other_config:subnet=%s", subnet), "--",
"set", "logical_switch", ls, fmt.Sprintf("other_config:gateway=%s", gateway), "--",
"set", "logical_switch", ls, fmt.Sprintf("other_config:exclude_ips=%s", strings.Join(excludeIps, " ")), "--",
"acl-add", ls, "to-lport", util.NodeAllowPriority, fmt.Sprintf("ip4.src==%s", c.NodeSwitchCIDR), "allow-related")
"set", "logical_switch", ls, fmt.Sprintf("other_config:exclude_ips=%s", strings.Join(excludeIps, " ")))
case kubeovnv1.ProtocolIPv6:
_, err = c.ovnNbCommand(MayExist, "ls-add", ls, "--",
"set", "logical_switch", ls, fmt.Sprintf("other_config:ipv6_prefix=%s", strings.Split(subnet, "/")[0]), "--",
"set", "logical_switch", ls, fmt.Sprintf("other_config:gateway=%s", gateway), "--",
"set", "logical_switch", ls, fmt.Sprintf("other_config:exclude_ips=%s", strings.Join(excludeIps, " ")), "--",
"acl-add", ls, "to-lport", util.NodeAllowPriority, fmt.Sprintf("ip6.src==%s", c.NodeSwitchCIDR), "allow-related")
"set", "logical_switch", ls, fmt.Sprintf("other_config:exclude_ips=%s", strings.Join(excludeIps, " ")))
}

if err != nil {
Expand Down Expand Up @@ -549,14 +547,7 @@ func (c Client) CleanLogicalSwitchAcl(ls string) error {

// ResetLogicalSwitchAcl reset acl of a switch
func (c Client) ResetLogicalSwitchAcl(ls, protocol string) error {
var err error
if protocol == kubeovnv1.ProtocolIPv6 {
_, err = c.ovnNbCommand("acl-del", ls, "--",
"acl-add", ls, "to-lport", util.NodeAllowPriority, fmt.Sprintf("ip6.src==%s", c.NodeSwitchCIDR), "allow-related")
} else {
_, err = c.ovnNbCommand("acl-del", ls, "--",
"acl-add", ls, "to-lport", util.NodeAllowPriority, fmt.Sprintf("ip4.src==%s", c.NodeSwitchCIDR), "allow-related")
}
_, err := c.ovnNbCommand("acl-del", ls)
return err
}

Expand Down

0 comments on commit 34952c8

Please sign in to comment.