Merge "Support more [orchestrator] parameters"
This commit is contained in:
commit
142fbc37fc
@ -31,6 +31,10 @@ class cloudkitty::deps {
|
||||
-> Cloudkitty_api_paste_ini<||>
|
||||
~> Anchor['cloudkitty::config::end']
|
||||
|
||||
# all coordination settings should be applied and all packages should be
|
||||
# installed before service startup
|
||||
Oslo::Coordination<||> -> Anchor['cloudkitty::service::begin']
|
||||
|
||||
# all db settings should be applied and all packages should be installed
|
||||
# before dbsync starts
|
||||
Oslo::Db<||> -> Anchor['cloudkitty::dbsync::begin']
|
||||
|
39
manifests/orchestrator.pp
Normal file
39
manifests/orchestrator.pp
Normal file
@ -0,0 +1,39 @@
|
||||
# == Class: cloudkitty::orchestrator
|
||||
#
|
||||
# Setup and configure Cloudkitty orchestrator settings.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*coordination_url*]
|
||||
# (Optional) Coordination backend URL.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*max_workers*]
|
||||
# (Optional) Maximal number of workers to run.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*max_threads*]
|
||||
# (Optional) Maximal numer of threads to use per worker.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
class cloudkitty::orchestrator (
|
||||
$coordination_url = $::os_service_default,
|
||||
$max_workers = $::os_service_default,
|
||||
$max_threads = $::os_service_default
|
||||
) {
|
||||
|
||||
include cloudkitty::deps
|
||||
|
||||
$max_workers_real = pick($::cloudkitty::processor::max_workers, $max_workers)
|
||||
|
||||
oslo::coordination{ 'cloudkitty_config':
|
||||
backend_url => $coordination_url,
|
||||
manage_config => false,
|
||||
}
|
||||
|
||||
cloudkitty_config {
|
||||
'orchestrator/coordination_url': value => $coordination_url;
|
||||
'orchestrator/max_workers': value => $max_workers_real;
|
||||
'orchestrator/max_threads': value => $max_threads;
|
||||
}
|
||||
}
|
@ -52,6 +52,8 @@
|
||||
# (optional) Endpoint URL type
|
||||
# Default to $::os_service_default
|
||||
#
|
||||
# DEPRECATED PARAMETERS
|
||||
#
|
||||
# [*max_workers*]
|
||||
# (optional) Number of max workers for processor
|
||||
# Default to $::os_service_default
|
||||
@ -69,12 +71,18 @@ class cloudkitty::processor (
|
||||
$auth_section = 'keystone_authtoken',
|
||||
$region_name = $::os_service_default,
|
||||
$interface = $::os_service_default,
|
||||
$max_workers = $::os_service_default,
|
||||
# DEPRECATED PARAMETERS
|
||||
$max_workers = undef,
|
||||
) {
|
||||
|
||||
include cloudkitty::deps
|
||||
include cloudkitty::params
|
||||
|
||||
if $max_workers != undef {
|
||||
warning('The max_workers parameter is deprecated. Use the cloudkitty::orchestrator class.')
|
||||
}
|
||||
include cloudkitty::orchestrator
|
||||
|
||||
package { 'cloudkitty-processor':
|
||||
ensure => $package_ensure,
|
||||
name => $::cloudkitty::params::processor_package_name,
|
||||
@ -116,7 +124,6 @@ class cloudkitty::processor (
|
||||
'collector_gnocchi/auth_section': value => $auth_section;
|
||||
'collector_gnocchi/region_name': value => $region_name;
|
||||
'collector_gnocchi/interface': value => $interface;
|
||||
'orchestrator/max_workers': value => $max_workers;
|
||||
}
|
||||
|
||||
}
|
||||
|
9
releasenotes/notes/orchestrator-2f9ead1187266db8.yaml
Normal file
9
releasenotes/notes/orchestrator-2f9ead1187266db8.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The new ``cloudkitty::orchestrator`` class has been added.
|
||||
|
||||
deprecations:
|
||||
- |
|
||||
The ``cloudkitty::processor::max_workers`` parameter has been deprecated
|
||||
in favor of the new ``cloudkitty::orchestrator::max_workers`` parameter.
|
56
spec/classes/cloudkitty_orchestrator_spec.rb
Normal file
56
spec/classes/cloudkitty_orchestrator_spec.rb
Normal file
@ -0,0 +1,56 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cloudkitty::orchestrator' do
|
||||
|
||||
shared_examples_for 'cloudkitty::orchestrator' do
|
||||
|
||||
context 'with defaults' do
|
||||
it { is_expected.to contain_class('cloudkitty::deps') }
|
||||
|
||||
it 'configures orchestrator' do
|
||||
is_expected.to contain_cloudkitty_config('orchestrator/coordination_url')\
|
||||
.with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_oslo__coordination('cloudkitty_config').with(
|
||||
:backend_url => '<SERVICE DEFAULT>',
|
||||
:manage_config => false,
|
||||
)
|
||||
is_expected.to contain_cloudkitty_config('orchestrator/max_workers').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_cloudkitty_config('orchestrator/max_threads').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with parameters set' do
|
||||
let :params do
|
||||
{
|
||||
:coordination_url => 'etcd3+http://127.0.0.1:2379',
|
||||
:max_workers => 4,
|
||||
:max_threads => 20,
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures orchestrator' do
|
||||
is_expected.to contain_cloudkitty_config('orchestrator/coordination_url')\
|
||||
.with_value('etcd3+http://127.0.0.1:2379')
|
||||
is_expected.to contain_oslo__coordination('cloudkitty_config').with(
|
||||
:backend_url => 'etcd3+http://127.0.0.1:2379',
|
||||
:manage_config => false,
|
||||
)
|
||||
is_expected.to contain_cloudkitty_config('orchestrator/max_workers').with_value(4)
|
||||
is_expected.to contain_cloudkitty_config('orchestrator/max_threads').with_value(20)
|
||||
end
|
||||
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_configures 'cloudkitty::orchestrator'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user