Use oslo::coordination to manage coordination parameters
This change replaces current implementation to manage coordination parameters by the base class in puppet-oslo. With this change the required backend package is installed according to the backend driver used. Depends-on: https://review.opendev.org/791628 Change-Id: I5c2653475bbbf6dc0a9ce795958fd884bcdf13e8
This commit is contained in:
parent
b89a7dc5bc
commit
298c6ec174
32
manifests/coordination.pp
Normal file
32
manifests/coordination.pp
Normal file
@ -0,0 +1,32 @@
|
||||
# == Class: mistral::coordination
|
||||
#
|
||||
# Setup and configure Mistral coordination settings.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*backend_url*]
|
||||
# (Optional) Coordination backend URL.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*heartbeat_interval*]
|
||||
# (Optional) Number of seconds between hearbeats for coordintation.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
class mistral::coordination (
|
||||
$backend_url = $::os_service_default,
|
||||
$heartbeat_interval = $::os_service_default,
|
||||
) {
|
||||
|
||||
include mistral::deps
|
||||
|
||||
$backend_url_real = pick($::mistral::coordination_backend_url, $backend_url)
|
||||
$heartbeat_interval_real = pick($::mistral::coordination_heartbeat_interval, $heartbeat_interval)
|
||||
|
||||
oslo::coordination{ 'mistral_config':
|
||||
backend_url => $backend_url_real
|
||||
}
|
||||
|
||||
mistral_config {
|
||||
'coordination/heartbeat_interval': value => $heartbeat_interval_real;
|
||||
}
|
||||
}
|
@ -120,14 +120,6 @@
|
||||
# (Optional) Seconds to wait for a response from a call. (integer value)
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*coordination_backend_url*]
|
||||
# (optional) The backend URL to be used for coordination.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*coordination_heartbeat_interval*]
|
||||
# (optional) Number of seconds between heartbeats for coordination.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*purge_config*]
|
||||
# (optional) Whether to set only the specified config options
|
||||
# in the mistral config.
|
||||
@ -166,6 +158,14 @@
|
||||
# (optional) Url used to connect to database.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*coordination_backend_url*]
|
||||
# (optional) The backend URL to be used for coordination.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*coordination_heartbeat_interval*]
|
||||
# (optional) Number of seconds between heartbeats for coordination.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
class mistral(
|
||||
$package_ensure = 'present',
|
||||
$os_actions_endpoint_type = $::os_service_default,
|
||||
@ -189,8 +189,6 @@ class mistral(
|
||||
$kombu_ssl_version = $::os_service_default,
|
||||
$kombu_reconnect_delay = $::os_service_default,
|
||||
$amqp_durable_queues = $::os_service_default,
|
||||
$coordination_backend_url = $::os_service_default,
|
||||
$coordination_heartbeat_interval = $::os_service_default,
|
||||
$purge_config = false,
|
||||
$sync_db = true,
|
||||
$max_missed_heartbeats = $::os_service_default,
|
||||
@ -198,6 +196,8 @@ class mistral(
|
||||
$first_heartbeat_timeout = $::os_service_default,
|
||||
# DEPRECATED PARAMETERS
|
||||
$database_connection = undef,
|
||||
$coordination_backend_url = undef,
|
||||
$coordination_heartbeat_interval = undef,
|
||||
){
|
||||
|
||||
include mistral::deps
|
||||
@ -209,6 +209,11 @@ class mistral(
|
||||
removed in a future realse. Use mistral::db::database_connection instead')
|
||||
}
|
||||
|
||||
if $coordination_backend_url != undef or $coordination_heartbeat_interval != undef {
|
||||
warning('The mistral::coordination_* parameters are deprecated. Use mistral::coordination instead')
|
||||
include mistral::coordination
|
||||
}
|
||||
|
||||
package { 'mistral-common':
|
||||
ensure => $package_ensure,
|
||||
name => $::mistral::params::common_package_name,
|
||||
@ -220,8 +225,6 @@ removed in a future realse. Use mistral::db::database_connection instead')
|
||||
}
|
||||
|
||||
mistral_config {
|
||||
'coordination/backend_url': value => $coordination_backend_url;
|
||||
'coordination/heartbeat_interval': value => $coordination_heartbeat_interval;
|
||||
'DEFAULT/report_interval': value => $report_interval;
|
||||
'DEFAULT/service_down_time': value => $service_down_time;
|
||||
'action_heartbeat/max_missed_heartbeats': value => $max_missed_heartbeats;
|
||||
|
12
releasenotes/notes/coordination-6da1ae2202029007.yaml
Normal file
12
releasenotes/notes/coordination-6da1ae2202029007.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The new ``mistral::coordination`` class has been added.
|
||||
|
||||
deprecations:
|
||||
- |
|
||||
The following parameters have been deprecated in favor of the new
|
||||
``mistral::coordination`` class.
|
||||
|
||||
- ``mistral::coordination_backend_url``
|
||||
- ``mistral::coordination_heartbeat_interval``
|
42
spec/classes/mistral_coordination_spec.rb
Normal file
42
spec/classes/mistral_coordination_spec.rb
Normal file
@ -0,0 +1,42 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'mistral::coordination' do
|
||||
shared_examples 'mistral::coordination' do
|
||||
context 'with default parameters' do
|
||||
it {
|
||||
is_expected.to contain_oslo__coordination('mistral_config').with(
|
||||
:backend_url => '<SERVICE DEFAULT>'
|
||||
)
|
||||
is_expected.to contain_mistral_config('coordination/heartbeat_interval').with_value('<SERVICE DEFAULT>')
|
||||
}
|
||||
end
|
||||
|
||||
context 'with specified parameters' do
|
||||
let :params do
|
||||
{
|
||||
:backend_url => 'etcd3+http://127.0.0.1:2379',
|
||||
:heartbeat_interval => 5.0,
|
||||
}
|
||||
end
|
||||
|
||||
it {
|
||||
is_expected.to contain_oslo__coordination('mistral_config').with(
|
||||
:backend_url => 'etcd3+http://127.0.0.1:2379'
|
||||
)
|
||||
is_expected.to contain_mistral_config('coordination/heartbeat_interval').with_value(5.0)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_behaves_like 'mistral::coordination'
|
||||
end
|
||||
end
|
||||
end
|
@ -45,8 +45,6 @@ describe 'mistral' do
|
||||
should contain_mistral_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value('<SERVICE DEFAULT>')
|
||||
should contain_mistral_config('oslo_messaging_rabbit/kombu_reconnect_delay').with(:value => '<SERVICE DEFAULT>')
|
||||
should contain_mistral_config('oslo_messaging_rabbit/kombu_failover_strategy').with(:value => '<SERVICE DEFAULT>')
|
||||
should contain_mistral_config('coordination/backend_url').with(:value => '<SERVICE DEFAULT>')
|
||||
should contain_mistral_config('coordination/heartbeat_interval').with(:value => '<SERVICE DEFAULT>')
|
||||
should contain_mistral_config('keystone_authtoken/www_authenticate_uri').with(
|
||||
:value => 'http://localhost:5000'
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user