Merge pull request #244 from bogdando/node_network_puppet
Node network puppet
This commit is contained in:
commit
4a3add5f3d
@ -57,8 +57,16 @@ def setup_resources():
|
|||||||
resources = vr.create('nodes', 'templates/nodes_with_transports.yaml', {"count": 2})
|
resources = vr.create('nodes', 'templates/nodes_with_transports.yaml', {"count": 2})
|
||||||
nodes = [x for x in resources if x.name.startswith('node')]
|
nodes = [x for x in resources if x.name.startswith('node')]
|
||||||
node1, node2 = nodes
|
node1, node2 = nodes
|
||||||
|
resources = vr.create('nodes_network', 'templates/nodes_network.yaml', {"count": 2})
|
||||||
|
nodes_sdn = [x for x in resources if x.name.startswith('node')]
|
||||||
|
node1_sdn, node2_sdn = nodes_sdn
|
||||||
|
|
||||||
|
|
||||||
|
# NETWORKING
|
||||||
|
# TODO(bogdando) node's IPs should be populated as br-mgmt IPs, but now are hardcoded in templates
|
||||||
|
signals.connect(node1, node1_sdn)
|
||||||
|
signals.connect(node2, node2_sdn)
|
||||||
|
|
||||||
# MARIADB
|
# MARIADB
|
||||||
mariadb_service1 = vr.create('mariadb_service1', 'resources/mariadb_service', {
|
mariadb_service1 = vr.create('mariadb_service1', 'resources/mariadb_service', {
|
||||||
'image': 'mariadb',
|
'image': 'mariadb',
|
||||||
@ -617,6 +625,8 @@ def setup_resources():
|
|||||||
|
|
||||||
|
|
||||||
resources_to_run = [
|
resources_to_run = [
|
||||||
|
'node1_sdn',
|
||||||
|
|
||||||
'rabbitmq_service1',
|
'rabbitmq_service1',
|
||||||
'openstack_vhost',
|
'openstack_vhost',
|
||||||
'openstack_rabbitmq_user',
|
'openstack_rabbitmq_user',
|
||||||
@ -669,6 +679,8 @@ resources_to_run = [
|
|||||||
'nova_conductor_puppet',
|
'nova_conductor_puppet',
|
||||||
'nova_scheduler_puppet',
|
'nova_scheduler_puppet',
|
||||||
|
|
||||||
|
'node2_sdn',
|
||||||
|
|
||||||
'glance_db',
|
'glance_db',
|
||||||
'glance_db_user',
|
'glance_db_user',
|
||||||
'glance_keystone_user',
|
'glance_keystone_user',
|
||||||
|
9
resources/node_network_puppet/README.md
Normal file
9
resources/node_network_puppet/README.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Node network resource for puppet handler
|
||||||
|
|
||||||
|
Setup and configure L23 networking for a node.
|
||||||
|
Leverages the powerful network_scheme structures to
|
||||||
|
create all required networking entities like interfaces,
|
||||||
|
bridges, bonds - both linux and ovs based.
|
||||||
|
Defaults are given for Debian OS family.
|
||||||
|
|
||||||
|
source https://github.com/xenolog/l23network
|
3
resources/node_network_puppet/actions/remove.pp
Normal file
3
resources/node_network_puppet/actions/remove.pp
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
class {'l23network':
|
||||||
|
ensure_package => 'absent',
|
||||||
|
}
|
41
resources/node_network_puppet/actions/run.pp
Normal file
41
resources/node_network_puppet/actions/run.pp
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
$resource = hiera($::resource_name)
|
||||||
|
|
||||||
|
$ensure_package = $resource['input']['ensure_package']['value']
|
||||||
|
$use_lnx = $resource['input']['use_lnx']['value']
|
||||||
|
$use_ovs = $resource['input']['use_ovs']['value']
|
||||||
|
$install_ovs = $resource['input']['install_ovs']['value']
|
||||||
|
$install_brtool = $resource['input']['install_brtool']['value']
|
||||||
|
$install_ethtool = $resource['input']['install_ethtool']['value']
|
||||||
|
$install_bondtool = $resource['input']['install_bondtool']['value']
|
||||||
|
$install_vlantool = $resource['input']['install_vlantool']['value']
|
||||||
|
$ovs_modname = $resource['input']['ovs_modname']['value']
|
||||||
|
$ovs_datapath_package_name = $resource['input']['ovs_datapath_package_name']['value']
|
||||||
|
$ovs_common_package_name = $resource['input']['ovs_common_package_name']['value']
|
||||||
|
$network_scheme = $resource['input']['network_scheme']['value']
|
||||||
|
|
||||||
|
class {'l23network':
|
||||||
|
ensure_package => $ensure_package,
|
||||||
|
use_lnx => $use_lnx,
|
||||||
|
use_ovs => $use_ovs,
|
||||||
|
install_ovs => $install_ovs,
|
||||||
|
install_brtool => $install_brtool,
|
||||||
|
install_ethtool => $install_ethtool,
|
||||||
|
install_bondtool => $install_bondtool,
|
||||||
|
install_vlantool => $install_vlantool,
|
||||||
|
ovs_modname => $ovs_modname,
|
||||||
|
ovs_datapath_package_name => $ovs_datapath_package_name,
|
||||||
|
ovs_common_package_name => $ovs_common_package_name,
|
||||||
|
}
|
||||||
|
|
||||||
|
prepare_network_config($network_scheme)
|
||||||
|
$sdn = generate_network_config()
|
||||||
|
notify { $sdn: require => Class['l23network'], }
|
||||||
|
|
||||||
|
# We need to wait at least 30 seconds for the bridges and other interfaces to
|
||||||
|
# come up after being created. This should allow for all interfaces to be up
|
||||||
|
# and ready for traffic before proceeding with further deploy steps. LP#1458954
|
||||||
|
exec { 'wait-for-interfaces':
|
||||||
|
path => '/usr/bin:/bin',
|
||||||
|
command => 'sleep 32',
|
||||||
|
require => Notify[$sdn]
|
||||||
|
}
|
60
resources/node_network_puppet/meta.yaml
Normal file
60
resources/node_network_puppet/meta.yaml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
id: node_network_puppet
|
||||||
|
handler: puppet
|
||||||
|
puppet_module: l23network
|
||||||
|
version: 1.0.0
|
||||||
|
input:
|
||||||
|
package_ensure:
|
||||||
|
schema: str
|
||||||
|
value: 'present'
|
||||||
|
ensure_package:
|
||||||
|
schema: str
|
||||||
|
value: 'present'
|
||||||
|
use_lnx:
|
||||||
|
schema: bool
|
||||||
|
value: true
|
||||||
|
use_ovs:
|
||||||
|
schema: bool
|
||||||
|
value: false
|
||||||
|
install_ovs:
|
||||||
|
schema: bool
|
||||||
|
value: true
|
||||||
|
install_brtool:
|
||||||
|
schema: bool
|
||||||
|
value: true
|
||||||
|
install_ethtool:
|
||||||
|
schema: bool
|
||||||
|
value: true
|
||||||
|
install_bondtool:
|
||||||
|
schema: bool
|
||||||
|
value: true
|
||||||
|
install_vlantool:
|
||||||
|
schema: bool
|
||||||
|
value: true
|
||||||
|
ovs_modname:
|
||||||
|
schema: str
|
||||||
|
value: 'openvswitch'
|
||||||
|
ovs_datapath_package_name:
|
||||||
|
schema: str
|
||||||
|
value: 'openvswitch-datapath-dkms'
|
||||||
|
ovs_common_package_name:
|
||||||
|
schema: str
|
||||||
|
value: 'openvswitch-switch'
|
||||||
|
network_scheme:
|
||||||
|
schema: {
|
||||||
|
version: str!,
|
||||||
|
provider: str!,
|
||||||
|
interfaces: {},
|
||||||
|
transformations: [{}],
|
||||||
|
endpoints: {},
|
||||||
|
roles: {},
|
||||||
|
}
|
||||||
|
|
||||||
|
git:
|
||||||
|
schema: {repository: str!, branch: str!}
|
||||||
|
value: {repository: 'https://github.com/xenolog/l23network', branch: '50098cfa1f0f8e8d58e6a6b77a22f1380aa5c426'}
|
||||||
|
|
||||||
|
ip:
|
||||||
|
schema: str!
|
||||||
|
value:
|
||||||
|
|
||||||
|
tags: [resources/node_network]
|
11
resources/node_network_puppet/test.py
Normal file
11
resources/node_network_puppet/test.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import requests
|
||||||
|
|
||||||
|
from solar.core.log import log
|
||||||
|
|
||||||
|
|
||||||
|
def test(resource):
|
||||||
|
log.debug('Testing node_network_puppet')
|
||||||
|
# requests.get(
|
||||||
|
# 'http://%s:%s' % (resource.args['ip'].value, resource.args['port'].value)
|
||||||
|
# TODO(bogdando) figure out how to test this
|
||||||
|
# )
|
134
templates/nodes_network.yaml
Normal file
134
templates/nodes_network.yaml
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
id: simple_multinode_gre
|
||||||
|
# eth2 - private 10.1.0.0/24 with JUMBO frames,
|
||||||
|
# eth1 - mgmt 10.0.0.0/24,
|
||||||
|
# eth3 - ext 10.2.0.0/24
|
||||||
|
resources:
|
||||||
|
- id: node1_sdn
|
||||||
|
from: resources/node_network_puppet
|
||||||
|
values:
|
||||||
|
use_ovs: true
|
||||||
|
network_scheme:
|
||||||
|
version: '1.1'
|
||||||
|
provider: lnx
|
||||||
|
interfaces:
|
||||||
|
eth3:
|
||||||
|
mtu: 1500
|
||||||
|
eth1:
|
||||||
|
mtu: 1500
|
||||||
|
eth2:
|
||||||
|
mtu: 9000
|
||||||
|
transformations:
|
||||||
|
- action: add-br
|
||||||
|
name: br-mgmt
|
||||||
|
- action: add-br
|
||||||
|
name: br-ex
|
||||||
|
- action: add-br
|
||||||
|
name: br-floating
|
||||||
|
provider: ovs
|
||||||
|
- action: add-patch
|
||||||
|
bridges:
|
||||||
|
- br-floating
|
||||||
|
- br-ex
|
||||||
|
provider: ovs
|
||||||
|
mtu: 65000
|
||||||
|
- action: add-br
|
||||||
|
name: br-mesh
|
||||||
|
- action: add-port
|
||||||
|
bridge: br-ex
|
||||||
|
name: eth3
|
||||||
|
- action: add-port
|
||||||
|
bridge: br-mgmt
|
||||||
|
name: eth1
|
||||||
|
- action: add-port
|
||||||
|
bridge: br-mesh
|
||||||
|
name: eth2
|
||||||
|
endpoints:
|
||||||
|
br-mesh:
|
||||||
|
IP:
|
||||||
|
- 10.1.0.3/24
|
||||||
|
br-floating:
|
||||||
|
IP: none
|
||||||
|
br-mgmt:
|
||||||
|
IP:
|
||||||
|
- 10.0.0.3/24
|
||||||
|
vendor_specific:
|
||||||
|
phy_interfaces:
|
||||||
|
- eth1
|
||||||
|
br-ex:
|
||||||
|
IP:
|
||||||
|
- 10.2.0.3/24
|
||||||
|
vendor_specific:
|
||||||
|
phy_interfaces:
|
||||||
|
- eth3
|
||||||
|
#gateway: 10.2.0.1
|
||||||
|
roles:
|
||||||
|
management: br-mgmt
|
||||||
|
neutron/mesh: br-mesh
|
||||||
|
ex: br-ex
|
||||||
|
neutron/floating: br-floating
|
||||||
|
fw-admin: br-fw-admin
|
||||||
|
|
||||||
|
- id: node2_sdn
|
||||||
|
from: resources/node_network_puppet
|
||||||
|
values:
|
||||||
|
use_ovs: true
|
||||||
|
network_scheme:
|
||||||
|
version: '1.1'
|
||||||
|
provider: lnx
|
||||||
|
interfaces:
|
||||||
|
eth3:
|
||||||
|
mtu: 1500
|
||||||
|
eth1:
|
||||||
|
mtu: 1500
|
||||||
|
eth2:
|
||||||
|
mtu: 9000
|
||||||
|
transformations:
|
||||||
|
- action: add-br
|
||||||
|
name: br-mgmt
|
||||||
|
- action: add-br
|
||||||
|
name: br-ex
|
||||||
|
- action: add-br
|
||||||
|
name: br-floating
|
||||||
|
provider: ovs
|
||||||
|
- action: add-patch
|
||||||
|
bridges:
|
||||||
|
- br-floating
|
||||||
|
- br-ex
|
||||||
|
provider: ovs
|
||||||
|
mtu: 65000
|
||||||
|
- action: add-br
|
||||||
|
name: br-mesh
|
||||||
|
- action: add-port
|
||||||
|
bridge: br-ex
|
||||||
|
name: eth3
|
||||||
|
- action: add-port
|
||||||
|
bridge: br-mgmt
|
||||||
|
name: eth1
|
||||||
|
- action: add-port
|
||||||
|
bridge: br-mesh
|
||||||
|
name: eth2
|
||||||
|
endpoints:
|
||||||
|
br-mesh:
|
||||||
|
IP:
|
||||||
|
- 10.1.0.4/24
|
||||||
|
br-floating:
|
||||||
|
IP: none
|
||||||
|
br-mgmt:
|
||||||
|
IP:
|
||||||
|
- 10.0.0.4/24
|
||||||
|
vendor_specific:
|
||||||
|
phy_interfaces:
|
||||||
|
- eth1
|
||||||
|
br-ex:
|
||||||
|
IP:
|
||||||
|
- 10.2.0.4/24
|
||||||
|
vendor_specific:
|
||||||
|
phy_interfaces:
|
||||||
|
- eth3
|
||||||
|
#gateway: 10.2.0.1
|
||||||
|
roles:
|
||||||
|
management: br-mgmt
|
||||||
|
neutron/mesh: br-mesh
|
||||||
|
ex: br-ex
|
||||||
|
neutron/floating: br-floating
|
||||||
|
fw-admin: br-fw-admin
|
Loading…
x
Reference in New Issue
Block a user