diff --git a/manifests/controller.pp b/manifests/controller.pp index ded64ce..43cbc47 100644 --- a/manifests/controller.pp +++ b/manifests/controller.pp @@ -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. diff --git a/releasenotes/notes/manage_ovs_bridge-a44d87218958e680.yaml b/releasenotes/notes/manage_ovs_bridge-a44d87218958e680.yaml new file mode 100644 index 0000000..1645048 --- /dev/null +++ b/releasenotes/notes/manage_ovs_bridge-a44d87218958e680.yaml @@ -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. diff --git a/spec/classes/ovn_controller_spec.rb b/spec/classes/ovn_controller_spec.rb index 6d10341..c249cfb 100644 --- a/spec/classes/ovn_controller_spec.rb +++ b/spec/classes/ovn_controller_spec.rb @@ -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({