Add the acceptance test to deploy the cloudkitty service
1) Already have the cloudkitty package in RedHat system, so we can add the acceptance test to deploy the service now. 2) Add auth_section and keystone_version in group "keystone_fetcher" to load plugin specific options and use specific keystone version. 3) Change the collector valume to 'ceilometer' by default 4) Update releated to test. Change-Id: Ic2f8fafba1664273d89bd706768416da4d9b93e1
This commit is contained in:
parent
1374778768
commit
507e865c29
@ -224,6 +224,14 @@
|
||||
# (Optional) Driver used to fetch tenant list.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*auth_section*]
|
||||
# (Optional) Config Section from which to load plugin specific options
|
||||
# Defaults to 'keystone_authtoken'
|
||||
#
|
||||
# [*keystone_version*]
|
||||
# (Optional) Keystone version to use.
|
||||
# Defaults to '3'
|
||||
#
|
||||
class cloudkitty(
|
||||
$ensure_package = 'present',
|
||||
$rpc_backend = $::os_service_default,
|
||||
@ -270,6 +278,8 @@ class cloudkitty(
|
||||
$pipeline = $::os_service_default,
|
||||
$storage_backend = $::os_service_default,
|
||||
$tenant_fetcher_backend = $::os_service_default,
|
||||
$auth_section = 'keystone_authtoken',
|
||||
$keystone_version = '3',
|
||||
) {
|
||||
|
||||
include ::cloudkitty::params
|
||||
@ -356,4 +366,10 @@ class cloudkitty(
|
||||
'storage/backend': value => $storage_backend;
|
||||
'tenant_fetcher/backend': value => $tenant_fetcher_backend;
|
||||
}
|
||||
|
||||
cloudkitty_config {
|
||||
'keystone_fetcher/auth_section': value => 'keystone_authtoken';
|
||||
'keystone_fetcher/keystone_version': value => '3';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -72,9 +72,9 @@ class cloudkitty::keystone::auth (
|
||||
include ::cloudkitty::deps
|
||||
|
||||
if $configure_user_role {
|
||||
Keystone_user_role["${auth_name}@${tenant}"] ~> Anchor['cloudkitty::service::end']
|
||||
Keystone_user_role["${auth_name}@${tenant}"] ~> Anchor['cloudkitty::config::end']
|
||||
}
|
||||
Keystone_endpoint["${region}/${service_name}::${service_type}"] ~> Anchor['cloudkitty::service::end']
|
||||
Keystone_endpoint["${region}/${service_name}::${service_type}"] ~> Anchor['cloudkitty::config::end']
|
||||
|
||||
keystone::resource::service_identity { 'cloudkitty':
|
||||
configure_user => $configure_user,
|
||||
|
@ -31,7 +31,7 @@
|
||||
# (Optional) If true, explicitly allow TLS without checking server cert
|
||||
# against any certificate authorities. WARNING: not recommended. Use with
|
||||
# caution.
|
||||
# Defaults to $:os_service_default
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*auth_section*]
|
||||
# (Optional) Config Section from which to load plugin specific options
|
||||
|
@ -27,7 +27,7 @@
|
||||
#
|
||||
# [*log_file*]
|
||||
# (optional) File where logs should be stored.
|
||||
# Defaults to '/var/log/cloudkitty/cloudkitty.log'
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*logging_context_format_string*]
|
||||
# (optional) Format string to use for log messages with context.
|
||||
@ -98,7 +98,7 @@ class cloudkitty::logging(
|
||||
$use_stderr = $::os_service_default,
|
||||
$syslog_log_facility = $::os_service_default,
|
||||
$log_dir = '/var/log/cloudkitty',
|
||||
$log_file = '/var/log/cloudkitty/cloudkitty.log',
|
||||
$log_file = $::os_service_default,
|
||||
$debug = $::os_service_default,
|
||||
$logging_context_format_string = $::os_service_default,
|
||||
$logging_default_format_string = $::os_service_default,
|
||||
|
@ -18,7 +18,7 @@
|
||||
#
|
||||
# [*collector*]
|
||||
# (Optional) Data collector.
|
||||
# Defaults to $::os_service_default.
|
||||
# Defaults to 'ceilometer'.
|
||||
#
|
||||
# [*window*]
|
||||
# (Optional) Number of samples to collect per call.
|
||||
@ -40,7 +40,7 @@ class cloudkitty::processor (
|
||||
$package_ensure = 'present',
|
||||
$manage_service = true,
|
||||
$enabled = true,
|
||||
$collector = $::os_service_default,
|
||||
$collector = 'ceilometer',
|
||||
$window = $::os_service_default,
|
||||
$period = $::os_service_default,
|
||||
$wait_periods = $::os_service_default,
|
||||
@ -74,22 +74,32 @@ class cloudkitty::processor (
|
||||
}
|
||||
|
||||
cloudkitty_config {
|
||||
'collect/collector': value => $collector;
|
||||
'collect/window': value => $window;
|
||||
'collect/period': value => $period;
|
||||
'collect/wait_periods': value => $wait_periods;
|
||||
'collect/services': value => $services;
|
||||
}
|
||||
|
||||
if !is_service_default($collector) and !empty($collector){
|
||||
if $collector == 'ceilometer' {
|
||||
cloudkitty_config{
|
||||
'ceilometer_collector/auth_section': value => 'keystone_authtoken';
|
||||
}
|
||||
cloudkitty_config {
|
||||
'gnocchi_collector/auth_section': ensure => absent;
|
||||
}
|
||||
$collector_real = $collector
|
||||
} else{
|
||||
warning('Valid values of the collector option are ceilometer and gnocchi')
|
||||
cloudkitty_config{
|
||||
'gnocchi_collector/auth_section': value => 'keystone_authtoken';
|
||||
}
|
||||
} else{
|
||||
cloudkitty_config {
|
||||
'gnocchi_collector/auth_section': ensure => absent;
|
||||
'ceilometer_collector/auth_section': ensure => absent;
|
||||
}
|
||||
$collector_real = 'gnocchi'
|
||||
}
|
||||
|
||||
cloudkitty_config {
|
||||
'collect/collector': value => $collector_real;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class cloudkitty::storage(
|
||||
subscribe => [
|
||||
Anchor['cloudkitty::install::end'],
|
||||
Anchor['cloudkitty::config::end'],
|
||||
Anchor['cloudkitty::dbsync::begin'],
|
||||
Anchor['cloudkitty::dbsync::end'],
|
||||
Anchor['cloudkitty::storageinit::begin']
|
||||
],
|
||||
notify => Anchor['cloudkitty::storageinit::end'],
|
||||
|
78
spec/acceptance/basic_cloudkitty_spec.rb
Normal file
78
spec/acceptance/basic_cloudkitty_spec.rb
Normal file
@ -0,0 +1,78 @@
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'basic cloudkitty' do
|
||||
|
||||
context 'default parameters' do
|
||||
|
||||
it 'should work with no errors' do
|
||||
pp= <<-EOS
|
||||
include ::openstack_integration
|
||||
include ::openstack_integration::repos
|
||||
include ::openstack_integration::rabbitmq
|
||||
include ::openstack_integration::mysql
|
||||
include ::openstack_integration::keystone
|
||||
|
||||
rabbitmq_user { 'cloudkitty':
|
||||
admin => true,
|
||||
password => 'an_even_bigger_secret',
|
||||
provider => 'rabbitmqctl',
|
||||
require => Class['rabbitmq'],
|
||||
}
|
||||
|
||||
rabbitmq_user_permissions { 'cloudkitty@/':
|
||||
configure_permission => '.*',
|
||||
write_permission => '.*',
|
||||
read_permission => '.*',
|
||||
provider => 'rabbitmqctl',
|
||||
require => Class['rabbitmq'],
|
||||
}
|
||||
|
||||
# Cloudkitty resources
|
||||
case $::osfamily {
|
||||
'Debian': {
|
||||
warning('Cloudkitty is not yet packaged on Debian systems.')
|
||||
}
|
||||
'RedHat': {
|
||||
class { '::cloudkitty::db':
|
||||
database_connection => 'mysql+pymysql://cloudkitty:a_big_secret@127.0.0.1/cloudkitty?charset=utf8',
|
||||
}
|
||||
class { '::cloudkitty::logging':
|
||||
debug => true,
|
||||
}
|
||||
class { '::cloudkitty':
|
||||
default_transport_url => 'rabbit://cloudkitty:an_even_bigger_secret@127.0.0.1:5672',
|
||||
}
|
||||
class { '::cloudkitty::keystone::auth':
|
||||
password => 'a_big_secret',
|
||||
}
|
||||
class { '::cloudkitty::keystone::authtoken':
|
||||
password => 'a_big_secret',
|
||||
}
|
||||
class { '::cloudkitty::db::mysql':
|
||||
password => 'a_big_secret',
|
||||
}
|
||||
class { '::cloudkitty::api': }
|
||||
class { '::cloudkitty::processor': }
|
||||
class { '::cloudkitty::client': }
|
||||
}
|
||||
default: {
|
||||
fail("Unsupported osfamily (${::osfamily})")
|
||||
}
|
||||
}
|
||||
EOS
|
||||
|
||||
|
||||
# Run it twice and test for idempotency
|
||||
apply_manifest(pp, :catch_failures => true)
|
||||
apply_manifest(pp, :catch_changes => true)
|
||||
end
|
||||
|
||||
if os[:family].casecmp('RedHat') == 0
|
||||
describe port(8889) do
|
||||
it { is_expected.to be_listening }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
@ -52,6 +52,8 @@ describe 'cloudkitty' do
|
||||
:notification_topics => 'openstack',
|
||||
:default_transport_url => 'rabbit://rabbit_user:password@localhost:5673',
|
||||
:storage_backend => 'gnocchi',
|
||||
:auth_section => 'keystone_authtoken',
|
||||
:keystone_version => '3',
|
||||
}
|
||||
end
|
||||
|
||||
@ -66,6 +68,8 @@ describe 'cloudkitty' do
|
||||
it 'configures various things' do
|
||||
is_expected.to contain_cloudkitty_config('oslo_messaging_notifications/topics').with_value('openstack')
|
||||
is_expected.to contain_cloudkitty_config('storage/backend').with_value('gnocchi')
|
||||
is_expected.to contain_cloudkitty_config('keystone_fetcher/auth_section').with_value('keystone_authtoken')
|
||||
is_expected.to contain_cloudkitty_config('keystone_fetcher/keystone_version').with_value('3')
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -52,41 +52,41 @@ describe 'cloudkitty::keystone::authtoken' do
|
||||
context 'when overriding parameters' do
|
||||
before do
|
||||
params.merge!({
|
||||
:auth_uri => 'https://10.0.0.1:9999/',
|
||||
:username => 'myuser',
|
||||
:password => 'mypasswd',
|
||||
:auth_url => 'https://127.0.0.1:35357',
|
||||
:project_name => 'service_project',
|
||||
:user_domain_name => 'domainX',
|
||||
:project_domain_name => 'domainX',
|
||||
:insecure => false,
|
||||
:auth_section => 'new_section',
|
||||
:auth_type => 'password',
|
||||
:auth_version => 'v3',
|
||||
:cache => 'somevalue',
|
||||
:cafile => '/opt/stack/data/cafile.pem',
|
||||
:certfile => 'certfile.crt',
|
||||
:check_revocations_for_cached => false,
|
||||
:delay_auth_decision => false,
|
||||
:enforce_token_bind => 'permissive',
|
||||
:hash_algorithms => 'md5',
|
||||
:http_connect_timeout => '300',
|
||||
:http_request_max_retries => '3',
|
||||
:include_service_catalog => true,
|
||||
:keyfile => 'keyfile',
|
||||
:memcache_pool_conn_get_timeout => '9',
|
||||
:memcache_pool_dead_retry => '302',
|
||||
:memcache_pool_maxsize => '11',
|
||||
:memcache_pool_socket_timeout => '2',
|
||||
:memcache_pool_unused_timeout => '61',
|
||||
:memcache_secret_key => 'secret_key',
|
||||
:memcache_security_strategy => 'ENCRYPT',
|
||||
:memcache_use_advanced_pool => true,
|
||||
:memcached_servers => ['memcached01:11211','memcached02:11211'],
|
||||
:region_name => 'region2',
|
||||
:revocation_cache_time => '11',
|
||||
:signing_dir => '/var/cache',
|
||||
:token_cache_time => '301',
|
||||
:auth_uri => 'https://10.0.0.1:9999/',
|
||||
:username => 'myuser',
|
||||
:password => 'mypasswd',
|
||||
:auth_url => 'https://127.0.0.1:35357',
|
||||
:project_name => 'service_project',
|
||||
:user_domain_name => 'domainX',
|
||||
:project_domain_name => 'domainX',
|
||||
:insecure => false,
|
||||
:auth_section => 'new_section',
|
||||
:auth_type => 'password',
|
||||
:auth_version => 'v3',
|
||||
:cache => 'somevalue',
|
||||
:cafile => '/opt/stack/data/cafile.pem',
|
||||
:certfile => 'certfile.crt',
|
||||
:check_revocations_for_cached => false,
|
||||
:delay_auth_decision => false,
|
||||
:enforce_token_bind => 'permissive',
|
||||
:hash_algorithms => 'md5',
|
||||
:http_connect_timeout => '300',
|
||||
:http_request_max_retries => '3',
|
||||
:include_service_catalog => true,
|
||||
:keyfile => 'keyfile',
|
||||
:memcache_pool_conn_get_timeout => '9',
|
||||
:memcache_pool_dead_retry => '302',
|
||||
:memcache_pool_maxsize => '11',
|
||||
:memcache_pool_socket_timeout => '2',
|
||||
:memcache_pool_unused_timeout => '61',
|
||||
:memcache_secret_key => 'secret_key',
|
||||
:memcache_security_strategy => 'ENCRYPT',
|
||||
:memcache_use_advanced_pool => true,
|
||||
:memcached_servers => ['memcached01:11211','memcached02:11211'],
|
||||
:region_name => 'region2',
|
||||
:revocation_cache_time => '11',
|
||||
:signing_dir => '/var/cache',
|
||||
:token_cache_time => '301',
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -61,7 +61,7 @@ describe 'cloudkitty::logging' do
|
||||
is_expected.to contain_cloudkitty_config('DEFAULT/use_stderr').with(:value => '<SERVICE DEFAULT>')
|
||||
is_expected.to contain_cloudkitty_config('DEFAULT/syslog_log_facility').with(:value => '<SERVICE DEFAULT>')
|
||||
is_expected.to contain_cloudkitty_config('DEFAULT/log_dir').with(:value => '/var/log/cloudkitty')
|
||||
is_expected.to contain_cloudkitty_config('DEFAULT/log_file').with(:value => '/var/log/cloudkitty/cloudkitty.log')
|
||||
is_expected.to contain_cloudkitty_config('DEFAULT/log_file').with(:value => '<SERVICE DEFAULT>')
|
||||
is_expected.to contain_cloudkitty_config('DEFAULT/debug').with(:value => '<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
@ -21,6 +21,7 @@ describe 'cloudkitty::processor' do
|
||||
it { is_expected.to contain_cloudkitty_config('collect/window').with_value( params[:window] ) }
|
||||
it { is_expected.to contain_cloudkitty_config('collect/period').with_value( params[:period] ) }
|
||||
it { is_expected.to contain_cloudkitty_config('collect/wait_periods').with_value( params[:wait_periods] ) }
|
||||
it { is_expected.to contain_cloudkitty_config('ceilometer_collector/auth_section').with_value('keystone_authtoken') }
|
||||
|
||||
it 'installs cloudkitty-processor package' do
|
||||
is_expected.to contain_package('cloudkitty-processor').with(
|
||||
|
@ -13,7 +13,7 @@ describe 'cloudkitty::storage' do
|
||||
:logoutput => 'on_failure',
|
||||
:subscribe => ['Anchor[cloudkitty::install::end]',
|
||||
'Anchor[cloudkitty::config::end]',
|
||||
'Anchor[cloudkitty::dbsync::begin]',
|
||||
'Anchor[cloudkitty::dbsync::end]',
|
||||
'Anchor[cloudkitty::storageinit::begin]'],
|
||||
:notify => 'Anchor[cloudkitty::storageinit::end]',
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user