Fix puppet manifest to the style guide

Fix puppet manifest to the style guide

Change-Id: I39d7d2fe0d7a441385bef9e7b61a7312d0b24327
This commit is contained in:
Alexander Arzhanov 2017-02-16 16:17:28 +03:00
parent 52a3bb920d
commit 3c2cadd2fa
20 changed files with 98 additions and 92 deletions

View File

@ -28,12 +28,12 @@ firewallchain { 'calico-alt-gw-MARK:mangle:IPv4':
}->
# iptables -t mangle -A PREROUTING -i tap+ -j calico-alt-gw-MARK
firewall { '010 process traffic from VM instances to outside':
ensure => present,
table => 'mangle',
chain => 'PREROUTING',
iniface => 'tap+',
proto => 'all',
jump => 'calico-alt-gw-MARK',
ensure => present,
table => 'mangle',
chain => 'PREROUTING',
iniface => 'tap+',
proto => 'all',
jump => 'calico-alt-gw-MARK',
} ->
#iptables -t mangle -A calico-alt-gw-MARK -d 192.168.111.0/24 -j RETURN
firewall { '011 skip internal traffic':
@ -46,12 +46,12 @@ firewall { '011 skip internal traffic':
} ->
#iptables -t mangle -A calico-alt-gw-MARK -j MARK --set-mark 0x222
firewall { '012 mark traffic from VM instances to outside':
ensure => present,
table => 'mangle',
chain => 'calico-alt-gw-MARK',
jump => 'MARK',
proto => 'all',
set_mark => $calico_mark
ensure => present,
table => 'mangle',
chain => 'calico-alt-gw-MARK',
jump => 'MARK',
proto => 'all',
set_mark => $calico_mark
}
file { '/etc/init/calico-alt-gateway.conf':
@ -71,8 +71,8 @@ service {'calico-alt-gateway':
# read the https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt
# Value '2' may be better, but Calico Felix agent is not compotible with '2'
sysctl::value {
'net.ipv4.conf.all.rp_filter': value => "0";
"net.ipv4.conf.${calico_alt_gateway_br}.rp_filter": value => "0";
'net.ipv4.conf.all.rp_filter': value => '0';
"net.ipv4.conf.${calico_alt_gateway_br}.rp_filter": value => '0';
}
# vim: set ts=2 sw=2 et :
# vim: set ts=2 sw=2 et :

View File

@ -6,7 +6,7 @@ $network_metadata = hiera_hash('network_metadata', {})
# Initial constants
$plugin_name = 'fuel-plugin-calico'
$plugin_settings = hiera_hash("${plugin_name}", {})
$plugin_settings = hiera_hash($plugin_name, {})
$enable_ipv4 = try_get_value($plugin_settings, 'enable_ipv4', true)
$enable_ipv6 = try_get_value($plugin_settings, 'enable_ipv6', false)
$as_number = try_get_value($plugin_settings, 'as_number', 65001)
@ -26,7 +26,7 @@ firewall { '410 bird':
proto => 'tcp',
action => 'accept',
} ->
class { 'calico::bird':
class { '::calico::bird':
template => 'compute',
as_number => $as_number,
enable_ipv4 => $enable_ipv4,

View File

@ -47,4 +47,4 @@ tweaks::ubuntu_service_override { 'calico-dhcp-agent':
neutron_config { 'DEFAULT/use_namespaces': value => false }
Neutron_config<||> ~> Service['calico-dhcp-agent']
Neutron_dhcp_agent_config<||> ~> Service['calico-dhcp-agent']
Neutron_dhcp_agent_config<||> ~> Service['calico-dhcp-agent']

View File

@ -1,6 +1,6 @@
notice('MODULAR: calico/compute_felix.pp')
include calico
include ::calico
# required, because neutron-dhcp-agent one of dependency of calico-compute
package { 'neutron-dhcp-agent':
@ -38,4 +38,4 @@ file { '/etc/calico/felix.cfg':
ensure => present,
content => template('calico/felix.cfg.erb'),
} ~>
Service['calico-felix']
Service['calico-felix']

View File

@ -5,12 +5,12 @@ notice('MODULAR: calico/compute_metadata_api.pp')
# $network_metadata = hiera_hash('network_metadata', {})
package { 'nova-api-metadata':
name => 'nova-api-metadata',
ensure => 'installed',
name => 'nova-api-metadata',
} ->
service { 'nova-api-metadata':
ensure => running,
enable => true,
ensure => running
}
# Package['nova-api-metadata'] -> Nova_config<||>

View File

@ -4,13 +4,13 @@ $network_scheme = hiera_hash('network_scheme', {})
prepare_network_config($network_scheme)
$network_metadata = hiera_hash('network_metadata', {})
include calico
include ::calico
include ::nova::params
# Initial constants
$plugin_name = 'fuel-plugin-calico'
$plugin_settings = hiera_hash("${plugin_name}", {})
$plugin_settings = hiera_hash($plugin_name, {})
$neutron_config = hiera_hash('neutron_config')
$management_vip = hiera('management_vip')

View File

@ -3,11 +3,11 @@ notice('MODULAR: calico/etcd_proxy.pp')
prepare_network_config(hiera_hash('network_scheme'))
$network_metadata = hiera_hash('network_metadata', {})
include calico
include ::calico
# Initial constants
$plugin_name = 'fuel-plugin-calico'
$plugin_settings = hiera_hash("${plugin_name}", {})
$plugin_settings = hiera_hash($plugin_name, {})
# Firewall initials
class { '::firewall':}
@ -22,7 +22,7 @@ firewall { '400 etcd':
action => 'accept',
} ->
# Deploy etcd cluster member
class { 'calico::etcd':
class { '::calico::etcd':
node_role => 'proxy',
bind_host => $calico::params::mgmt_ip,
bind_port => $calico::params::etcd_port,

View File

@ -3,8 +3,8 @@ notice('MODULAR: calico/hiera_override.pp')
# Initial constants
$plugin_name = 'fuel-plugin-calico'
$plugin_settings = hiera_hash("${plugin_name}", {})
$network_scheme = hiera_hash("network_scheme", {})
$plugin_settings = hiera_hash($plugin_name, {})
$network_scheme = hiera_hash('network_scheme', {})
# Mangle network_scheme for setup new gateway
if $plugin_settings['metadata']['enabled'] {
@ -16,7 +16,7 @@ if $plugin_settings['metadata']['enabled'] {
$overrides = remove_ovs_usage($network_scheme)
file {"/etc/hiera/plugins/${plugin_name}.yaml":
ensure => file,
content => inline_template("<%= @overrides %>")
content => inline_template('<%= @overrides %>')
}
}
# vim: set ts=2 sw=2 et :
# vim: set ts=2 sw=2 et :

View File

@ -4,7 +4,7 @@ notice('MODULAR: calico/neutron_networks.pp')
# Initial constants
$plugin_name = 'fuel-plugin-calico'
$plugin_settings = hiera_hash("${plugin_name}", {})
$plugin_settings = hiera_hash($plugin_name, {})
$access_hash = hiera_hash('access', {})
$tenant_name = try_get_value($access_hash, 'tenant', 'admin')
@ -29,11 +29,11 @@ neutron_network { $net :
tenant_name => $tenant_name,
} ->
neutron_subnet { $subnet :
ensure => 'present',
cidr => $subnet_cidr,
network_name => $net,
gateway_ip => $subnet_gw,
enable_dhcp => true,
ip_version => '4',
tenant_name => $tenant_name,
ensure => 'present',
cidr => $subnet_cidr,
network_name => $net,
gateway_ip => $subnet_gw,
enable_dhcp => true,
ip_version => '4',
tenant_name => $tenant_name,
}

View File

@ -8,11 +8,11 @@ $network_scheme = hiera_hash('network_scheme', {})
prepare_network_config($network_scheme)
$network_metadata = hiera_hash('network_metadata', {})
include calico
include ::calico
# Initial constants
$plugin_name = 'fuel-plugin-calico'
$plugin_settings = hiera_hash("${plugin_name}", {})
$plugin_settings = hiera_hash($plugin_name, {})
# override neutron options
$override_configuration = hiera_hash('configuration', {})
@ -112,20 +112,20 @@ Package['calico-control'] -> Class['::neutron::server']
Package['calico-control'] -> Class['::neutron::plugins::ml2']
class { '::neutron::plugins::ml2':
type_drivers => ['local', 'flat'],
tenant_network_types => 'local',
mechanism_drivers => ['calico'],
flat_networks => ['*'],
type_drivers => ['local', 'flat'],
tenant_network_types => 'local',
mechanism_drivers => ['calico'],
flat_networks => ['*'],
#network_vlan_ranges => $network_vlan_ranges,
#tunnel_id_ranges => [],
#vxlan_group => $vxlan_group,
#vni_ranges => $tunnel_id_ranges,
path_mtu => $physical_net_mtu,
extension_drivers => $extension_drivers,
path_mtu => $physical_net_mtu,
extension_drivers => $extension_drivers,
#supported_pci_vendor_devs => $pci_vendor_devs,
sriov_agent_required => false,
enable_security_group => true,
firewall_driver => 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver',
sriov_agent_required => false,
enable_security_group => true,
firewall_driver => 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver',
}
class { '::neutron::server':
@ -159,9 +159,9 @@ class { '::neutron::server':
}
Package['neutron'] ~>
augeas { "dhcp_agents_per_network":
augeas { 'dhcp_agents_per_network':
#context => "/files/etc/neutron/neutron.conf",
incl => "/etc/neutron/neutron.conf",
incl => '/etc/neutron/neutron.conf',
lens => 'Puppet.lns',
changes => [
"set DEFAULT/dhcp_agents_per_network ${calico::params::compute_nodes_count}",
@ -169,11 +169,13 @@ augeas { "dhcp_agents_per_network":
} ~> Service['neutron-server']
include ::neutron::params
$neutron_server_package = $neutron::params::server_package ? {
false => $neutron::params::package_name,
default => $neutron::params::server_package,
}
tweaks::ubuntu_service_override { $::neutron::params::server_service:
package_name => $neutron::params::server_package ? {
false => $neutron::params::package_name,
default => $neutron::params::server_package
}
package_name => $neutron_server_package,
}
class { '::neutron::server::notifications':
@ -187,6 +189,6 @@ class { '::neutron::server::notifications':
# Stub for Nuetron package
package { 'neutron':
name => 'binutils',
ensure => 'installed',
name => 'binutils',
}

View File

@ -6,7 +6,7 @@ $calico_alt_gateway_br = get_network_role_property('neutron/mesh','interface')
$calico_alt_gateway = try_get_value($network_scheme,"endpoints/${calico_alt_gateway_br}/vendor_specific/provider_gateway")
if ! is_ip_address($calico_alt_gateway) {
fail("Gateway for Private network does not specified or wrong !!!")
fail('Gateway for Private network does not specified or wrong !!!')
}
# vim: set ts=2 sw=2 et :
# vim: set ts=2 sw=2 et :

View File

@ -2,23 +2,27 @@ notice('MODULAR: calico/repo_setup.pp')
# Initial constants
$plugin_name = 'fuel-plugin-calico'
$plugin_settings = hiera_hash("${plugin_name}", {})
$plugin_settings = hiera_hash($plugin_name, {})
# Bird PPA
apt::source { 'bird-repo':
location => 'http://ppa.launchpad.net/cz.nic-labs/bird/ubuntu',
repos => 'main',
#release => 'trusty',
include => { 'src' => false },
location => 'http://ppa.launchpad.net/cz.nic-labs/bird/ubuntu',
repos => 'main',
#release => 'trusty',
include => {
'src' => false,
},
}
# Calico PPA
apt::source { 'calico-repo':
#location => "http://ppa.launchpad.net/project-calico/stable/ubuntu",
location => "http://ppa.launchpad.net/project-calico/calico-1.4/ubuntu",
repos => 'main',
#release => 'trusty',
include => { 'src' => false },
#location => "http://ppa.launchpad.net/project-calico/stable/ubuntu",
location => 'http://ppa.launchpad.net/project-calico/calico-1.4/ubuntu',
repos => 'main',
#release => 'trusty',
include => {
'src' => false,
},
}
Apt::Source<||> ~> Exec<| title == 'apt_update' |>

View File

@ -3,11 +3,11 @@ notice('MODULAR: calico/etcd.pp')
prepare_network_config(hiera_hash('network_scheme'))
$network_metadata = hiera_hash('network_metadata', {})
include calico
include ::calico
# Initial constants
$plugin_name = 'fuel-plugin-calico'
$plugin_settings = hiera_hash("${plugin_name}", {})
$plugin_settings = hiera_hash($plugin_name, {})
$cluster_info = hiera_hash('cluster', {})
$cluster_token = try_get_value($cluster_info, 'name', 'openstack-calico-cluster')
@ -25,7 +25,7 @@ firewall { '400 etcd':
action => 'accept',
} ->
# Deploy etcd cluster member
class { 'calico::etcd':
class { '::calico::etcd':
node_role => 'server',
bind_host => $calico::params::mgmt_ip,
bind_port => $calico::params::etcd_port,

View File

@ -6,7 +6,7 @@ $network_metadata = hiera_hash('network_metadata', {})
# Initial constants
$plugin_name = 'fuel-plugin-calico'
$plugin_settings = hiera_hash("${plugin_name}", {})
$plugin_settings = hiera_hash($plugin_name, {})
$enable_ipv4 = try_get_value($plugin_settings, 'enable_ipv4', true)
$enable_ipv6 = try_get_value($plugin_settings, 'enable_ipv6', false)
$as_number = try_get_value($plugin_settings, 'as_number', 65001)
@ -31,7 +31,7 @@ firewall { '410 bird':
proto => 'tcp',
action => 'accept',
} ->
class { 'calico::bird':
class { '::calico::bird':
template => 'rr',
as_number => $as_number,
enable_ipv4 => $enable_ipv4,

View File

@ -50,7 +50,7 @@ class calico::bird (
mode => '0644',
owner => 'root',
group => 'root',
content => template("calico/bird-calico_os-filters.conf.erb"),
content => template('calico/bird-calico_os-filters.conf.erb'),
} ->
file { '/etc/bird/bird.conf':
ensure => present,
@ -92,4 +92,4 @@ class calico::bird (
}
}
# vim: set ts=2 sw=2 et :
# vim: set ts=2 sw=2 et :

View File

@ -9,7 +9,7 @@ define calico::bird::bgp_peer_record (
) {
include ::calico::params
$peer_config_path = "/etc/bird/peers/${template}__${name}.conf"
file { "${peer_config_path}":
file { $peer_config_path:
ensure => $ensure,
require => File['/etc/bird/peers'],
before => File['/etc/bird/bird.conf'],
@ -17,19 +17,19 @@ define calico::bird::bgp_peer_record (
content => template("calico/bird-peer-${template}.conf.erb"),
}
if $include {
file_line {"":
line => "include ${peer_config_path};",
path => '/etc/bird/bird.conf',
file_line {'':
line => "include ${peer_config_path};",
path => '/etc/bird/bird.conf',
#after => undef,
#ensure => 'present',
#match => undef, # /.*match/
#multiple => undef, # 'true' or 'false'
#name => undef,
#replace => true, # 'true' or 'false'
require => File['/etc/bird/bird.conf'],
notify => Service['bird']
require => File['/etc/bird/bird.conf'],
notify => Service['bird']
}
}
}
# vim: set ts=2 sw=2 et :
# vim: set ts=2 sw=2 et :

View File

@ -54,9 +54,9 @@ case $node_role {
file { '/var/log/etcd.log':
ensure => present,
mode => '0644',
owner => 'etcd',
group => 'etcd',
mode => '0644',
owner => 'etcd',
group => 'etcd',
} ->
file { '/etc/init/etcd.conf':
@ -74,4 +74,4 @@ case $node_role {
}
}
# vim: set ts=2 sw=2 et :
# vim: set ts=2 sw=2 et :

View File

@ -14,7 +14,7 @@
class calico {
include calico::params
include ::calico::params
}
# vim: set ts=2 sw=2 et :
# vim: set ts=2 sw=2 et :

View File

@ -38,6 +38,6 @@ class calico::params {
$etcd_peer_port = '2380'
$etcd_servers = suffix(prefix($etcd_nodes_ips, 'http://'), ":${etcd_port}")
$etcd_servers_list = join($etcd_servers, ',')
$etcd_servers_named_list = join(suffix(join_keys_to_values($etcd_nodes_map,"=http://"), ":${etcd_peer_port}"), ',')
$etcd_servers_named_list = join(suffix(join_keys_to_values($etcd_nodes_map,'=http://'), ":${etcd_peer_port}"), ',')
}
# vim: set ts=2 sw=2 et :
# vim: set ts=2 sw=2 et :

View File

@ -9,4 +9,4 @@
# Learn more about module testing here:
# http://docs.puppetlabs.com/guides/tests_smoke.html
#
include calico
include ::calico