Implement bridge_device for bridged VNIs

Required due to #64. Bridged networks were being created on top of a
vLAN if the Cluster network was a vLAN device, rather than being created
on the underlying device. This came from a previous revision of the
cluster architecture guidelines where Cluster was supposed to be a raw
device rather than a vLAN. This fixed the problem by implementing a
configuration field for a "bridge_device", a NIC device that can then
have the bridged vLANs created on top of it.

Fixes #64
This commit is contained in:
Joshua Boniface 2020-01-06 14:44:56 -05:00
parent 17b6af3ee6
commit 7b3e267f7a
3 changed files with 8 additions and 3 deletions

View File

@ -153,6 +153,8 @@ pvc:
# networking: PVC networking configuration # networking: PVC networking configuration
# OPTIONAL if enable_networking: False # OPTIONAL if enable_networking: False
networking: networking:
# bridge_device: Underlying device to use for bridged vLAN networks; usually the device underlying <cluster>
bridge_device: ens4
# upstream: Upstream physical interface device # upstream: Upstream physical interface device
upstream: upstream:
# device: Upstream interface device name # device: Upstream interface device name

View File

@ -200,6 +200,7 @@ def readConfig(pvcd_config_file, myhostname):
'metadata_postgresql_dbname': o_config['pvc']['coordinator']['metadata']['database']['name'], 'metadata_postgresql_dbname': o_config['pvc']['coordinator']['metadata']['database']['name'],
'metadata_postgresql_user': o_config['pvc']['coordinator']['metadata']['database']['user'], 'metadata_postgresql_user': o_config['pvc']['coordinator']['metadata']['database']['user'],
'metadata_postgresql_password': o_config['pvc']['coordinator']['metadata']['database']['pass'], 'metadata_postgresql_password': o_config['pvc']['coordinator']['metadata']['database']['pass'],
'bridge_dev': o_config['pvc']['system']['configuration']['networking']['bridge_device'],
'vni_dev': o_config['pvc']['system']['configuration']['networking']['cluster']['device'], 'vni_dev': o_config['pvc']['system']['configuration']['networking']['cluster']['device'],
'vni_mtu': o_config['pvc']['system']['configuration']['networking']['cluster']['mtu'], 'vni_mtu': o_config['pvc']['system']['configuration']['networking']['cluster']['mtu'],
'vni_dev_ip': o_config['pvc']['system']['configuration']['networking']['cluster']['address'], 'vni_dev_ip': o_config['pvc']['system']['configuration']['networking']['cluster']['address'],

View File

@ -40,6 +40,7 @@ class VXNetworkInstance(object):
self.dns_aggregator = dns_aggregator self.dns_aggregator = dns_aggregator
self.vni_dev = config['vni_dev'] self.vni_dev = config['vni_dev']
self.vni_mtu = config['vni_mtu'] self.vni_mtu = config['vni_mtu']
self.bridge_dev = config['bridge_dev']
self.nettype = zkhandler.readdata(self.zk_conn, '/networks/{}/nettype'.format(self.vni)) self.nettype = zkhandler.readdata(self.zk_conn, '/networks/{}/nettype'.format(self.vni))
if self.nettype == 'bridged': if self.nettype == 'bridged':
@ -465,8 +466,9 @@ add rule inet filter forward ip6 saddr {netaddr6} counter jump {vxlannic}-out
# Create bridged network configuration # Create bridged network configuration
def createNetworkBridged(self): def createNetworkBridged(self):
self.logger.out( self.logger.out(
'Creating VLAN device on interface {}'.format( 'Creating bridged vLAN device {} on interface {}'.format(
self.vni_dev self.vlan_nic,
self.bridge_dev
), ),
prefix='VNI {}'.format(self.vni), prefix='VNI {}'.format(self.vni),
state='o' state='o'
@ -475,7 +477,7 @@ add rule inet filter forward ip6 saddr {netaddr6} counter jump {vxlannic}-out
# Create vLAN interface # Create vLAN interface
common.run_os_command( common.run_os_command(
'ip link add link {} name {} type vlan id {}'.format( 'ip link add link {} name {} type vlan id {}'.format(
self.vni_dev, self.bridge_dev,
self.vlan_nic, self.vlan_nic,
self.vni self.vni
) )