Merge "Redis required for designate central service"
This commit is contained in:
commit
109e86483c
|
@ -48,7 +48,10 @@ class tripleo::profile::base::designate::central (
|
|||
if $pools_file_content {
|
||||
warning('pool file content is no longer manually configurable')
|
||||
}
|
||||
|
||||
include tripleo::profile::base::designate
|
||||
include tripleo::profile::base::designate::coordination
|
||||
|
||||
if ($step >= 4 or ($step >= 3 and $sync_db)) {
|
||||
class { 'designate::db':
|
||||
sync_db => $sync_db,
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
# Copyright 2022 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::designate::coordination
|
||||
#
|
||||
# Designate Coordination profile for tripleo for setting coordination/redis
|
||||
# related configuration.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*step*]
|
||||
# (Optional) The current step in deployment. See tripleo-heat-templates
|
||||
# for more details.
|
||||
# Defaults to hiera('step')
|
||||
#
|
||||
# [*designate_redis_password*]
|
||||
# (Optional) Password for the neutron redis user for the coordination url
|
||||
# Defaults to hiera('designate_redis_password', undef),
|
||||
#
|
||||
# [*redis_vip*]
|
||||
# (Optional) Redis ip address for the coordination url
|
||||
# Defaults to hiera('redis_vip', undef),
|
||||
#
|
||||
# [*enable_internal_tls*]
|
||||
# (Optional) Whether TLS in the internal network is enabled or not.
|
||||
# Defaults to hiera('enable_internal_tls', false)
|
||||
#
|
||||
class tripleo::profile::base::designate::coordination (
|
||||
$step = Integer(hiera('step')),
|
||||
$designate_redis_password = hiera('designate_redis_password', undef),
|
||||
$redis_vip = hiera('redis_vip', undef),
|
||||
$enable_internal_tls = hiera('enable_internal_tls', false),
|
||||
) {
|
||||
if $step >= 4 {
|
||||
if $redis_vip {
|
||||
if $enable_internal_tls {
|
||||
$tls_query_param = '?ssl=true'
|
||||
} else {
|
||||
$tls_query_param = ''
|
||||
}
|
||||
class { 'designate::coordination':
|
||||
backend_url => join(['redis://:', $designate_redis_password, '@', normalize_ip_for_uri($redis_vip), ':6379/', $tls_query_param])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,36 +18,16 @@
|
|||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*designate_redis_password*]
|
||||
# (Optional) Password for the neutron redis user for the coordination url
|
||||
# Defaults to hiera('designate_redis_password', undef),
|
||||
#
|
||||
# [*redis_vip*]
|
||||
# (Optional) Redis ip address for the coordination url
|
||||
# Defaults to hiera('redis_vip', undef),
|
||||
#
|
||||
# [*enable_internal_tls*]
|
||||
# (Optional) Whether TLS in the internal network is enabled or not.
|
||||
# Defaults to hiera('enable_internal_tls', false)
|
||||
#
|
||||
# [*step*]
|
||||
# (Optional) The current step in deployment. See tripleo-heat-templates
|
||||
# for more details.
|
||||
# Defaults to hiera('step')
|
||||
#
|
||||
class tripleo::profile::base::designate::producer (
|
||||
$designate_redis_password = hiera('designate_redis_password', undef),
|
||||
$redis_vip = hiera('redis_vip', undef),
|
||||
$enable_internal_tls = hiera('enable_internal_tls', false),
|
||||
$step = Integer(hiera('step')),
|
||||
$step = Integer(hiera('step')),
|
||||
) {
|
||||
include tripleo::profile::base::designate
|
||||
|
||||
if $enable_internal_tls {
|
||||
$tls_query_param = '?ssl=true'
|
||||
} else {
|
||||
$tls_query_param = ''
|
||||
}
|
||||
include tripleo::profile::base::designate::coordination
|
||||
|
||||
if $step >= 4 {
|
||||
include designate::producer
|
||||
|
@ -56,10 +36,5 @@ class tripleo::profile::base::designate::producer (
|
|||
include designate::producer_task::periodic_secondary_refresh
|
||||
include designate::producer_task::worker_periodic_recovery
|
||||
include designate::producer_task::zone_purge
|
||||
if $redis_vip {
|
||||
class { 'designate::coordination':
|
||||
backend_url => join(['redis://:', $designate_redis_password, '@', normalize_ip_for_uri($redis_vip), ':6379/', $tls_query_param])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ describe 'tripleo::profile::base::designate::central' do
|
|||
oslomsg_rpc_username => 'designate',
|
||||
oslomsg_rpc_password => 'foo'
|
||||
}
|
||||
class { 'tripleo::profile::base::designate::authtoken':
|
||||
class { 'tripleo::profile::base::designate::coordination':
|
||||
step => #{params[:step]},
|
||||
}
|
||||
eos
|
||||
|
@ -40,6 +40,7 @@ eos
|
|||
it {
|
||||
is_expected.to contain_class('tripleo::profile::base::designate::central')
|
||||
is_expected.to contain_class('tripleo::profile::base::designate')
|
||||
is_expected.to contain_class('tripleo::profile::base::designate::coordination')
|
||||
is_expected.to_not contain_class('designate::db')
|
||||
is_expected.to_not contain_class('designate::central')
|
||||
is_expected.to_not contain_class('designate::quota')
|
||||
|
@ -56,7 +57,10 @@ eos
|
|||
it {
|
||||
is_expected.to contain_class('tripleo::profile::base::designate::central')
|
||||
is_expected.to contain_class('tripleo::profile::base::designate')
|
||||
is_expected.to contain_class('designate::db').with(:sync_db => true)
|
||||
is_expected.to contain_class('tripleo::profile::base::designate::coordination')
|
||||
is_expected.to contain_class('designate::db').with(
|
||||
:sync_db => true
|
||||
)
|
||||
is_expected.to contain_class('designate::central')
|
||||
is_expected.to contain_class('designate::quota')
|
||||
is_expected.to contain_class('designate::network_api::neutron')
|
||||
|
@ -72,6 +76,7 @@ eos
|
|||
it {
|
||||
is_expected.to contain_class('tripleo::profile::base::designate::central')
|
||||
is_expected.to contain_class('tripleo::profile::base::designate')
|
||||
is_expected.to contain_class('tripleo::profile::base::designate::coordination')
|
||||
is_expected.to_not contain_class('designate::db')
|
||||
is_expected.to_not contain_class('designate::central')
|
||||
is_expected.to_not contain_class('designate::quota')
|
||||
|
@ -94,6 +99,7 @@ eos
|
|||
it {
|
||||
is_expected.to contain_class('tripleo::profile::base::designate::central')
|
||||
is_expected.to contain_class('tripleo::profile::base::designate')
|
||||
is_expected.to contain_class('tripleo::profile::base::designate::coordination')
|
||||
is_expected.to contain_class('designate::db').with(
|
||||
:sync_db => false
|
||||
)
|
||||
|
@ -105,7 +111,6 @@ eos
|
|||
|
||||
end
|
||||
|
||||
|
||||
on_supported_os.each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) do
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
#
|
||||
# Copyright (C) 2022 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::base::designate::coordination' do
|
||||
shared_examples_for 'tripleo::profile::base::designate::coordination' do
|
||||
context 'with step less than 4' do
|
||||
let(:params) { {
|
||||
:step => 3,
|
||||
:designate_redis_password => 'a_redis_password',
|
||||
:redis_vip => '192.0.2.1',
|
||||
} }
|
||||
it {
|
||||
is_expected.to_not contain_class('designate::coordination')
|
||||
}
|
||||
end
|
||||
|
||||
context 'with step 4 and without a redis vip' do
|
||||
let(:params) { {
|
||||
:step => 4,
|
||||
:designate_redis_password => 'a_redis_password',
|
||||
# NOTE(tkajinam): Currently redis_vip is defined in test hieradata.
|
||||
# Here we override the parameter to test the logic used
|
||||
# when redis_vip is not set.
|
||||
:redis_vip => false,
|
||||
} }
|
||||
it {
|
||||
is_expected.to_not contain_class('designate::coordination')
|
||||
}
|
||||
end
|
||||
|
||||
context 'with step 4 and a typical configuration no tls' do
|
||||
let(:params) { {
|
||||
:step => 4,
|
||||
:designate_redis_password => 'a_redis_password',
|
||||
:redis_vip => '192.0.2.1',
|
||||
} }
|
||||
it {
|
||||
is_expected.to contain_class('designate::coordination').with(
|
||||
:backend_url => 'redis://:a_redis_password@192.0.2.1:6379/'
|
||||
)
|
||||
}
|
||||
end
|
||||
|
||||
context 'with 4 and a typical configuration tls enabled' do
|
||||
let(:params) { {
|
||||
:step => 4,
|
||||
:designate_redis_password => 'a_redis_password',
|
||||
:redis_vip => '192.0.2.1',
|
||||
:enable_internal_tls => true
|
||||
} }
|
||||
it {
|
||||
is_expected.to contain_class('designate::coordination').with(
|
||||
:backend_url => 'redis://:a_redis_password@192.0.2.1:6379/?ssl=true'
|
||||
)
|
||||
}
|
||||
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::base::designate::coordination'
|
||||
end
|
||||
end
|
||||
end
|
|
@ -26,20 +26,21 @@ describe 'tripleo::profile::base::designate::producer' do
|
|||
oslomsg_rpc_username => 'designate',
|
||||
oslomsg_rpc_password => 'foo'
|
||||
}
|
||||
class { 'tripleo::profile::base::designate::coordination':
|
||||
step => #{params[:step]},
|
||||
}
|
||||
eos
|
||||
end
|
||||
|
||||
context 'with step less than 4' do
|
||||
let(:params) { {
|
||||
:designate_redis_password => 'password',
|
||||
:redis_vip => '127.0.0.1',
|
||||
:step => 1,
|
||||
:step => 1,
|
||||
} }
|
||||
|
||||
it {
|
||||
is_expected.to contain_class('tripleo::profile::base::designate::producer')
|
||||
is_expected.to contain_class('tripleo::profile::base::designate')
|
||||
is_expected.to_not contain_class('designate::coordination')
|
||||
is_expected.to contain_class('tripleo::profile::base::designate::coordination')
|
||||
is_expected.to_not contain_class('designate::producer')
|
||||
is_expected.to_not contain_class('designate::producer_task::delayed_notify')
|
||||
is_expected.to_not contain_class('designate::producer_task::periodic_exists')
|
||||
|
@ -51,37 +52,13 @@ eos
|
|||
|
||||
context 'with step 4' do
|
||||
let(:params) { {
|
||||
:designate_redis_password => 'password',
|
||||
:redis_vip => '127.0.0.1',
|
||||
:step => 4,
|
||||
:step => 4,
|
||||
} }
|
||||
|
||||
it {
|
||||
is_expected.to contain_class('tripleo::profile::base::designate::producer')
|
||||
is_expected.to contain_class('tripleo::profile::base::designate')
|
||||
is_expected.to contain_class('designate::coordination').with(
|
||||
:backend_url => 'redis://:password@127.0.0.1:6379/',
|
||||
)
|
||||
is_expected.to contain_class('designate::producer')
|
||||
is_expected.to contain_class('designate::producer_task::delayed_notify')
|
||||
is_expected.to contain_class('designate::producer_task::periodic_exists')
|
||||
is_expected.to contain_class('designate::producer_task::periodic_secondary_refresh')
|
||||
is_expected.to contain_class('designate::producer_task::worker_periodic_recovery')
|
||||
is_expected.to contain_class('designate::producer_task::zone_purge')
|
||||
}
|
||||
end
|
||||
|
||||
context 'with step 4 without redis_vip' do
|
||||
let(:params) { {
|
||||
:designate_redis_password => 'password',
|
||||
:redis_vip => false,
|
||||
:step => 4,
|
||||
} }
|
||||
|
||||
it {
|
||||
is_expected.to contain_class('tripleo::profile::base::designate::producer')
|
||||
is_expected.to contain_class('tripleo::profile::base::designate')
|
||||
is_expected.to_not contain_class('designate::coordination')
|
||||
is_expected.to contain_class('tripleo::profile::base::designate::coordination')
|
||||
is_expected.to contain_class('designate::producer')
|
||||
is_expected.to contain_class('designate::producer_task::delayed_notify')
|
||||
is_expected.to contain_class('designate::producer_task::periodic_exists')
|
||||
|
@ -92,7 +69,6 @@ eos
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
on_supported_os.each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) do
|
||||
|
|
Loading…
Reference in New Issue