aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.fixtures.yml4
-rw-r--r--Gemfile4
-rw-r--r--lib/facter/netmask_ipv6.rb47
-rw-r--r--lib/puppet/parser/functions/interface_for_ip.rb32
-rw-r--r--manifests/cluster/cassandra.pp26
-rw-r--r--manifests/cluster/zookeeper.pp8
-rw-r--r--manifests/loadbalancer.pp74
-rw-r--r--manifests/network/midonet/agent.pp9
-rw-r--r--manifests/network/midonet/api.pp7
-rw-r--r--spec/classes/tripleo_cluster_cassandra_spec.rb23
-rw-r--r--spec/classes/tripleo_midonet_agent_spec.rb1
11 files changed, 196 insertions, 39 deletions
diff --git a/.fixtures.yml b/.fixtures.yml
index e2444d1..69512da 100644
--- a/.fixtures.yml
+++ b/.fixtures.yml
@@ -12,8 +12,8 @@ fixtures:
repo: 'git://github.com/puppetlabs/puppetlabs-inifile.git'
ref: '1.4.2'
'cassandra':
- repo: 'git://github.com/midonet/puppet-cassandra.git'
- ref: 'v1.1.1'
+ repo: 'git://github.com/locp/cassandra.git'
+ ref: '1.9.2'
'zookeeper':
repo: 'git://github.com/deric/puppet-zookeeper.git'
ref: 'v0.3.9'
diff --git a/Gemfile b/Gemfile
index 6d4ce9a..91c5f0a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -14,6 +14,10 @@ group :development, :test do
gem 'puppet-lint-numericvariable', :require => 'false'
gem 'json', :require => 'false'
gem 'webmock', :require => 'false'
+ # adding 'psych' explicitly
+ # https://github.com/bundler/bundler/issues/2068
+ # TODO: drop it in a future release of 'bundle'.
+ gem 'psych', :require => 'false'
end
group :system_tests do
diff --git a/lib/facter/netmask_ipv6.rb b/lib/facter/netmask_ipv6.rb
new file mode 100644
index 0000000..5261485
--- /dev/null
+++ b/lib/facter/netmask_ipv6.rb
@@ -0,0 +1,47 @@
+require 'ipaddr'
+
+def netmask6(value)
+ if value
+ ip = IPAddr.new('::0').mask(value)
+ ip.inspect.split('/')[1].gsub('>', '')
+ end
+end
+
+if Facter.value('facterversion')[0].to_i < 3
+ Facter::Util::IP.get_interfaces.each do |interface|
+ Facter.add('netmask6_' + Facter::Util::IP.alphafy(interface)) do
+ setcode do
+ tmp = []
+ regex = %r{inet6\s+.*\s+(?:prefixlen)\s+(\d+)}x
+ output_int = Facter::Util::IP.get_output_for_interface_and_label(interface, 'netmask6')
+
+ output_int.each_line do |line|
+ prefixlen = nil
+ matches = line.match(regex)
+ prefixlen = matches[1] if matches
+
+ if prefixlen
+ value = netmask6(prefixlen)
+ tmp.push(value)
+ end
+ end
+
+ tmp.shift if tmp
+ end
+ end
+ end
+
+ Facter.add('netmask6') do
+ setcode do
+ prefixlen = nil
+ regex = %r{#{Facter.value(:ipaddress6)}.*?(?:prefixlen)\s*(\d+)}x
+
+ String(Facter::Util::IP.exec_ifconfig(['2>/dev/null'])).split(/\n/).collect do |line|
+ matches = line.match(regex)
+ prefixlen = matches[1] if matches
+ end
+
+ netmask6(prefixlen) if prefixlen
+ end
+ end
+end
diff --git a/lib/puppet/parser/functions/interface_for_ip.rb b/lib/puppet/parser/functions/interface_for_ip.rb
index 1c67120..fd68be0 100644
--- a/lib/puppet/parser/functions/interface_for_ip.rb
+++ b/lib/puppet/parser/functions/interface_for_ip.rb
@@ -8,25 +8,31 @@ module Puppet::Parser::Functions
newfunction(:interface_for_ip, :type => :rvalue, :doc => "Find the bind IP address for the provided subnet.") do |arg|
if arg[0].class == String
begin
- ip_to_find = arg[0]
+ ip1 = IPAddr.new(arg[0])
Dir.foreach('/sys/class/net/') do |interface|
- next if interface == '.' or interface == '..'
+ next if interface == '.' || interface == '..'
iface_no_dash = interface.gsub('-', '_')
- interface_ip = lookupvar("ipaddress_#{iface_no_dash}")
- netmask = lookupvar("netmask_#{iface_no_dash}")
- if not interface_ip.nil? then
- ip1=IPAddr.new(interface_ip)
- ip2=IPAddr.new(ip_to_find)
- if ip1.mask(netmask) == ip2.mask(netmask) then
- return interface
- end
+
+ if ip1.ipv4?
+ ipaddress_name = "ipaddress_#{iface_no_dash}"
+ netmask_name = "netmask_#{iface_no_dash}"
+ else
+ ipaddress_name = "ipaddress6_#{iface_no_dash}"
+ netmask_name = "netmask6_#{iface_no_dash}"
+ end
+
+ interface_ip = lookupvar(ipaddress_name)
+ netmask = lookupvar(netmask_name)
+ unless interface_ip.nil? then
+ ip2 = IPAddr.new(interface_ip)
+ return interface if ip1.mask(netmask) == ip2.mask(netmask)
end
end
- rescue JSON::ParserError
- raise Puppet::ParseError, "Syntax error: #{arg[0]} is invalid"
+ rescue IPAddr::InvalidAddressError => e
+ raise Puppet::ParseError, "#{e}: #{arg[0]}"
end
else
- raise Puppet::ParseError, "Syntax error: #{arg[0]} is not a String"
+ raise Puppet::ParseError, "Syntax error: #{arg[0]} must be a String"
end
return ''
end
diff --git a/manifests/cluster/cassandra.pp b/manifests/cluster/cassandra.pp
index a810ccd..b20926b 100644
--- a/manifests/cluster/cassandra.pp
+++ b/manifests/cluster/cassandra.pp
@@ -52,18 +52,22 @@ class tripleo::cluster::cassandra(
$client_port_thrift = '9160'
)
{
- validate_array($cassandra_servers)
+
+ # TODO: Remove this comment once we can guarantee that all the distros
+ # deploying TripleO use Puppet > 3.7 because of this bug:
+ # https://tickets.puppetlabs.com/browse/PUP-1299
+ #
+ # validate_array($cassandra_servers)
validate_ipv4_address($cassandra_ip)
- class {'::cassandra::run':
- seeds => $cassandra_servers,
- seed_address => $cassandra_ip,
- conf_dir => '/etc/cassandra/default.conf',
- pid_dir => '/var/run/cassandra',
- service_path => '/sbin',
- storage_port => $storage_port,
- ssl_storage_port => $ssl_storage_port,
- client_port => $client_port,
- client_port_thrift => $client_port_thrift
+ class {'::cassandra':
+ cluster_name => 'TripleO',
+ seeds => $cassandra_servers,
+ listen_address => $cassandra_ip,
+ storage_port => $storage_port,
+ ssl_storage_port => $ssl_storage_port,
+ native_transport_port => $client_port,
+ rpc_port => $client_port_thrift
}
+
}
diff --git a/manifests/cluster/zookeeper.pp b/manifests/cluster/zookeeper.pp
index 6f4adbc..82d21ee 100644
--- a/manifests/cluster/zookeeper.pp
+++ b/manifests/cluster/zookeeper.pp
@@ -39,9 +39,13 @@ class tripleo::cluster::zookeeper(
$zookeeper_hostnames
)
{
- validate_array($zookeeper_server_ips)
+ # TODO: Remove comments below once we can guarantee that all the distros
+ # deploying TripleO use Puppet > 3.7 because of this bug:
+ # https://tickets.puppetlabs.com/browse/PUP-1299
+
+ # validate_array($zookeeper_server_ips)
validate_ipv4_address($zookeeper_client_ip)
- validate_array($zookeeper_hostnames)
+ # validate_array($zookeeper_hostnames)
# TODO(devvesa) Zookeeper package should provide these paths,
# remove this lines as soon as it will.
diff --git a/manifests/loadbalancer.pp b/manifests/loadbalancer.pp
index c4a317b..6820459 100644
--- a/manifests/loadbalancer.pp
+++ b/manifests/loadbalancer.pp
@@ -35,6 +35,10 @@
# The value to use as maxconn in the haproxy default config section.
# Defaults to 4096
#
+# [*haproxy_default_timeout*]
+# The value to use as timeout in the haproxy default config section.
+# Defaults to [ 'http-request 10s', 'queue 1m', 'connect 10s', 'client 1m', 'server 1m', 'check 10s' ]
+#
# [*haproxy_log_address*]
# The IPv4, IPv6 or filesystem socket path of the syslog server.
# Defaults to '/dev/log'
@@ -130,6 +134,11 @@
# When set, enables SSL on the Ceilometer public API endpoint using the specified file.
# Defaults to undef
#
+# [*aodh_certificate*]
+# Filename of an HAProxy-compatible certificate and key file
+# When set, enables SSL on the Aodh public API endpoint using the specified file.
+# Defaults to undef
+#
# [*swift_certificate*]
# Filename of an HAProxy-compatible certificate and key file
# When set, enables SSL on the Swift public API endpoint using the specified file.
@@ -198,6 +207,10 @@
# (optional) Enable or not Ceilometer API binding
# Defaults to false
#
+# [*aodh*]
+# (optional) Enable or not Aodh API binding
+# Defaults to false
+#
# [*swift_proxy_server*]
# (optional) Enable or not Swift API binding
# Defaults to false
@@ -238,6 +251,10 @@
# (optional) Enable or not Redis binding
# Defaults to false
#
+# [*midonet_api*]
+# (optional) Enable or not MidoNet API binding
+# Defaults to false
+#
class tripleo::loadbalancer (
$controller_virtual_ip,
$control_virtual_interface,
@@ -250,6 +267,7 @@ class tripleo::loadbalancer (
$haproxy_service_manage = true,
$haproxy_global_maxconn = 20480,
$haproxy_default_maxconn = 4096,
+ $haproxy_default_timeout = [ 'http-request 10s', 'queue 1m', 'connect 10s', 'client 1m', 'server 1m', 'check 10s' ],
$haproxy_log_address = '/dev/log',
$controller_host = undef,
$controller_hosts = undef,
@@ -262,6 +280,7 @@ class tripleo::loadbalancer (
$glance_certificate = undef,
$nova_certificate = undef,
$ceilometer_certificate = undef,
+ $aodh_certificate = undef,
$swift_certificate = undef,
$heat_certificate = undef,
$horizon_certificate = undef,
@@ -278,6 +297,7 @@ class tripleo::loadbalancer (
$nova_metadata = false,
$nova_novncproxy = false,
$ceilometer = false,
+ $aodh = false,
$swift_proxy_server = false,
$heat_api = false,
$heat_cloudwatch = false,
@@ -288,6 +308,7 @@ class tripleo::loadbalancer (
$mysql_clustercheck = false,
$rabbitmq = false,
$redis = false,
+ $midonet_api = false,
) {
if !$controller_host and !$controller_hosts {
@@ -421,6 +442,11 @@ class tripleo::loadbalancer (
} else {
$ceilometer_bind_certificate = $service_certificate
}
+ if $aodh_certificate {
+ $aodh_bind_certificate = $aodh_certificate
+ } else {
+ $aodh_bind_certificate = $service_certificate
+ }
if $swift_certificate {
$swift_bind_certificate = $swift_certificate
} else {
@@ -558,6 +584,19 @@ class tripleo::loadbalancer (
}
}
+ $aodh_api_vip = hiera('aodh_api_vip', $controller_virtual_ip)
+ if $aodh_bind_certificate {
+ $aodh_bind_opts = {
+ "${aodh_api_vip}:8042" => [],
+ "${public_virtual_ip}:13042" => ['ssl', 'crt', $aodh_bind_certificate],
+ }
+ } else {
+ $aodh_bind_opts = {
+ "${aodh_api_vip}:8042" => [],
+ "${public_virtual_ip}:8042" => [],
+ }
+ }
+
$swift_proxy_vip = hiera('swift_proxy_vip', $controller_virtual_ip)
if $swift_bind_certificate {
$swift_bind_opts = {
@@ -646,7 +685,7 @@ class tripleo::loadbalancer (
'mode' => 'tcp',
'log' => 'global',
'retries' => '3',
- 'timeout' => [ 'http-request 10s', 'queue 1m', 'connect 10s', 'client 1m', 'server 1m', 'check 10s' ],
+ 'timeout' => $haproxy_default_timeout,
'maxconn' => $haproxy_default_maxconn,
},
}
@@ -845,6 +884,20 @@ class tripleo::loadbalancer (
}
}
+ if $aodh {
+ haproxy::listen { 'aodh':
+ bind => $aodh_bind_opts,
+ collect_exported => false,
+ }
+ haproxy::balancermember { 'aodh':
+ listening_service => 'aodh',
+ ports => '8042',
+ ipaddresses => hiera('aodh_api_node_ips', $controller_hosts_real),
+ server_names => $controller_hosts_names_real,
+ options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
+ }
+ }
+
if $swift_proxy_server {
haproxy::listen { 'swift_proxy_server':
bind => $swift_bind_opts,
@@ -1006,4 +1059,23 @@ class tripleo::loadbalancer (
}
}
+ $midonet_api_vip = hiera('midonet_api_vip', $controller_virtual_ip)
+ $midonet_bind_opts = {
+ "${midonet_api_vip}:8081" => [],
+ "${public_virtual_ip}:8081" => [],
+ }
+
+ if $midonet_api {
+ haproxy::listen { 'midonet_api':
+ bind => $midonet_bind_opts,
+ collect_exported => false,
+ }
+ haproxy::balancermember { 'midonet_api':
+ listening_service => 'midonet_api',
+ ports => '8081',
+ ipaddresses => hiera('midonet_api_node_ips', $controller_hosts_real),
+ server_names => $controller_hosts_names_real,
+ options => ['check', 'inter 2000', 'rise 2', 'fall 5'],
+ }
+ }
}
diff --git a/manifests/network/midonet/agent.pp b/manifests/network/midonet/agent.pp
index 2f1da94..0e65282 100644
--- a/manifests/network/midonet/agent.pp
+++ b/manifests/network/midonet/agent.pp
@@ -33,8 +33,13 @@ class tripleo::network::midonet::agent (
$cassandra_seeds
) {
- validate_array($zookeeper_servers)
- validate_array($cassandra_seeds)
+ # TODO: Remove comments below once we can guarantee that all the distros
+ # deploying TripleO use Puppet > 3.7 because of this bug:
+ # https://tickets.puppetlabs.com/browse/PUP-1299
+
+ # validate_array($zookeeper_servers)
+ # validate_array($cassandra_seeds)
+
# FIXME: This statement should be controlled by hiera on heat templates
# project
diff --git a/manifests/network/midonet/api.pp b/manifests/network/midonet/api.pp
index 33b2217..83efd2c 100644
--- a/manifests/network/midonet/api.pp
+++ b/manifests/network/midonet/api.pp
@@ -78,7 +78,12 @@ class tripleo::network::midonet::api(
$admin_tenant_name = 'admin'
)
{
- validate_array($zookeeper_servers)
+
+ # TODO: Remove this comment once we can guarantee that all the distros
+ # deploying TripleO use Puppet > 3.7 because of this bug:
+ # https://tickets.puppetlabs.com/browse/PUP-1299
+
+ # validate_array($zookeeper_servers)
validate_ip_address($vip)
validate_ip_address($keystone_ip)
validate_ip_address($bind_address)
diff --git a/spec/classes/tripleo_cluster_cassandra_spec.rb b/spec/classes/tripleo_cluster_cassandra_spec.rb
index 4f2eb6c..13be98e 100644
--- a/spec/classes/tripleo_cluster_cassandra_spec.rb
+++ b/spec/classes/tripleo_cluster_cassandra_spec.rb
@@ -21,6 +21,14 @@ describe 'tripleo::cluster::cassandra' do
shared_examples_for 'cassandra cluster service' do
+ let :facts do
+ {
+ :hostname => 'host1.midonet',
+ :osfamily => 'RedHat',
+ :operatingsystemmajrelease => 7,
+ }
+ end
+
let :params do
{
:cassandra_servers => ['192.168.2.2', '192.168.2.3'],
@@ -29,14 +37,15 @@ describe 'tripleo::cluster::cassandra' do
end
it 'should configure cassandra' do
- is_expected.to contain_class('cassandra::run').with(
- :seeds => ['192.168.2.2', '192.168.2.3'],
- :seed_address => '192.168.2.2',
- :storage_port => '7000',
- :ssl_storage_port => '7001',
- :client_port => '9042',
- :client_port_thrift => '9160'
+ is_expected.to contain_class('cassandra').with(
+ :seeds => ['192.168.2.2', '192.168.2.3'],
+ :listen_address => '192.168.2.2',
+ :storage_port => 7000,
+ :ssl_storage_port => 7001,
+ :native_transport_port => 9042,
+ :rpc_port => 9160
)
+
end
end
diff --git a/spec/classes/tripleo_midonet_agent_spec.rb b/spec/classes/tripleo_midonet_agent_spec.rb
index eb9195e..eb3abfe 100644
--- a/spec/classes/tripleo_midonet_agent_spec.rb
+++ b/spec/classes/tripleo_midonet_agent_spec.rb
@@ -24,6 +24,7 @@ describe 'tripleo::network::midonet::agent' do
:hostname => 'host2.midonet',
:osfamily => 'RedHat',
:operatingsystem => 'CentOS',
+ :operatingsystemrelease => '7.1',
:operatingsystemmajrelease => 7,
}
end