Skip to content

Commit

Permalink
Signed-off-by: changluyi <[email protected]> (#3349)
Browse files Browse the repository at this point in the history
fix access svc ip failed, when acl is on
  • Loading branch information
changluyi authored Nov 1, 2023
1 parent ce9975b commit 66f365c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ replace (
k8s.io/cri-api => k8s.io/cri-api v0.28.3
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.28.3
k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.28.3
k8s.io/endpointslice => k8s.io/endpointslice v0.28.3
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.28.3
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.28.3
k8s.io/kube-proxy => k8s.io/kube-proxy v0.28.3
Expand Down
4 changes: 2 additions & 2 deletions pkg/ovs/ovn-nb-acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func (c *OVNNbClient) CreateNodeACL(pgName, nodeIPStr, joinIPStr string) error {
}
pgAs := fmt.Sprintf("%s_%s", pgName, ipSuffix)

allowIngressACL, err := c.newACL(pgName, ovnnb.ACLDirectionToLport, util.NodeAllowPriority, fmt.Sprintf("%s.src == %s && %s.dst == $%s", ipSuffix, nodeIP, ipSuffix, pgAs), ovnnb.ACLActionAllowStateless)
allowIngressACL, err := c.newACL(pgName, ovnnb.ACLDirectionToLport, util.NodeAllowPriority, fmt.Sprintf("%s.src == %s && %s.dst == $%s", ipSuffix, nodeIP, ipSuffix, pgAs), ovnnb.ACLActionAllowRelated)
if err != nil {
klog.Error(err)
return fmt.Errorf("new allow ingress acl for port group %s: %v", pgName, err)
Expand All @@ -217,7 +217,7 @@ func (c *OVNNbClient) CreateNodeACL(pgName, nodeIPStr, joinIPStr string) error {
acl.Options["apply-after-lb"] = "true"
}

allowEgressACL, err := c.newACL(pgName, ovnnb.ACLDirectionFromLport, util.NodeAllowPriority, fmt.Sprintf("%s.dst == %s && %s.src == $%s", ipSuffix, nodeIP, ipSuffix, pgAs), ovnnb.ACLActionAllowStateless, options)
allowEgressACL, err := c.newACL(pgName, ovnnb.ACLDirectionFromLport, util.NodeAllowPriority, fmt.Sprintf("%s.dst == %s && %s.src == $%s", ipSuffix, nodeIP, ipSuffix, pgAs), ovnnb.ACLActionAllowRelated, options)
if err != nil {
klog.Error(err)
return fmt.Errorf("new allow egress acl for port group %s: %v", pgName, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/ovs/ovn-nb-acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ func (suite *OvnClientTestSuite) testCreateNodeACL() {
checkACL := func(pg *ovnnb.PortGroup, direction, priority, match string, options map[string]string) {
acl, err := ovnClient.GetACL(pg.Name, direction, priority, match, false)
require.NoError(t, err)
expect := newACL(pg.Name, direction, priority, match, ovnnb.ACLActionAllowStateless)
expect := newACL(pg.Name, direction, priority, match, ovnnb.ACLActionAllowRelated)
expect.UUID = acl.UUID
if len(options) != 0 {
expect.Options = options
Expand Down

0 comments on commit 66f365c

Please sign in to comment.