diff options
-rw-r--r-- | lib/puppet/parser/functions/noop_resource.rb | 53 | ||||
-rw-r--r-- | manifests/fencing.pp | 3 | ||||
-rw-r--r-- | manifests/haproxy.pp | 40 | ||||
-rw-r--r-- | manifests/haproxy/endpoint.pp | 2 | ||||
-rw-r--r-- | manifests/profile/base/cinder.pp | 1 | ||||
-rw-r--r-- | manifests/profile/base/cinder/api.pp | 1 | ||||
-rw-r--r-- | manifests/profile/base/glance/registry.pp | 50 | ||||
-rw-r--r-- | manifests/profile/base/nova.pp | 1 | ||||
-rw-r--r-- | manifests/profile/base/nova/placement.pp | 2 | ||||
-rw-r--r-- | manifests/profile/pacemaker/ceph/rbdmirror.pp | 77 | ||||
-rw-r--r-- | spec/classes/tripleo_profile_base_cinder_api_spec.rb | 4 | ||||
-rw-r--r-- | spec/classes/tripleo_profile_base_cinder_spec.rb | 6 | ||||
-rw-r--r-- | spec/classes/tripleo_profile_pacemaker_ceph_rbdmirror_spec.rp | 64 |
13 files changed, 224 insertions, 80 deletions
diff --git a/lib/puppet/parser/functions/noop_resource.rb b/lib/puppet/parser/functions/noop_resource.rb new file mode 100644 index 0000000..921eb5d --- /dev/null +++ b/lib/puppet/parser/functions/noop_resource.rb @@ -0,0 +1,53 @@ +# Copyright 2017 Red Hat, Inc. +# All Rights Reserved. +# +# 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. +# +# Author: Dan Prince <dprince@redhat.com> +# +# A function to create noop providers (set as the default) for the named +# resource. This works alongside of 'puppet apply --tags' to disable +# some custom resource types that still attempt to run commands during +# prefetch, etc. +class Puppet::Provider::Noop < Puppet::Provider + + def create + true + end + + def destroy + true + end + + def exists? + false + end + + # some puppet-keystone resources require this + def self.resource_to_name(domain, name, check_for_default = true) + return name + end + +end + +module Puppet::Parser::Functions + newfunction(:noop_resource, :type => :rvalue, :doc => "Create a default noop provider for the specified resource.") do |arg| + if arg[0].class == String + Puppet::Type.type(arg[0].downcase.to_sym).provide(:noop, :parent => Puppet::Provider::Noop) do + defaultfor :osfamily => :redhat + end + else + end + return true + end +end diff --git a/manifests/fencing.pp b/manifests/fencing.pp index 55280a9..fa8c2e5 100644 --- a/manifests/fencing.pp +++ b/manifests/fencing.pp @@ -59,4 +59,7 @@ class tripleo::fencing( $ipmilan_devices = local_fence_devices('fence_ipmilan', $all_devices) create_resources('pacemaker::stonith::fence_ipmilan', $ipmilan_devices, $common_params) + + $ironic_devices = local_fence_devices('fence_ironic', $all_devices) + create_resources('pacemaker::stonith::fence_ironic', $ironic_devices, $common_params) } diff --git a/manifests/haproxy.pp b/manifests/haproxy.pp index 81ef0a6..4bbe1d6 100644 --- a/manifests/haproxy.pp +++ b/manifests/haproxy.pp @@ -159,10 +159,6 @@ # (optional) Enable or not Glance API binding # Defaults to hiera('glance_api_enabled', false) # -# [*glance_registry*] -# (optional) Enable or not Glance registry binding -# Defaults to hiera('glance_registry_enabled', false) -# # [*nova_osapi*] # (optional) Enable or not Nova API binding # Defaults to hiera('nova_api_enabled', false) @@ -332,10 +328,6 @@ # (optional) Specify the network glance_api is running on. # Defaults to hiera('glance_api_network', undef) # -# [*glance_registry_network*] -# (optional) Specify the network glance_registry is running on. -# Defaults to hiera('glance_registry_network', undef) -# # [*gnocchi_network*] # (optional) Specify the network gnocchi is running on. # Defaults to hiera('gnocchi_api_network', undef) @@ -447,7 +439,6 @@ # 'docker_registry_ssl_port' (Defaults to 13787) # 'glance_api_port' (Defaults to 9292) # 'glance_api_ssl_port' (Defaults to 13292) -# 'glance_registry_port' (Defaults to 9191) # 'gnocchi_api_port' (Defaults to 8041) # 'gnocchi_api_ssl_port' (Defaults to 13041) # 'mistral_api_port' (Defaults to 8989) @@ -528,7 +519,6 @@ class tripleo::haproxy ( $sahara = hiera('sahara_api_enabled', false), $trove = hiera('trove_api_enabled', false), $glance_api = hiera('glance_api_enabled', false), - $glance_registry = hiera('glance_registry_enabled', false), $nova_osapi = hiera('nova_api_enabled', false), $nova_placement = hiera('nova_placement_enabled', false), $nova_metadata = hiera('nova_api_enabled', false), @@ -570,7 +560,6 @@ class tripleo::haproxy ( $cinder_network = hiera('cinder_api_network', undef), $docker_registry_network = hiera('docker_registry_network', undef), $glance_api_network = hiera('glance_api_network', undef), - $glance_registry_network = hiera('glance_registry_network', undef), $gnocchi_network = hiera('gnocchi_api_network', undef), $heat_api_network = hiera('heat_api_network', undef), $heat_cfn_network = hiera('heat_api_cfn_network', undef), @@ -609,7 +598,6 @@ class tripleo::haproxy ( docker_registry_ssl_port => 13787, glance_api_port => 9292, glance_api_ssl_port => 13292, - glance_registry_port => 9191, gnocchi_api_port => 8041, gnocchi_api_ssl_port => 13041, mistral_api_port => 8989, @@ -945,16 +933,6 @@ class tripleo::haproxy ( } } - if $glance_registry { - ::tripleo::haproxy::endpoint { 'glance_registry': - internal_ip => hiera('glance_registry_vip', $controller_virtual_ip), - service_port => $ports[glance_registry_port], - ip_addresses => hiera('glance_registry_node_ips', $controller_hosts_real), - server_names => hiera('glance_registry_node_names', $controller_hosts_names_real), - service_network => $glance_registry_network, - } - } - $nova_api_vip = hiera('nova_api_vip', $controller_virtual_ip) if $nova_osapi { ::tripleo::haproxy::endpoint { 'nova_osapi': @@ -1301,6 +1279,15 @@ class tripleo::haproxy ( server_names => hiera('mysql_node_names', $controller_hosts_names_real), options => $mysql_member_options_real, } + if hiera('manage_firewall', true) { + include ::tripleo::firewall + $mysql_firewall_rules = { + '100 mysql_haproxy' => { + 'dport' => 3306, + } + } + create_resources('tripleo::firewall::rule', $mysql_firewall_rules) + } } if $rabbitmq { @@ -1377,6 +1364,15 @@ class tripleo::haproxy ( server_names => hiera('redis_node_names', $controller_hosts_names_real), options => $haproxy_member_options, } + if hiera('manage_firewall', true) { + include ::tripleo::firewall + $redis_firewall_rules = { + '100 redis_haproxy' => { + 'dport' => 6379, + } + } + create_resources('tripleo::firewall::rule', $redis_firewall_rules) + } } $midonet_cluster_vip = hiera('midonet_cluster_vip', $controller_virtual_ip) diff --git a/manifests/haproxy/endpoint.pp b/manifests/haproxy/endpoint.pp index 2f60b24..da2aba3 100644 --- a/manifests/haproxy/endpoint.pp +++ b/manifests/haproxy/endpoint.pp @@ -36,7 +36,7 @@ # # [*public_virtual_ip*] # Address in which the proxy endpoint will be listening in the public network. -# If this service is internal only this should be ommited. +# If this service is internal only this should be ommitted. # Defaults to undef. # # [*mode*] diff --git a/manifests/profile/base/cinder.pp b/manifests/profile/base/cinder.pp index 6a821f3..6e8fbb2 100644 --- a/manifests/profile/base/cinder.pp +++ b/manifests/profile/base/cinder.pp @@ -57,6 +57,7 @@ class tripleo::profile::base::cinder ( rabbit_hosts => $rabbit_endpoints, } include ::cinder::config + include ::cinder::glance } if $step >= 5 { diff --git a/manifests/profile/base/cinder/api.pp b/manifests/profile/base/cinder/api.pp index 5ea2058..450a8e6 100644 --- a/manifests/profile/base/cinder/api.pp +++ b/manifests/profile/base/cinder/api.pp @@ -94,7 +94,6 @@ class tripleo::profile::base::cinder::api ( ssl_key => $tls_keyfile, } include ::cinder::ceilometer - include ::cinder::glance } } diff --git a/manifests/profile/base/glance/registry.pp b/manifests/profile/base/glance/registry.pp deleted file mode 100644 index cd40aeb..0000000 --- a/manifests/profile/base/glance/registry.pp +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2016 Red Hat, 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: tripleo::profile::base::glance::registry -# -# Glance Registry profile for tripleo -# -# === Parameters -# -# [*bootstrap_node*] -# DEPRECATED -# (Optional) The hostname of the node responsible for bootstrapping tasks -# Defaults to hiera('bootstrap_nodeid') -# -# [*glance_backend*] -# (Optional) Glance backend(s) to use. -# Defaults to downcase(hiera('glance_backend', 'swift')) -# -# [*step*] -# (Optional) The current step in deployment. See tripleo-heat-templates -# for more details. -# Defaults to hiera('step') -# -class tripleo::profile::base::glance::registry ( - $bootstrap_node = undef, - $glance_backend = downcase(hiera('glance_backend', 'swift')), - $step = hiera('step'), -) { - - if $step >= 4 { - # TODO: notifications, scrubber, etc. - include ::glance - include ::glance::config - include ::glance::registry - include ::glance::notify::rabbitmq - include join(['::glance::backend::', $glance_backend]) - } - -} diff --git a/manifests/profile/base/nova.pp b/manifests/profile/base/nova.pp index dae627c..fe1e6a6 100644 --- a/manifests/profile/base/nova.pp +++ b/manifests/profile/base/nova.pp @@ -110,6 +110,7 @@ class tripleo::profile::base::nova ( } if $step >= 4 { + include ::nova::placement if $manage_migration { class { '::nova::migration::libvirt': configure_libvirt => $libvirt_enabled, diff --git a/manifests/profile/base/nova/placement.pp b/manifests/profile/base/nova/placement.pp index 7edd4e8..aa8c3c7 100644 --- a/manifests/profile/base/nova/placement.pp +++ b/manifests/profile/base/nova/placement.pp @@ -86,8 +86,6 @@ class tripleo::profile::base::nova::placement ( } if $step >= 4 { - include ::nova::placement - class { '::nova::wsgi::apache_placement': ssl_cert => $tls_certfile, ssl_key => $tls_keyfile, diff --git a/manifests/profile/pacemaker/ceph/rbdmirror.pp b/manifests/profile/pacemaker/ceph/rbdmirror.pp new file mode 100644 index 0000000..8e2ff77 --- /dev/null +++ b/manifests/profile/pacemaker/ceph/rbdmirror.pp @@ -0,0 +1,77 @@ +# Copyright 2016 Red Hat, 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: tripleo::profile::pacemaker::ceph::rbdmirror +# +# Ceph RBD mirror Pacemaker profile for tripleo +# +# === Parameters +# +# [*bootstrap_node*] +# (Optional) The hostname of the node responsible for bootstrapping tasks +# Defaults to hiera('ceph_rbdmirror_bootstrap_short_node_name') +# +# [*client_name*] +# (Optional) Name assigned to the RBD mirror client +# Defaults to 'rbd-mirror' +# +# [*stack_action*] +# (Optional) Action executed on the stack. See tripleo-heat-templates +# for more details. +# Defaults to hiera('stack_action') +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +class tripleo::profile::pacemaker::ceph::rbdmirror ( + $bootstrap_node = hiera('ceph_rbdmirror_bootstrap_short_node_name'), + $client_name = 'openstack', + $stack_action = hiera('stack_action'), + $step = hiera('step'), +) { + Service <| tag == 'ceph-rbd-mirror' |> { + hasrestart => true, + restart => '/bin/true', + start => '/bin/true', + stop => '/bin/true', + } + + if $::hostname == downcase($bootstrap_node) { + $pacemaker_master = true + } else { + $pacemaker_master = false + } + + include ::tripleo::profile::base::ceph + + if $step >= 3 { + ceph::mirror { $client_name: + rbd_mirror_enable => false, + rbd_mirror_ensure => 'stopped', + } -> + pacemaker::resource::service { "ceph-rbd-mirror_${client_name}": + # NOTE(gfidente): systemd uses the @ sign but it is an invalid + # character in a pcmk resource name, so we need to use it only + # for the name of the service + service_name => "ceph-rbd-mirror@${client_name}" + } + } + + if $step >= 3 and $pacemaker_master and $stack_action == 'UPDATE' { + Ceph_config<||> ~> Tripleo::Pacemaker::Resource_restart_flag["ceph-rbd-mirror@${client_name}"] + tripleo::pacemaker::resource_restart_flag { "ceph-rbd-mirror@${client_name}": } + } +} diff --git a/spec/classes/tripleo_profile_base_cinder_api_spec.rb b/spec/classes/tripleo_profile_base_cinder_api_spec.rb index a0c607d..6a36632 100644 --- a/spec/classes/tripleo_profile_base_cinder_api_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_api_spec.rb @@ -30,7 +30,6 @@ describe 'tripleo::profile::base::cinder::api' do is_expected.to contain_class('tripleo::profile::base::cinder') is_expected.to_not contain_class('cinder::api') is_expected.to_not contain_class('cinder::ceilometer') - is_expected.to_not contain_class('cinder::glance') end end @@ -43,7 +42,6 @@ describe 'tripleo::profile::base::cinder::api' do it 'should trigger complete configuration' do is_expected.to contain_class('cinder::api') is_expected.to contain_class('cinder::ceilometer') - is_expected.to contain_class('cinder::glance') end end @@ -56,7 +54,6 @@ describe 'tripleo::profile::base::cinder::api' do it 'should not trigger any configuration' do is_expected.to_not contain_class('cinder::api') is_expected.to_not contain_class('cinder::ceilometer') - is_expected.to_not contain_class('cinder::glance') end end @@ -68,7 +65,6 @@ describe 'tripleo::profile::base::cinder::api' do it 'should trigger complete configuration' do is_expected.to contain_class('cinder::api') is_expected.to contain_class('cinder::ceilometer') - is_expected.to contain_class('cinder::glance') end end end diff --git a/spec/classes/tripleo_profile_base_cinder_spec.rb b/spec/classes/tripleo_profile_base_cinder_spec.rb index 6a36152..81fa047 100644 --- a/spec/classes/tripleo_profile_base_cinder_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_spec.rb @@ -24,6 +24,7 @@ describe 'tripleo::profile::base::cinder' do is_expected.to contain_class('tripleo::profile::base::cinder') is_expected.to_not contain_class('cinder') is_expected.to_not contain_class('cinder::config') + is_expected.to_not contain_class('cinder::glance') is_expected.to_not contain_class('cinder:::cron::db_purge') end end @@ -41,6 +42,7 @@ describe 'tripleo::profile::base::cinder' do :rabbit_hosts => params[:rabbit_hosts].map{ |h| "#{h}:#{params[:rabbit_port]}" } ) is_expected.to contain_class('cinder::config') + is_expected.to contain_class('cinder::glance') is_expected.to_not contain_class('cinder::cron::db_purge') end end @@ -54,6 +56,7 @@ describe 'tripleo::profile::base::cinder' do it 'should not trigger any configuration' do is_expected.to_not contain_class('cinder') is_expected.to_not contain_class('cinder::config') + is_expected.to_not contain_class('cinder::glance') is_expected.to_not contain_class('cinder:::cron::db_purge') end end @@ -71,6 +74,7 @@ describe 'tripleo::profile::base::cinder' do :rabbit_hosts => params[:rabbit_hosts].map{ |h| "#{h}:#{params[:rabbit_port]}" } ) is_expected.to contain_class('cinder::config') + is_expected.to contain_class('cinder::glance') is_expected.to_not contain_class('cinder:::cron::db_purge') end end @@ -87,6 +91,7 @@ describe 'tripleo::profile::base::cinder' do :rabbit_hosts => params[:rabbit_hosts].map{ |h| "#{h}:5672" } ) is_expected.to contain_class('cinder::config') + is_expected.to contain_class('cinder::glance') is_expected.to contain_class('cinder::cron::db_purge') end end @@ -104,6 +109,7 @@ describe 'tripleo::profile::base::cinder' do :rabbit_hosts => params[:rabbit_hosts].map{ |h| "#{h}:5672" } ) is_expected.to contain_class('cinder::config') + is_expected.to contain_class('cinder::glance') is_expected.to_not contain_class('cinder::cron::db_purge') end end diff --git a/spec/classes/tripleo_profile_pacemaker_ceph_rbdmirror_spec.rp b/spec/classes/tripleo_profile_pacemaker_ceph_rbdmirror_spec.rp new file mode 100644 index 0000000..4df0a09 --- /dev/null +++ b/spec/classes/tripleo_profile_pacemaker_ceph_rbdmirror_spec.rp @@ -0,0 +1,64 @@ +# +# Copyright (C) 2016 Red Hat, 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. +# + +require 'spec_helper' + +describe 'tripleo::profile::pacemaker::ceph::rbdmirror' do + shared_examples_for 'tripleo::profile::pacemaker::ceph::rbdmirror' do + let (:pre_condition) do + <<-eof + class { '::tripleo::profile::base::ceph': + step => #{params[:step]} + } + eof + end + + context 'with step less than 3' do + let(:params) { { :step => 2 } } + it 'should do nothing' do + is_expected.to contain_class('tripleo::profile::base::ceph') + is_expected.to_not contain_class('ceph::mirror') + end + end + + context 'with step 3 and client_name' do + let(:params) { { + :step => 3, + :client_name => 'myname', + } } + + it 'should include rbdmirror configuration' do + is_expected.to contain_class('tripleo::profile::base::ceph') + is_expected.to contain_class('ceph::rbdmirror').with( + :rbd_mirror_enable => false, + :rbd_mirror_ensure => 'stopped', + ) + is_expected.to contain_class('pacemaker::resource::service') + end + end + + end + + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) do + facts.merge({ :hostname => 'node.example.com' }) + end + + it_behaves_like 'tripleo::profile::pacemaker::ceph::rbdmirror' + end + end +end |