Split deployment on compute role

Change-Id: I6a9b881016a51444a114a56dbb4d9edd3062b59e
This commit is contained in:
Vitalii Kovalchuk 2016-02-19 11:58:31 +02:00 committed by Illia Polliul
parent 307b841265
commit 702c99c96c
13 changed files with 178 additions and 61 deletions

View File

@ -1,4 +1,4 @@
# Copyright 2015 Mirantis, Inc.
# Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -12,17 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
notice('MODULAR: contrail/compute-config.pp')
notice('MODULAR: contrail/contrail-compute-firewall.pp')
$node_role = 'compute'
include contrail
class { 'contrail::provision_compute': } ->
class { 'contrail::network':
node_role => $node_role,
address => $contrail::address,
ifname => $contrail::phys_dev,
netmask => $contrail::netmask_short,
} ->
class { 'contrail::compute': } ->
class { 'contrail::vrouter': }
class { 'contrail::compute::firewall': }

View File

@ -0,0 +1,18 @@
# Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
notice('MODULAR: contrail/contrail-compute-network.pp')
include contrail
class { 'contrail::compute::network': }

View File

@ -0,0 +1,18 @@
# Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
notice('MODULAR: contrail/contrail-compute-nova.pp')
include contrail
class { 'contrail::compute::nova': }

View File

@ -0,0 +1,18 @@
# Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
notice('MODULAR: contrail/contrail-compute-provision.pp')
include contrail
class { 'contrail::compute::provision': }

View File

@ -1,4 +1,4 @@
# Copyright 2015 Mirantis, Inc.
# Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
notice('MODULAR: contrail/compute-repo.pp')
notice('MODULAR: contrail/contrail-compute-repo.pp')
file { '/etc/apt/preferences.d/contrail-pin-110':
ensure => file,

View File

@ -0,0 +1,18 @@
# Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
notice('MODULAR: contrail/contrail-compute-vrouter.pp')
include contrail
class { 'contrail::compute::vrouter': }

View File

@ -0,0 +1,43 @@
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
class contrail::compute::firewall {
$ipv4_file = $::operatingsystem ? {
'Ubuntu' => '/etc/iptables/rules.v4',
'CentOS' => '/etc/sysconfig/iptables',
}
exec {'flush_nat':
command => '/sbin/iptables -t nat -F'
} ->
firewall {'0000 metadata service':
source => '169.254.0.0/16',
iniface => 'vhost0',
action => 'accept'
} ->
firewall {'0001 juniper contrail rules':
proto => 'tcp',
dport => ['2049','8085','9090','8102','33617','39704','44177','55970','60663'],
action => 'accept'
} ->
exec { 'persist-firewall':
command => "/sbin/iptables-save > ${ipv4_file}",
user => 'root',
}
}

View File

@ -1,4 +1,4 @@
# Copyright 2015 Mirantis, Inc.
# Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -12,16 +12,16 @@
# License for the specific language governing permissions and limitations
# under the License.
class contrail::network (
$node_role,
$address,
$ifname = undef,
$netmask,
class contrail::compute::network {
$node_role = 'compute'
$address = $contrail::address
$ifname = $contrail::phys_dev
$netmask = $contrail::netmask_short
$default_gw = undef
) {
$br_file = $::operatingsystem ? {
'Ubuntu' => '/etc/network/interfaces.d/ifcfg-br-mesh',
'CentOS' => '/etc/sysconfig/network-scripts/ifcfg-br-mesh',
'Ubuntu' => '/etc/network/interfaces.d/ifcfg-br-mesh',
'CentOS' => '/etc/sysconfig/network-scripts/ifcfg-br-mesh',
}
Exec {

View File

@ -1,4 +1,4 @@
# Copyright 2015 Mirantis, Inc.
# Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
class contrail::compute {
class contrail::compute::nova {
nova_config {
'DEFAULT/neutron_url': value => "http://${contrail::mos_mgmt_vip}:9696";
@ -31,30 +31,4 @@ class contrail::compute {
enable => true,
}
$ipv4_file = $::operatingsystem ? {
'Ubuntu' => '/etc/iptables/rules.v4',
'CentOS' => '/etc/sysconfig/iptables',
}
exec {'flush_nat':
command => '/sbin/iptables -t nat -F'
} ->
firewall {'0000 metadata service':
source => '169.254.0.0/16',
iniface => 'vhost0',
action => 'accept'
} ->
firewall {'0001 juniper contrail rules':
proto => 'tcp',
dport => ['2049','8085','9090','8102','33617','39704','44177','55970','60663'],
action => 'accept'
} ->
exec { 'persist-firewall':
command => "/sbin/iptables-save > ${ipv4_file}",
user => 'root',
}
}

View File

@ -1,4 +1,4 @@
# Copyright 2015 Mirantis, Inc.
# Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -12,16 +12,18 @@
# License for the specific language governing permissions and limitations
# under the License.
class contrail::provision_compute {
class contrail::compute::provision {
Exec {
provider => 'shell',
path => '/bin:/sbin:/usr/bin:/usr/sbin',
}
package { 'contrail-utils':
ensure => present,
} ->
file { '/opt/contrail':
ensure => 'directory',
} ->
exec { 'provision-vrouter':
command => "contrail-provision-vrouter \
--api_server_ip ${contrail::contrail_mgmt_vip} --api_server_port 8082 --openstack_ip ${contrail::mos_mgmt_vip} \

View File

@ -1,4 +1,4 @@
# Copyright 2015 Mirantis, Inc.
# Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
class contrail::vrouter {
class contrail::compute::vrouter {
class { 'contrail::package':
install => ['contrail-openstack-vrouter','contrail-vrouter-dkms','iproute2','haproxy','libatm1'],

View File

@ -254,12 +254,48 @@
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
# Remove Open vSwitch packages, install and configure Contrail vRouter dkms kernel module
- id: compute-config
- id: contrail-compute-provision
type: puppet
role: [compute]
required_for: [post_deployment_end, contrail-compute-network]
requires: [post_deployment_start]
parameters:
puppet_manifest: puppet/manifests/contrail-compute-provision.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- id: contrail-compute-network
type: puppet
role: [compute]
required_for: [post_deployment_end, contrail-compute-nova]
requires: [post_deployment_start]
parameters:
puppet_manifest: puppet/manifests/contrail-compute-network.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- id: contrail-compute-nova
type: puppet
role: [compute]
required_for: [post_deployment_end, contrail-compute-firewall]
requires: [post_deployment_start]
parameters:
puppet_manifest: puppet/manifests/contrail-compute-nova.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- id: contrail-compute-firewall
type: puppet
role: [compute]
required_for: [post_deployment_end, contrail-compute-vrouter]
requires: [post_deployment_start]
parameters:
puppet_manifest: puppet/manifests/contrail-compute-firewall.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- id: contrail-compute-vrouter
type: puppet
role: [compute]
required_for: [post_deployment_end]
requires: [post_deployment_start]
parameters:
puppet_manifest: puppet/manifests/compute-config.pp
puppet_manifest: puppet/manifests/contrail-compute-vrouter.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720

View File

@ -11,6 +11,6 @@
type: puppet
stage: pre_deployment
parameters:
puppet_manifest: puppet/manifests/compute-repo.pp
puppet_manifest: puppet/manifests/contrail-compute-repo.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
timeout: 720