Merge "Add ability to define bridge type for containers"

This commit is contained in:
Zuul 2022-06-13 10:09:40 +00:00 committed by Gerrit Code Review
commit 411b701681
4 changed files with 26 additions and 13 deletions

View File

@ -26,20 +26,21 @@ the same multiport network card for the same bonded interface, because a
network card failure affects both of the physical network interfaces used by
the bond.
Linux bridges
~~~~~~~~~~~~~
Linux bridges/switches
~~~~~~~~~~~~~~~~~~~~~~
The combination of containers and flexible deployment options requires
implementation of advanced Linux networking features, such as bridges and
namespaces.
implementation of advanced Linux networking features, such as bridges,
switches and namespaces.
* Bridges provide layer 2 connectivity (similar to switches) among
* Bridges/switches provide layer 2 connectivity (similar to switches) among
physical, logical, and virtual network interfaces within a host. After
a bridge is created, the network interfaces are virtually plugged in to
it.
a bridge/switch is created, the network interfaces are virtually plugged
in to it.
OpenStack-Ansible uses bridges to connect physical and logical network
interfaces on the host to virtual network interfaces within containers.
OpenStack-Ansible can use linux bridges or openvswitches to connect
physical and logical network interfaces on the host to virtual network
interfaces within containers.
* Namespaces provide logically separate layer 3 environments (similar to
routers) within a host. Namespaces use virtual interfaces to connect

View File

@ -48,6 +48,7 @@ network:
interfaces:
- bond0.20
mtu: 9000
openvswitch: {}
br-vxlan:
addresses:
- 172.29.240.10/22

View File

@ -138,6 +138,11 @@
# Name of unique bridge on target hosts to use for this network. Typical
# values include 'br-mgmt', 'br-storage', 'br-vlan', 'br-vxlan', etc.
#
# Option: container_bridge_type (optional, string)
# Type of container_bridge on target hosts. This option should only set
# to "openvswitch" when the container_bridge is set up with openvswitch.
# The default value is undefined, which means bridge type is linux bridge.
#
# Option: container_interface (required, string)
# Name of unique interface in containers to use for this network.
# Typical values include 'eth1', 'eth2', etc. This option is OPTIONAL

View File

@ -527,7 +527,7 @@ def skel_load(skeleton, inventory):
def network_entry(is_metal, interface,
bridge=None, net_type=None, net_mtu=None):
bridge=None, bridge_type=None, net_type=None, net_mtu=None):
"""Return a network entry for a container."""
# TODO(cloudnull) After a few releases this conditional should be
@ -542,6 +542,9 @@ def network_entry(is_metal, interface,
if bridge:
_network['bridge'] = bridge
if bridge_type:
_network['bridge_type'] = bridge_type
if net_type:
_network['type'] = net_type
@ -552,9 +555,9 @@ def network_entry(is_metal, interface,
def _add_additional_networks(key, inventory, ip_q, q_name, netmask, interface,
bridge, net_type, net_mtu, user_config,
is_container_address, static_routes, gateway,
reference_group, address_prefix):
bridge, bridge_type, net_type, net_mtu,
user_config, is_container_address, static_routes,
gateway, reference_group, address_prefix):
"""Process additional ip adds and append then to hosts as needed.
If the host is found to be "is_metal" it will be marked as "on_metal"
@ -588,6 +591,7 @@ def _add_additional_networks(key, inventory, ip_q, q_name, netmask, interface,
netmask,
interface,
bridge,
bridge_type,
net_type,
net_mtu,
user_config,
@ -640,6 +644,7 @@ def _add_additional_networks(key, inventory, ip_q, q_name, netmask, interface,
is_metal,
interface,
bridge,
bridge_type,
net_type,
net_mtu
)
@ -766,6 +771,7 @@ def container_skel_load(container_skel, inventory, config):
netmask=netmask,
interface=p_net.get('container_interface'),
bridge=p_net.get('container_bridge'),
bridge_type=p_net.get('container_bridge_type'),
net_type=p_net.get('container_type'),
net_mtu=p_net.get('container_mtu'),
user_config=config,