[Ironic] Add haproxy services for Ironic
This change adds new haproxy services needed by ironic: * ironic-api - on management and public VIPs * ironic-api - on baremetal VIP * swift-baremetal - proxy for swift servers on baremetal VIP * noop tests Partially Implements: blueprint fuel-integrate-ironic Change-Id: I5ced9e5706fcba9fc60a07771ae51538945895a9
This commit is contained in:
parent
e1ad5b695e
commit
52da079a8f
|
@ -0,0 +1,62 @@
|
|||
# == Class: openstack::ha::ironic
|
||||
#
|
||||
# HA configuration for OpenStack Ironic
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*internal_virtual_ip*]
|
||||
# (required) String. This is the ipaddress to be used for the internal facing
|
||||
# vip
|
||||
#
|
||||
# [*ipaddresses*]
|
||||
# (required) Array. This is an array of ipaddresses for the backend services
|
||||
# to be loadbalanced
|
||||
#
|
||||
# [*public_ssl*]
|
||||
# (optional) Boolean. If true, enables SSL for $public_virtual_ip
|
||||
# Defaults to false.
|
||||
#
|
||||
# [*public_virtual_ip*]
|
||||
# (required) String. This is the ipaddress to be used for the external facing
|
||||
# vip
|
||||
#
|
||||
# [*baremetal_virtual_ip*]
|
||||
# (required) String. This is the ipaddress to be used for the baremetal facing
|
||||
# vip
|
||||
#
|
||||
# [*server_names*]
|
||||
# (required) Array. This is an array of server names for the haproxy service
|
||||
#
|
||||
class openstack::ha::ironic (
|
||||
$internal_virtual_ip,
|
||||
$ipaddresses,
|
||||
$public_virtual_ip,
|
||||
$server_names,
|
||||
$baremetal_virtual_ip,
|
||||
$public_ssl = false,
|
||||
) {
|
||||
|
||||
# defaults for any haproxy_service within this class
|
||||
Openstack::Ha::Haproxy_service {
|
||||
listen_port => 6385,
|
||||
internal_virtual_ip => $internal_virtual_ip,
|
||||
ipaddresses => $ipaddresses,
|
||||
public_virtual_ip => $public_virtual_ip,
|
||||
server_names => $server_names,
|
||||
haproxy_config_options => {
|
||||
option => ['httpchk GET /', 'httplog','httpclose'],
|
||||
},
|
||||
}
|
||||
|
||||
openstack::ha::haproxy_service { 'ironic':
|
||||
order => '180',
|
||||
public => true,
|
||||
public_ssl => $public_ssl,
|
||||
}
|
||||
|
||||
openstack::ha::haproxy_service { 'ironic-baremetal':
|
||||
order => '185',
|
||||
public_virtual_ip => false,
|
||||
internal_virtual_ip => $baremetal_virtual_ip,
|
||||
}
|
||||
}
|
|
@ -20,6 +20,10 @@
|
|||
# (required) String. This is the ipaddress to be used for the external facing
|
||||
# vip
|
||||
#
|
||||
# [*baremetal_virtual_ip*]
|
||||
# (optional) String. This is the ipaddress to be used for the baremetal facing
|
||||
# vip
|
||||
#
|
||||
# [*server_names*]
|
||||
# (required) Array. This is an array of server names for the haproxy service
|
||||
#
|
||||
|
@ -29,25 +33,33 @@ class openstack::ha::swift (
|
|||
$public_virtual_ip,
|
||||
$server_names,
|
||||
$public_ssl = false,
|
||||
$baremetal_virtual_ip = undef,
|
||||
) {
|
||||
|
||||
# defaults for any haproxy_service within this class
|
||||
Openstack::Ha::Haproxy_service {
|
||||
listen_port => 8080,
|
||||
internal_virtual_ip => $internal_virtual_ip,
|
||||
ipaddresses => $ipaddresses,
|
||||
public_virtual_ip => $public_virtual_ip,
|
||||
server_names => $server_names,
|
||||
}
|
||||
|
||||
openstack::ha::haproxy_service { 'swift':
|
||||
order => '120',
|
||||
listen_port => 8080,
|
||||
public => true,
|
||||
public_ssl => $public_ssl,
|
||||
haproxy_config_options => {
|
||||
'option' => ['httpchk', 'httplog', 'httpclose'],
|
||||
},
|
||||
balancermember_options => 'check port 49001 inter 15s fastinter 2s downinter 8s rise 3 fall 3',
|
||||
}
|
||||
|
||||
openstack::ha::haproxy_service { 'swift':
|
||||
order => '120',
|
||||
public => true,
|
||||
public_ssl => $public_ssl,
|
||||
}
|
||||
|
||||
if $baremetal_virtual_ip {
|
||||
openstack::ha::haproxy_service { 'swift-baremetal':
|
||||
order => '125',
|
||||
public_virtual_ip => false,
|
||||
internal_virtual_ip => $baremetal_virtual_ip,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -269,6 +269,9 @@ $mongo_roles = ['primary-mongo', 'mongo']
|
|||
# todo: use special node-roles instead controllers in the future
|
||||
$neutron_nodes = get_nodes_hash_by_roles($network_metadata, ['primary-controller', 'controller'])
|
||||
|
||||
#Define Ironic-related variables:
|
||||
$ironic_api_nodes = $controllers_hash
|
||||
|
||||
# Change nova_hash to add vnc port to it
|
||||
# TODO(sbog): change this when we will get rid of global hashes
|
||||
$public_ssl_hash = hiera('public_ssl')
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
notice('MODULAR: openstack-haproxy-ironic.pp')
|
||||
|
||||
$network_metadata = hiera_hash('network_metadata')
|
||||
$public_ssl_hash = hiera('public_ssl')
|
||||
$ironic_hash = hiera_hash('ironic', {})
|
||||
|
||||
$ironic_address_map = get_node_to_ipaddr_map_by_network_role(hiera('ironic_api_nodes'), 'ironic/api')
|
||||
|
||||
$server_names = hiera_array('ironic_server_names', keys($ironic_address_map))
|
||||
$ipaddresses = hiera_array('ironic_ipaddresses', values($ironic_address_map))
|
||||
$public_virtual_ip = hiera('public_vip')
|
||||
$internal_virtual_ip = hiera('management_vip')
|
||||
$baremetal_virtual_ip = $network_metadata['vips']['baremetal']['ipaddr']
|
||||
|
||||
class { '::openstack::ha::ironic':
|
||||
internal_virtual_ip => $internal_virtual_ip,
|
||||
ipaddresses => $ipaddresses,
|
||||
public_virtual_ip => $public_virtual_ip,
|
||||
server_names => $server_names,
|
||||
public_ssl => $public_ssl_hash['services'],
|
||||
baremetal_virtual_ip => $baremetal_virtual_ip,
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
require File.join File.dirname(__FILE__), 'haproxy_post_common.rb'
|
||||
|
||||
def expected_backends
|
||||
return $expected_backends if $expected_backends
|
||||
backends = %w(
|
||||
ironic
|
||||
ironic-baremetal
|
||||
)
|
||||
$expected_backends = backends
|
||||
end
|
||||
|
||||
OpenstackHaproxyPostTest.create_tests
|
|
@ -4,6 +4,7 @@ $network_metadata = hiera_hash('network_metadata')
|
|||
$storage_hash = hiera_hash('storage', {})
|
||||
$swift_proxies = hiera_hash('swift_proxies', undef)
|
||||
$public_ssl_hash = hiera('public_ssl')
|
||||
$ironic_hash = hiera_hash('ironic', {})
|
||||
|
||||
if !($storage_hash['images_ceph'] and $storage_hash['objects_ceph']) and !$storage_hash['images_vcenter'] {
|
||||
$use_swift = true
|
||||
|
@ -20,12 +21,17 @@ if ($use_swift) {
|
|||
$public_virtual_ip = hiera('public_vip')
|
||||
$internal_virtual_ip = hiera('management_vip')
|
||||
|
||||
if $ironic_hash['enabled'] {
|
||||
$baremetal_virtual_ip = $network_metadata['vips']['baremetal']['ipaddr']
|
||||
}
|
||||
|
||||
# configure swift ha proxy
|
||||
class { '::openstack::ha::swift':
|
||||
internal_virtual_ip => $internal_virtual_ip,
|
||||
ipaddresses => $ipaddresses,
|
||||
public_virtual_ip => $public_virtual_ip,
|
||||
server_names => $server_names,
|
||||
public_ssl => $public_ssl_hash['services'],
|
||||
internal_virtual_ip => $internal_virtual_ip,
|
||||
ipaddresses => $ipaddresses,
|
||||
public_virtual_ip => $public_virtual_ip,
|
||||
server_names => $server_names,
|
||||
public_ssl => $public_ssl_hash['services'],
|
||||
baremetal_virtual_ip => $baremetal_virtual_ip,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
type: puppet
|
||||
groups: [primary-controller, controller]
|
||||
required_for: [deploy_end]
|
||||
requires: [deploy_start, openstack-haproxy-ceilometer, openstack-haproxy-cinder, openstack-haproxy-glance, openstack-haproxy-heat, openstack-haproxy-horizon, openstack-haproxy-keystone, openstack-haproxy-murano, openstack-haproxy-mysqld, openstack-haproxy-neutron, openstack-haproxy-nova, openstack-haproxy-radosgw, openstack-haproxy-sahara, openstack-haproxy-swift, openstack-haproxy-stats]
|
||||
requires: [deploy_start, openstack-haproxy-ceilometer, openstack-haproxy-cinder, openstack-haproxy-glance, openstack-haproxy-heat, openstack-haproxy-horizon, openstack-haproxy-keystone, openstack-haproxy-murano, openstack-haproxy-mysqld, openstack-haproxy-neutron, openstack-haproxy-nova, openstack-haproxy-radosgw, openstack-haproxy-sahara, openstack-haproxy-swift, openstack-haproxy-stats, openstack-haproxy-ironic]
|
||||
parameters:
|
||||
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/openstack-haproxy/openstack-haproxy.pp
|
||||
puppet_modules: /etc/puppet/modules
|
||||
|
@ -204,3 +204,18 @@
|
|||
test_post:
|
||||
cmd: ruby /etc/puppet/modules/osnailyfacter/modular/openstack-haproxy/openstack-haproxy-stats_post.rb
|
||||
|
||||
- id: openstack-haproxy-ironic
|
||||
type: puppet
|
||||
groups: [primary-controller, controller]
|
||||
condition: "settings:additional_components.ironic.value == true"
|
||||
required_for: [deploy_end]
|
||||
requires: [deploy_start, cluster-haproxy]
|
||||
parameters:
|
||||
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/openstack-haproxy/openstack-haproxy-ironic.pp
|
||||
puppet_modules: /etc/puppet/modules
|
||||
timeout: 300
|
||||
test_pre:
|
||||
cmd: ruby /etc/puppet/modules/osnailyfacter/modular/openstack-haproxy/openstack-haproxy_pre.rb
|
||||
test_post:
|
||||
cmd: ruby /etc/puppet/modules/osnailyfacter/modular/openstack-haproxy/openstack-haproxy-ironic_post.rb
|
||||
|
||||
|
|
|
@ -105,5 +105,6 @@
|
|||
<% globals.store "swift_proxy_caches", @swift_proxy_caches -%>
|
||||
<% globals.store "is_primary_swift_proxy", @is_primary_swift_proxy -%>
|
||||
<% globals.store "nova_api_nodes", @nova_api_nodes -%>
|
||||
<% globals.store "ironic_api_nodes", @ironic_api_nodes -%>
|
||||
|
||||
<%= YAML.dump globals %>
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
require 'spec_helper'
|
||||
require 'shared-examples'
|
||||
manifest = 'openstack-haproxy/openstack-haproxy-ironic.pp'
|
||||
|
||||
ironic_enabled = Noop.hiera_structure 'ironic/enabled'
|
||||
if ironic_enabled
|
||||
describe manifest do
|
||||
shared_examples 'catalog' do
|
||||
baremetal_virtual_ip = Noop.hiera_structure 'network_metadata/vips/baremetal/ipaddr'
|
||||
it 'should declare openstack::ha::ironic class with baremetal_virtual_ip' do
|
||||
should contain_class('openstack::ha::ironic').with(
|
||||
'baremetal_virtual_ip' => baremetal_virtual_ip,
|
||||
)
|
||||
end
|
||||
end # end of shared_examples
|
||||
test_ubuntu_and_centos manifest
|
||||
end
|
||||
end # ironic
|
|
@ -3,6 +3,25 @@ require 'shared-examples'
|
|||
manifest = 'openstack-haproxy/openstack-haproxy-swift.pp'
|
||||
|
||||
describe manifest do
|
||||
test_ubuntu_and_centos manifest
|
||||
shared_examples 'catalog' do
|
||||
ironic_enabled = Noop.hiera_structure 'ironic/enabled'
|
||||
if ironic_enabled
|
||||
baremetal_virtual_ip = Noop.hiera_structure 'network_metadata/vips/baremetal/ipaddr'
|
||||
|
||||
it 'should declare ::openstack::ha::swift class with baremetal_virtual_ip' do
|
||||
should contain_class('openstack::ha::swift').with(
|
||||
'baremetal_virtual_ip' => baremetal_virtual_ip,
|
||||
)
|
||||
end
|
||||
it 'should declare openstack::ha::haproxy_service with name swift-baremetal' do
|
||||
should contain_openstack__ha__haproxy_service('swift-baremetal').with(
|
||||
'order' => '125',
|
||||
'public_virtual_ip' => false,
|
||||
'internal_virtual_ip' => baremetal_virtual_ip
|
||||
)
|
||||
end
|
||||
end
|
||||
end # end of shared_examples
|
||||
test_ubuntu_and_centos manifest
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue