Composable roles within services - MongoDB

Add MongoDB as a composable service.

Co-Authored-By: Juan Antonio Osorio Robles <jaosorior@redhat.com>
Change-Id: Idaa3275def3bcdb302a66fc1c88531ff718bcf67
Depends-On: Idb1e78ebec7682fe68ca5902a22cfb6030498091
This commit is contained in:
Carlos Camacho
2016-05-11 15:51:36 +02:00
parent 184dba99c1
commit 11074fb08f
9 changed files with 93 additions and 53 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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}

View File

@@ -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}

View File

@@ -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)) {

View File

@@ -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',

View File

@@ -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}

View File

@@ -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

View File

@@ -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