Allow managing ovs bridges separately

This change introduces capability to manage ovs bridges by external
manifests or external tooling, to allow more flexible configuration
which is not available by current interface in ovn::controller.

Change-Id: I7d9be48f99e4f66a08e5dc578cd734c2eaff7eb2
This commit is contained in:
Takashi Kajinami 2022-02-04 17:28:05 +09:00
parent 5c809de016
commit 4d13a3def4
3 changed files with 34 additions and 8 deletions

View File

@ -87,6 +87,10 @@
# monitor the records that is needed in the current chassis.
# Default to false (keep the original behavior)
#
# [*manage_ovs_bridge*]
# (optional) Create ovs bridges according to ovn_bridge_mappings.
# Defaults to true
#
class ovn::controller(
$ovn_remote,
$ovn_encap_ip,
@ -104,6 +108,7 @@ class ovn::controller(
$enable_ovn_match_northd = false,
$ovn_chassis_mac_map = [],
$ovn_monitor_all = false,
$manage_ovs_bridge = true
) {
include ovn::params
@ -168,13 +173,15 @@ class ovn::controller(
'external_ids:ovn-bridge-mappings' => { 'value' => join(any2array($ovn_bridge_mappings), ',') }
}
ovn::controller::bridge { $ovn_bridge_mappings:
before => Service['controller'],
require => Service['openvswitch']
}
ovn::controller::port { $bridge_interface_mappings:
before => Service['controller'],
require => Service['openvswitch']
if $manage_ovs_bridge {
ovn::controller::bridge { $ovn_bridge_mappings:
before => Service['controller'],
require => Service['openvswitch']
}
ovn::controller::port { $bridge_interface_mappings:
before => Service['controller'],
require => Service['openvswitch']
}
}
} else {
$bridge_items = {
@ -214,7 +221,7 @@ class ovn::controller(
$ovn_bridge_mappings.each |String $mappings| {
$mapping = split($mappings, ':')
$br = $mapping[1]
if !empty($br) {
if !empty($br) and $manage_ovs_bridge {
# TODO(numans): Right now puppet-vswitch's vs_bridge doesn't support
# setting the column 'other-config' for the Bridge table.
# Switch to using vs_bridge once the support is available.

View File

@ -0,0 +1,6 @@
---
features:
- |
The new ``ovn::controller::manage_ovs_bridge`` parameter has been added.
Setting this parameter to ``false``, the ``ovn::controller`` does not
manage ovs bridges and ports associated with bridges.

View File

@ -150,6 +150,19 @@ describe 'ovn::controller' do
)
end
end
context 'when manage_ovs_bridge is false' do
before :each do
params.merge!({
:manage_ovs_bridge => false,
})
end
it 'does not manage ovs bridge' do
is_expected.to_not contain_ovn__controller__bridge(params[:ovn_bridge_mappings].join(','))
is_expected.to_not contain_ovn__controller__port(params[:bridge_interface_mappings].join(','))
end
end
end
on_supported_os({