Skip to content

Commit b797696

Browse files
committed
advertised network isolation: rename accept acl to pass acl
no functional changes Signed-off-by: Patryk Diak <[email protected]>
1 parent 62738cc commit b797696

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

go-controller/pkg/ovn/base_network_controller.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ func GetAdvertisedNetworkSubnetsDropACLdbIDs() *libovsdbops.DbObjectIDs {
12031203
})
12041204
}
12051205

1206-
func GetAdvertisedNetworkSubnetsAcceptACLdbIDs(networkName string) *libovsdbops.DbObjectIDs {
1206+
func GetAdvertisedNetworkSubnetsPassACLdbIDs(networkName string) *libovsdbops.DbObjectIDs {
12071207
return libovsdbops.NewDbObjectIDs(libovsdbops.ACLAdvertisedNetwork, advertisedNetworkIsolationACLID,
12081208
map[libovsdbops.ExternalIDKey]string{
12091209
libovsdbops.ObjectNameKey: networkName,
@@ -1232,7 +1232,7 @@ func BuildAdvertisedNetworkSubnetsDropACL(advertisedNetworkSubnetsAddressSet add
12321232
}
12331233

12341234
func (bnc *BaseNetworkController) addAdvertisedNetworkIsolation(nodeName string) error {
1235-
var acceptMatches, cidrs []string
1235+
var passMatches, cidrs []string
12361236
var ops []ovsdb.Operation
12371237

12381238
addrSet, err := bnc.addressSetFactory.GetAddressSet(GetAdvertisedNetworkSubnetsAddressSetDBIDs())
@@ -1245,7 +1245,7 @@ func (bnc *BaseNetworkController) addAdvertisedNetworkIsolation(nodeName string)
12451245
if utilnet.IsIPv6CIDR(subnet.CIDR) {
12461246
ipPrefix = "ip6"
12471247
}
1248-
acceptMatches = append(acceptMatches, fmt.Sprintf("(%s.src == %s && %s.dst == %s)", ipPrefix, subnet.CIDR, ipPrefix, subnet.CIDR))
1248+
passMatches = append(passMatches, fmt.Sprintf("(%s.src == %s && %s.dst == %s)", ipPrefix, subnet.CIDR, ipPrefix, subnet.CIDR))
12491249
cidrs = append(cidrs, subnet.CIDR.String())
12501250

12511251
}
@@ -1256,23 +1256,23 @@ func (bnc *BaseNetworkController) addAdvertisedNetworkIsolation(nodeName string)
12561256
}
12571257
ops = append(ops, addrOps...)
12581258

1259-
if len(acceptMatches) > 0 {
1260-
acceptACL := libovsdbutil.BuildACL(
1261-
GetAdvertisedNetworkSubnetsAcceptACLdbIDs(bnc.GetNetworkName()),
1262-
types.AdvertisedNetworkAllowPriority,
1263-
strings.Join(acceptMatches, " || "),
1259+
if len(passMatches) > 0 {
1260+
passACL := libovsdbutil.BuildACL(
1261+
GetAdvertisedNetworkSubnetsPassACLdbIDs(bnc.GetNetworkName()),
1262+
types.AdvertisedNetworkPassPriority,
1263+
strings.Join(passMatches, " || "),
12641264
nbdb.ACLActionPass,
12651265
nil,
12661266
libovsdbutil.LportEgress)
1267-
acceptACL.Tier = types.PrimaryACLTier
1267+
passACL.Tier = types.PrimaryACLTier
12681268

1269-
ops, err = libovsdbops.CreateOrUpdateACLsOps(bnc.nbClient, ops, nil, acceptACL)
1269+
ops, err = libovsdbops.CreateOrUpdateACLsOps(bnc.nbClient, ops, nil, passACL)
12701270
if err != nil {
1271-
return fmt.Errorf("failed to create or update network isolation accept ACL %s for network %s: %w", GetAdvertisedNetworkSubnetsAcceptACLdbIDs(bnc.GetNetworkName()), bnc.GetNetworkName(), err)
1271+
return fmt.Errorf("failed to create or update network isolation pass ACL %s for network %s: %w", GetAdvertisedNetworkSubnetsPassACLdbIDs(bnc.GetNetworkName()), bnc.GetNetworkName(), err)
12721272
}
1273-
ops, err = libovsdbops.AddACLsToLogicalSwitchOps(bnc.nbClient, ops, bnc.GetNetworkScopedSwitchName(nodeName), acceptACL)
1273+
ops, err = libovsdbops.AddACLsToLogicalSwitchOps(bnc.nbClient, ops, bnc.GetNetworkScopedSwitchName(nodeName), passACL)
12741274
if err != nil {
1275-
return fmt.Errorf("failed to add network isolation accept ACL to switch %s for network %s: %w", bnc.GetNetworkScopedSwitchName(nodeName), bnc.GetNetworkName(), err)
1275+
return fmt.Errorf("failed to add network isolation pass ACL to switch %s for network %s: %w", bnc.GetNetworkScopedSwitchName(nodeName), bnc.GetNetworkName(), err)
12761276
}
12771277
}
12781278

@@ -1307,11 +1307,11 @@ func (bnc *BaseNetworkController) deleteAdvertisedNetworkIsolation(nodeName stri
13071307
return err
13081308
}
13091309

1310-
acceptACLIDs := GetAdvertisedNetworkSubnetsAcceptACLdbIDs(bnc.GetNetworkName())
1311-
acceptACLPredicate := libovsdbops.GetPredicate[*nbdb.ACL](acceptACLIDs, nil)
1312-
acceptACLs, err := libovsdbops.FindACLsWithPredicate(bnc.nbClient, acceptACLPredicate)
1310+
passACLIDs := GetAdvertisedNetworkSubnetsPassACLdbIDs(bnc.GetNetworkName())
1311+
passACLPredicate := libovsdbops.GetPredicate[*nbdb.ACL](passACLIDs, nil)
1312+
passACLs, err := libovsdbops.FindACLsWithPredicate(bnc.nbClient, passACLPredicate)
13131313
if err != nil {
1314-
return fmt.Errorf("unable to find the allow ACL for advertised network %s: %w", bnc.GetNetworkName(), err)
1314+
return fmt.Errorf("unable to find the pass ACL for advertised network %s: %w", bnc.GetNetworkName(), err)
13151315
}
13161316

13171317
dropACLIDs := GetAdvertisedNetworkSubnetsDropACLdbIDs()
@@ -1323,7 +1323,7 @@ func (bnc *BaseNetworkController) deleteAdvertisedNetworkIsolation(nodeName stri
13231323

13241324
// ACLs referenced by the switch will be deleted by db if there are no other references
13251325
p := func(sw *nbdb.LogicalSwitch) bool { return sw.Name == bnc.GetNetworkScopedSwitchName(nodeName) }
1326-
err = libovsdbops.RemoveACLsFromLogicalSwitchesWithPredicate(bnc.nbClient, p, append(acceptACLs, dropACLs...)...)
1326+
err = libovsdbops.RemoveACLsFromLogicalSwitchesWithPredicate(bnc.nbClient, p, append(passACLs, dropACLs...)...)
13271327
if err != nil {
13281328
return fmt.Errorf("failed to remove network isolation ACLs from the %s switch for network %s: %w", bnc.GetNetworkScopedSwitchName(nodeName), bnc.GetNetworkName(), err)
13291329
}

go-controller/pkg/ovn/gateway_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,28 @@ func init() {
3434
}
3535

3636
func generateAdvertisedUDNIsolationExpectedNB(testData []libovsdbtest.TestData, networkName string, clusterIPSubnets []*net.IPNet, nodeSwitch *nbdb.LogicalSwitch, addrSet addressset.AddressSet) []libovsdbtest.TestData {
37-
var acceptMatches []string
37+
var passMatches []string
3838
for _, subnet := range clusterIPSubnets {
3939
ipPrefix := "ip4"
4040
if utilnet.IsIPv6CIDR(subnet) {
4141
ipPrefix = "ip6"
4242
}
43-
acceptMatches = append(acceptMatches, fmt.Sprintf("(%s.src == %s && %s.dst == %s)", ipPrefix, subnet, ipPrefix, subnet))
43+
passMatches = append(passMatches, fmt.Sprintf("(%s.src == %s && %s.dst == %s)", ipPrefix, subnet, ipPrefix, subnet))
4444

4545
}
46-
acceptACL := libovsdbutil.BuildACL(
47-
GetAdvertisedNetworkSubnetsAcceptACLdbIDs(networkName),
48-
types.AdvertisedNetworkAllowPriority,
49-
strings.Join(acceptMatches, " || "),
46+
passACL := libovsdbutil.BuildACL(
47+
GetAdvertisedNetworkSubnetsPassACLdbIDs(networkName),
48+
types.AdvertisedNetworkPassPriority,
49+
strings.Join(passMatches, " || "),
5050
nbdb.ACLActionPass,
5151
nil,
5252
libovsdbutil.LportEgress)
53-
acceptACL.Tier = types.PrimaryACLTier
54-
acceptACL.UUID = "advertised-udn-isolation-accept-acl-UUID"
53+
passACL.Tier = types.PrimaryACLTier
54+
passACL.UUID = "advertised-udn-isolation-pass-acl-UUID"
5555
dropACL := BuildAdvertisedNetworkSubnetsDropACL(addrSet)
5656
dropACL.UUID = "advertised-udn-isolation-drop-acl-UUID"
57-
nodeSwitch.ACLs = append(nodeSwitch.ACLs, acceptACL.UUID, dropACL.UUID)
58-
testData = append(testData, acceptACL, dropACL)
57+
nodeSwitch.ACLs = append(nodeSwitch.ACLs, passACL.UUID, dropACL.UUID)
58+
testData = append(testData, passACL, dropACL)
5959

6060
return testData
6161
}

go-controller/pkg/types/const.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ const (
8686
DefaultAllowPriority = 1001
8787
// Default deny acl rule priority
8888
DefaultDenyPriority = 1000
89-
// Allow priority for isolated advertised networks
90-
AdvertisedNetworkAllowPriority = 1100
89+
// Pass priority for isolated advertised networks
90+
AdvertisedNetworkPassPriority = 1100
9191
// Deny priority for isolated advertised networks
9292
AdvertisedNetworkDenyPriority = 1050
9393

0 commit comments

Comments
 (0)