Skip to content

Commit

Permalink
Merge pull request #2247 from M1cha/l2-bridge
Browse files Browse the repository at this point in the history
libnetwork: support `mode` option for bridge
  • Loading branch information
openshift-merge-bot[bot] authored Nov 25, 2024
2 parents ceceb40 + 9954a5c commit a801fac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libnetwork/netavark/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ func (n *netavarkNetwork) networkCreate(newNetwork *types.Network, defaultNet bo
if len(value) == 0 {
return nil, errors.New("invalid vrf name")
}
case types.ModeOption:
if !slices.Contains(types.ValidBridgeModes, value) {
return nil, fmt.Errorf("unknown bridge mode %q", value)
}
default:
return nil, fmt.Errorf("unsupported bridge network option %s", key)
}
Expand Down
6 changes: 6 additions & 0 deletions libnetwork/types/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ const (
// DefaultSubnet is the subnet that will be used for the default CNI network.
DefaultSubnet = "10.88.0.0/16"

BridgeModeManaged = "managed"
BridgeModeUnmanaged = "unmanaged"

// valid macvlan driver mode values
MacVLANModeBridge = "bridge"
MacVLANModePrivate = "private"
Expand Down Expand Up @@ -53,6 +56,9 @@ const (
Netavark NetworkBackend = "netavark"
)

// ValidBridgeModes is the list of valid mode options for the bridge driver
var ValidBridgeModes = []string{BridgeModeManaged, BridgeModeUnmanaged}

// ValidMacVLANModes is the list of valid mode options for the macvlan driver
var ValidMacVLANModes = []string{MacVLANModeBridge, MacVLANModePrivate, MacVLANModeVepa, MacVLANModePassthru}

Expand Down

0 comments on commit a801fac

Please sign in to comment.