From 11074fb08f5bb86b1b84065ec1bfada3ad387053 Mon Sep 17 00:00:00 2001 From: Carlos Camacho Date: Wed, 11 May 2016 15:51:36 +0200 Subject: Composable roles within services - MongoDB Add MongoDB as a composable service. Co-Authored-By: Juan Antonio Osorio Robles Change-Id: Idaa3275def3bcdb302a66fc1c88531ff718bcf67 Depends-On: Idb1e78ebec7682fe68ca5902a22cfb6030498091 --- environments/puppet-pacemaker.yaml | 1 + overcloud-resource-registry-puppet.yaml | 1 + overcloud.yaml | 11 +------- puppet/controller.yaml | 14 ++-------- puppet/manifests/overcloud_controller.pp | 8 ------ puppet/manifests/overcloud_controller_pacemaker.pp | 25 ++---------------- puppet/services/database/mongodb-base.yaml | 30 ++++++++++++++++++++++ puppet/services/database/mongodb.yaml | 28 ++++++++++++++++++++ puppet/services/pacemaker/database/mongodb.yaml | 28 ++++++++++++++++++++ 9 files changed, 93 insertions(+), 53 deletions(-) create mode 100644 puppet/services/database/mongodb-base.yaml create mode 100644 puppet/services/database/mongodb.yaml create mode 100644 puppet/services/pacemaker/database/mongodb.yaml diff --git a/environments/puppet-pacemaker.yaml b/environments/puppet-pacemaker.yaml index b139fc8d..00e14fd0 100644 --- a/environments/puppet-pacemaker.yaml +++ b/environments/puppet-pacemaker.yaml @@ -30,3 +30,4 @@ resource_registry: OS::TripleO::Services::Memcached: ../puppet/services/pacemaker/memcached.yaml OS::TripleO::Services::Redis: ../puppet/services/pacemaker/database/redis.yaml OS::TripleO::Services::NovaConductor: ../puppet/services/pacemaker/nova-conductor.yaml + OS::TripleO::Services::MongoDb: ../puppet/services/pacemaker/database/mongodb.yaml diff --git a/overcloud-resource-registry-puppet.yaml b/overcloud-resource-registry-puppet.yaml index f140383c..3abd1c67 100644 --- a/overcloud-resource-registry-puppet.yaml +++ b/overcloud-resource-registry-puppet.yaml @@ -147,6 +147,7 @@ resource_registry: OS::TripleO::Services::SaharaEngine: puppet/services/sahara-engine.yaml OS::TripleO::Services::Redis: puppet/services/database/redis.yaml OS::TripleO::Services::NovaConductor: puppet/services/nova-conductor.yaml + OS::TripleO::Services::MongoDb: puppet/services/database/mongodb.yaml parameter_defaults: EnablePackageInstall: false diff --git a/overcloud.yaml b/overcloud.yaml index 5ec67675..aa139c01 100644 --- a/overcloud.yaml +++ b/overcloud.yaml @@ -225,14 +225,6 @@ parameters: default: '' description: Comma-separated list of ntp servers type: comma_delimited_list - MongoDbNoJournal: - default: false - description: Should MongoDb journaling be disabled - type: boolean - MongoDbIPv6: - default: false - description: Enable IPv6 if MongoDB VIP is IPv6 - type: boolean PublicVirtualFixedIPs: default: [] description: > @@ -597,6 +589,7 @@ parameters: - OS::TripleO::Services::SwiftProxy - OS::TripleO::Services::Redis - OS::TripleO::Services::NovaConductor + - OS::TripleO::Services::MongoDb description: A list of service resources (configured in the Heat resource_registry) which represent nested stacks for each service that should get installed on the Controllers. @@ -872,8 +865,6 @@ resources: NovaIPv6: {get_param: NovaIPv6} NovaPassword: {get_param: NovaPassword} NtpServer: {get_param: NtpServer} - MongoDbNoJournal: {get_param: MongoDbNoJournal} - MongoDbIPv6: {get_param: MongoDbIPv6} PcsdPassword: {get_resource: PcsdPassword} PublicVirtualInterface: {get_param: PublicVirtualInterface} RabbitPassword: {get_param: RabbitPassword} diff --git a/puppet/controller.yaml b/puppet/controller.yaml index 66a5d5e5..aaf87707 100644 --- a/puppet/controller.yaml +++ b/puppet/controller.yaml @@ -300,14 +300,6 @@ parameters: default: 0 description: Number of workers for Nova service. type: number - MongoDbNoJournal: - default: false - description: Should MongoDb journaling be disabled - type: boolean - MongoDbIPv6: - default: false - description: Enable IPv6 if Mongo DB VIP is IPv6 - type: boolean NtpServer: default: '' description: Comma-separated list of ntp servers @@ -768,8 +760,6 @@ resources: rabbit_cookie: {get_param: RabbitCookie} rabbit_client_use_ssl: {get_param: RabbitClientUseSSL} rabbit_client_port: {get_param: RabbitClientPort} - mongodb_no_journal: {get_param: MongoDbNoJournal} - mongodb_ipv6: {get_param: MongoDbIPv6} ntp_servers: {get_param: NtpServer} timezone: {get_param: TimeZone} control_virtual_interface: {get_param: ControlVirtualInterface} @@ -936,10 +926,10 @@ resources: keystone::public_bind_host: {get_input: keystone_public_api_network} keystone::wsgi::apache::bind_host: {get_input: keystone_public_api_network} keystone::wsgi::apache::admin_bind_host: {get_input: keystone_admin_api_network} + # MongoDB mongodb::server::bind_ip: {get_input: mongo_db_network} - mongodb::server::nojournal: {get_input: mongodb_no_journal} - mongodb::server::ipv6: {get_input: mongodb_ipv6} + # MySQL admin_password: {get_input: admin_password} enable_galera: {get_input: enable_galera} diff --git a/puppet/manifests/overcloud_controller.pp b/puppet/manifests/overcloud_controller.pp index 872e7c88..95c933d4 100644 --- a/puppet/manifests/overcloud_controller.pp +++ b/puppet/manifests/overcloud_controller.pp @@ -36,9 +36,6 @@ if hiera('step') >= 2 { # MongoDB if downcase(hiera('ceilometer_backend')) == 'mongodb' { - include ::mongodb::globals - include ::mongodb::client - include ::mongodb::server # NOTE(gfidente): We need to pass the list of IPv6 addresses *with* port and # without the brackets as 'members' argument for the 'mongodb_replset' # resource. @@ -54,11 +51,6 @@ if hiera('step') >= 2 { $mongodb_replset = hiera('mongodb::server::replset') $ceilometer_mongodb_conn_string = "mongodb://${mongo_node_string}/ceilometer?replicaSet=${mongodb_replset}" - if downcase(hiera('bootstrap_nodeid')) == $::hostname { - mongodb_replset { $mongodb_replset : - members => $mongo_node_ips_with_port_nobr, - } - } } if str2bool(hiera('enable_galera', true)) { diff --git a/puppet/manifests/overcloud_controller_pacemaker.pp b/puppet/manifests/overcloud_controller_pacemaker.pp index ee513a0d..614f23ba 100644 --- a/puppet/manifests/overcloud_controller_pacemaker.pp +++ b/puppet/manifests/overcloud_controller_pacemaker.pp @@ -100,11 +100,7 @@ if hiera('step') >= 1 { } if downcase(hiera('ceilometer_backend')) == 'mongodb' { - include ::mongodb::globals - include ::mongodb::client - class { '::mongodb::server' : - service_manage => false, - } + include ::mongodb::params } # Galera @@ -166,6 +162,7 @@ if hiera('step') >= 1 { if hiera('step') >= 2 { + # NOTE(gfidente): the following vars are needed on all nodes so they # need to stay out of pacemaker_master conditional. # The addresses mangling will hopefully go away when we'll be able to @@ -192,24 +189,6 @@ if hiera('step') >= 2 { clone_params => true, } - if downcase(hiera('ceilometer_backend')) == 'mongodb' { - pacemaker::resource::service { $::mongodb::params::service_name : - op_params => 'start timeout=370s stop timeout=200s', - clone_params => true, - require => Class['::mongodb::server'], - } - # NOTE (spredzy) : The replset can only be run - # once all the nodes have joined the cluster. - mongodb_conn_validator { $mongo_node_ips_with_port : - timeout => '600', - require => Pacemaker::Resource::Service[$::mongodb::params::service_name], - before => Mongodb_replset[$mongodb_replset], - } - mongodb_replset { $mongodb_replset : - members => $mongo_node_ips_with_port_nobr, - } - } - pacemaker::resource::ocf { 'galera' : ocf_agent_name => 'heartbeat:galera', op_params => 'promote timeout=300s on-fail=block', diff --git a/puppet/services/database/mongodb-base.yaml b/puppet/services/database/mongodb-base.yaml new file mode 100644 index 00000000..ecd1d319 --- /dev/null +++ b/puppet/services/database/mongodb-base.yaml @@ -0,0 +1,30 @@ +heat_template_version: 2016-04-08 + +description: > + Configuration details for MongoDB service using composable roles + +parameters: + MongoDbNoJournal: + default: false + description: Should MongoDb journaling be disabled + type: boolean + MongoDbIPv6: + default: false + description: Enable IPv6 if MongoDB VIP is IPv6 + type: boolean + MongoDbReplset: + type: string + default: "tripleo" + +outputs: + aux_parameters: + description: Additional parameters referenced outside the base file + value: + rplset_name: {get_param: MongoDbReplset} + role_data: + description: Role data for the MongoDB base service. + value: + config_settings: + mongodb::server::nojournal: {get_param: MongoDbNoJournal} + mongodb::server::ipv6: {get_param: MongoDbIPv6} + mongodb::server::replset: {get_param: MongoDbReplset} \ No newline at end of file diff --git a/puppet/services/database/mongodb.yaml b/puppet/services/database/mongodb.yaml new file mode 100644 index 00000000..c0488700 --- /dev/null +++ b/puppet/services/database/mongodb.yaml @@ -0,0 +1,28 @@ +heat_template_version: 2016-04-08 + +description: > + MongoDb service deployment using puppet + +parameters: + #Parameters not used EndpointMap + EndpointMap: + default: {} + description: Mapping of service endpoint -> protocol. Typically set + via parameter_defaults in the resource registry. + type: json + +resources: + MongoDbBase: + type: ./mongodb-base.yaml + +outputs: + role_data: + description: Service mongodb using composable services. + value: + config_settings: + map_merge: + - get_attr: [MongoDbBase, role_data, config_settings] + - tripleo::profile::base::database::mongodb::mongodb_replset: {get_attr: [MongoDbBase, aux_parameters, rplset_name]} + mongodb::server::service_manage: True + step_config: | + include ::tripleo::profile::base::database::mongodb \ No newline at end of file diff --git a/puppet/services/pacemaker/database/mongodb.yaml b/puppet/services/pacemaker/database/mongodb.yaml new file mode 100644 index 00000000..b2e9e0bb --- /dev/null +++ b/puppet/services/pacemaker/database/mongodb.yaml @@ -0,0 +1,28 @@ +heat_template_version: 2016-04-08 + +description: > + MongoDb service deployment using puppet + +parameters: + #Parameters not used EndpointMap + EndpointMap: + default: {} + description: Mapping of service endpoint -> protocol. Typically set + via parameter_defaults in the resource registry. + type: json + +resources: + MongoDbBase: + type: ../../database/mongodb-base.yaml + +outputs: + role_data: + description: Service mongodb using composable services. + value: + config_settings: + map_merge: + - get_attr: [MongoDbBase, role_data, config_settings] + - tripleo::profile::pacemaker::database::mongodb::mongodb_replset: {get_attr: [MongoDbBase, aux_parameters, rplset_name]} + mongodb::server::service_manage: False + step_config: | + include ::tripleo::profile::pacemaker::database::mongodb -- cgit 1.2.3-korg