Skip to content

Commit b09dee2

Browse files
committed
CARRY: Advertised UDN networks isolation configurable
The ovnk by default isolates advertised UDN networks isolated from each other, but there is a requirement to disable isolation so that BGP routing functionality can be tested between different UDN networks. Hence this commit consumes the UDN_ISOLATION_MODE env variable and isolation can be determined accordingly. By default it uses secure mode to isolate the networks and it can be overridden by CNO via config map. Signed-off-by: Periyasamy Palanisamy <[email protected]>
1 parent eb7acc0 commit b09dee2

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

go-controller/pkg/ovn/udn_isolation.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@ func BuildAdvertisedNetworkSubnetsDropACL(advertisedNetworkSubnetsAddressSet add
300300
// pass "(ip[4|6].src == <UDN_SUBNET> && ip[4|6].dst == <UDN_SUBNET>)" 1100
301301
// drop "(ip[4|6].src == $<ALL_ADV_SUBNETS> && ip[4|6].dst == $<ALL_ADV_SUBNETS>)" 1050
302302
func (bnc *BaseNetworkController) addAdvertisedNetworkIsolation(nodeName string) error {
303+
if util.IsLooseUDNIsolation() {
304+
klog.Infof("The network %s is configured with loose isolation mode, skip adding tier-0 drop ACL rule",
305+
bnc.GetNetworkName())
306+
return nil
307+
}
303308
var passMatches, cidrs []string
304309
var ops []ovsdb.Operation
305310

@@ -363,6 +368,11 @@ func (bnc *BaseNetworkController) addAdvertisedNetworkIsolation(nodeName string)
363368
// deleteAdvertisedNetworkIsolation deletes advertised network isolation rules from the given node switch.
364369
// It removes the network CIDRs from the global advertised networks addresset together with the ACLs on the node switch.
365370
func (bnc *BaseNetworkController) deleteAdvertisedNetworkIsolation(nodeName string) error {
371+
if util.IsLooseUDNIsolation() {
372+
klog.Infof("The network %s is configured with loose isolation mode, skip deleting tier-0 drop ACL rule",
373+
bnc.GetNetworkName())
374+
return nil
375+
}
366376
addrSet, err := bnc.addressSetFactory.GetAddressSet(GetAdvertisedNetworkSubnetsAddressSetDBIDs())
367377
if err != nil {
368378
return fmt.Errorf("failed to get advertised subnets addresset %s for network %s: %w", GetAdvertisedNetworkSubnetsAddressSetDBIDs(), bnc.GetNetworkName(), err)

go-controller/pkg/util/multi_network.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"errors"
55
"fmt"
66
"net"
7+
"os"
78
"reflect"
89
"strconv"
910
"strings"
@@ -28,6 +29,13 @@ var (
2829
ErrorUnsupportedIPAMKey = errors.New("IPAM key is not supported. Use OVN-K provided IPAM via the `subnets` attribute")
2930
)
3031

32+
var (
33+
// UDNLooseIsolation allows communication between two advertised UDN networks.
34+
UDNLooseIsolation string = "loose"
35+
// UDNLooseIsolation drops communication between two advertised UDN networks.
36+
UDNSecureIsolation string = "secure"
37+
)
38+
3139
// NetInfo exposes read-only information about a network.
3240
type NetInfo interface {
3341
// static information, not expected to change.
@@ -1554,3 +1562,10 @@ func ParseNetworkName(networkName string) (udnNamespace, udnName string) {
15541562
}
15551563
return "", ""
15561564
}
1565+
1566+
// IsLooseUDNIsolation returns true if two UDN networks are not configured to be
1567+
// isolated each other when both networks advertising their pod IPs using BGP over
1568+
// default VRF, otherwise returns false.
1569+
func IsLooseUDNIsolation() bool {
1570+
return os.Getenv("UDN_ISOLATION_MODE") == UDNLooseIsolation
1571+
}

0 commit comments

Comments
 (0)