Remove MongoDB

MongoDB hasn't been supported since Pike, it's time to remove the
deployment files. Starting in Stein, it's not possible to deploy MongoDB
anymore. It already changes the default zaqar management_store to
sqlalchemy and the zaqar messaging_store to redis, which is already
set by TripleO Heat Templates.

Change-Id: I470a7e8c25293b2f2cb5420be124a8809481478a
This commit is contained in:
Emilien Macchi 2018-12-28 13:14:52 +01:00 committed by Sorin Sbarnea
parent 410856afe0
commit 801b12b60e
9 changed files with 14 additions and 293 deletions

View File

@ -1,93 +0,0 @@
# Copyright 2017 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# == Class: tripleo::certmonger::mongodb
#
# Request a certificate for MongoDB and do the necessary setup.
#
# === Parameters
#
# [*hostname*]
# The hostname of the node. this will be set in the CN of the certificate.
#
# [*service_certificate*]
# The path to the certificate that will be used for TLS in this service.
#
# [*service_key*]
# The path to the key that will be used for TLS in this service.
#
# [*service_pem*]
# The file in PEM format that the HAProxy service will use as a certificate.
#
# [*certmonger_ca*]
# (Optional) The CA that certmonger will use to generate the certificates.
# Defaults to hiera('certmonger_ca', 'local').
#
# [*postsave_cmd*]
# (Optional) Specifies the command to execute after requesting a certificate.
# If nothing is given, it will default to: "systemctl restart ${service name}"
# Defaults to undef.
#
# [*principal*]
# (Optional) The service principal that is set for the service in kerberos.
# Defaults to undef
#
class tripleo::certmonger::mongodb (
$hostname,
$service_certificate,
$service_key,
$service_pem,
$certmonger_ca = hiera('certmonger_ca', 'local'),
$postsave_cmd = undef,
$principal = undef,
) {
include ::certmonger
include ::mongodb::params
$postsave_cmd_real = pick($postsave_cmd, "systemctl restart ${::mongodb::params::service_name}")
certmonger_certificate { 'mongodb' :
ensure => 'present',
certfile => $service_certificate,
keyfile => $service_key,
hostname => $hostname,
dnsname => $hostname,
principal => $principal,
postsave_cmd => $postsave_cmd_real,
ca => $certmonger_ca,
wait => true,
require => Class['::certmonger'],
}
concat { $service_pem :
ensure => present,
mode => '0640',
owner => $::mongodb::params::user,
group => $::mongodb::params::group,
}
concat::fragment { 'mongodb-key-fragment':
target => $service_pem,
source => $service_key,
order => '01',
require => Certmonger_certificate['mongodb'],
}
concat::fragment { 'mongodb-cert-fragment':
target => $service_pem,
source => $service_certificate,
order => '10',
require => Certmonger_certificate['mongodb'],
}
Concat::Fragment['mongodb-key-fragment'] ~> Service<| title == $::mongodb::params::service_name |>
Concat::Fragment['mongodb-cert-fragment'] ~> Service<| title == $::mongodb::params::service_name |>
}

View File

@ -14,7 +14,7 @@
#
# == Class: tripleo::certmonger::novnc_proxy
#
# Request a certificate for MongoDB and do the necessary setup.
# Request a certificate for novnc_proxy and do the necessary setup.
#
# === Parameters
#

View File

@ -87,11 +87,6 @@
# certificate is renewed.
# Defaults to undef
#
# [*mongodb_certificate_specs*]
# (Optional) The specifications to give to certmonger for the certificate(s)
# it will create.
# Defaults to hiera('mongodb_certificate_specs',{})
#
# [*mysql_certificate_specs*]
# (Optional) The specifications to give to certmonger for the certificate(s)
# it will create.
@ -149,7 +144,6 @@ class tripleo::profile::base::certmonger_user (
$libvirt_vnc_postsave_cmd = undef,
$qemu_certificates_specs = hiera('qemu_certificates_specs', {}),
$qemu_postsave_cmd = undef,
$mongodb_certificate_specs = hiera('mongodb_certificate_specs',{}),
$mysql_certificate_specs = hiera('tripleo::profile::base::database::mysql::certificate_specs', {}),
$rabbitmq_certificate_specs = hiera('tripleo::profile::base::rabbitmq::certificate_specs', {}),
$redis_certificate_specs = hiera('redis_certificate_specs', {}),
@ -213,9 +207,6 @@ class tripleo::profile::base::certmonger_user (
# existing and need to be refreshed if it changed.
Tripleo::Certmonger::Haproxy<||> ~> Haproxy::Listen<||>
}
unless empty($mongodb_certificate_specs) {
ensure_resource('class', 'tripleo::certmonger::mongodb', $mongodb_certificate_specs)
}
unless empty($mysql_certificate_specs) {
ensure_resource('class', 'tripleo::certmonger::mysql', $mysql_certificate_specs)
}

View File

@ -1,77 +0,0 @@
# Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# == Class: tripleo::profile::base::database::mongodb
#
# Mongodb profile for tripleo
#
# === Parameters
#
# [*mongodb_replset*]
# Mongodb replicaset name
#
# [*bootstrap_node*]
# (Optional) The hostname of the node responsible for bootstrapping tasks
# Defaults to hiera('mongodb_short_bootstrap_node_name')
#
# [*step*]
# (Optional) The current step in deployment. See tripleo-heat-templates
# for more details.
# Defaults to hiera('step')
#
# [*memory_limit*]
# (Optional) Limit amount of memory mongodb can use
# Defaults to 20G
#
class tripleo::profile::base::database::mongodb (
$mongodb_replset,
$bootstrap_node = downcase(hiera('mongodb_short_bootstrap_node_name')),
$step = Integer(hiera('step')),
$memory_limit = '20G',
) {
if $step >= 2 {
include ::mongodb::globals
include ::mongodb::client
include ::mongodb::server
include ::tripleo::profile::base::database::mongodbcommon
if $bootstrap_node == $::hostname {
# make sure we can connect to all servers before forming the replset
tripleo::profile::pacemaker::database::mongodbvalidator {
$tripleo::profile::base::database::mongodbcommon::mongodb_node_ips :
port => $tripleo::profile::base::database::mongodbcommon::port,
require => Service['mongodb'],
before => Mongodb_replset[$mongodb_replset],
}
mongodb_replset { $mongodb_replset :
members => $tripleo::profile::base::database::mongodbcommon::mongo_node_ips_with_port_nobr,
}
}
# Limit memory utilization
::systemd::service_limits { 'mongod.service':
limits => {
'MemoryLimit' => $memory_limit
}
}
# Automatic restart
::systemd::dropin_file { 'mongod.conf':
unit => 'mongod.service',
content => "[Service]\nRestart=always\n",
}
}
}

View File

@ -1,50 +0,0 @@
# Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# == Class: tripleo::profile::base::database::mongodb
#
# Mongodb profile for tripleo
#
# === Parameters
#
# [*mongodb_ipv6_enabled*]
# A boolean value for mongodb server ipv6 is enabled or not
# Defaults to false
#
# [*mongodb_node_ips*]
# List of The mongodb node ip addresses
#
class tripleo::profile::base::database::mongodbcommon (
$mongodb_ipv6_enabled = false,
$mongodb_node_ips = hiera('mongodb_node_ips'),
) {
$port = '27017'
# NOTE(gfidente): the following vars are needed on all nodes.
# The addresses mangling will hopefully go away when we'll be able to
# configure the connection string via hostnames, until then, we need to pass
# the list of IPv6 addresses *with* port and without the brackets as 'members'
# argument for the 'mongodb_replset' resource.
if str2bool($mongodb_ipv6_enabled) {
$mongo_node_ips_with_port_prefixed = prefix($mongodb_node_ips, '[')
$mongo_node_ips_with_port = suffix(
$mongo_node_ips_with_port_prefixed, "]:${port}")
$mongo_node_ips_with_port_nobr = suffix($mongodb_node_ips, ":${port}")
} else {
$mongo_node_ips_with_port = suffix($mongodb_node_ips, ":${port}")
$mongo_node_ips_with_port_nobr = suffix($mongodb_node_ips, ":${port}")
}
$mongo_node_string = join($mongo_node_ips_with_port, ',')
}

View File

@ -267,7 +267,7 @@ class tripleo::profile::base::database::mysql (
include ::ec2api::db::mysql
}
if hiera('zaqar_api_enabled', false) and hiera('zaqar::db::mysql::user', '') == 'zaqar' {
# NOTE: by default zaqar uses mongodb
# NOTE: by default zaqar uses sqlalchemy
include ::zaqar::db::mysql
}
if hiera('veritas_hyperscale_controller_enabled', false) {

View File

@ -24,11 +24,11 @@
#
# [*management_store*]
# (Optional) The management store for Zaqar.
# Defaults to 'mongodb'
# Defaults to 'sqlalchemy'
#
# [*messaging_store*]
# (Optional) The messaging store for Zaqar.
# Defaults to 'mongodb'
# Defaults to 'redis'
#
# [*certificates_specs*]
# (Optional) The specifications to give to certmonger for the certificate(s)
@ -66,8 +66,8 @@
#
class tripleo::profile::base::zaqar (
$bootstrap_node = hiera('zaqar_api_short_bootstrap_node_name', undef),
$management_store = 'mongodb',
$messaging_store = 'mongodb',
$management_store = 'sqlalchemy',
$messaging_store = 'redis',
$certificates_specs = hiera('apache_certificates_specs', {}),
$enable_internal_tls = hiera('enable_internal_tls', false),
$zaqar_api_network = hiera('zaqar_api_network', undef),
@ -95,25 +95,8 @@ class tripleo::profile::base::zaqar (
if $step >= 4 or ( $step >= 3 and $is_bootstrap ) {
include ::zaqar
if $messaging_store == 'mongodb' or $management_store == 'mongodb' {
if str2bool(hiera('mongodb::server::ipv6', false)) {
$mongo_node_ips_with_port_prefixed = prefix(hiera('mongodb_node_ips'), '[')
$mongo_node_ips_with_port = suffix($mongo_node_ips_with_port_prefixed, ']:27017')
} else {
$mongo_node_ips_with_port = suffix(hiera('mongodb_node_ips'), ':27017')
}
$mongodb_replset = hiera('mongodb::server::replset')
$mongo_node_string = join($mongo_node_ips_with_port, ',')
$mongo_database_connection = "mongodb://${mongo_node_string}/zaqar?replicaSet=${mongodb_replset}"
}
if $messaging_store == 'swift' {
include ::zaqar::messaging::swift
} elsif $messaging_store == 'mongodb' {
class {'::zaqar::messaging::mongodb':
uri => $mongo_database_connection,
}
} elsif $messaging_store == 'redis' {
class {'::zaqar::messaging::redis':
uri => join(['redis://:', $zaqar_redis_password, '@', normalize_ip_for_uri($redis_vip), ':6379/']),
@ -124,10 +107,6 @@ class tripleo::profile::base::zaqar (
if $management_store == 'sqlalchemy' {
include ::zaqar::management::sqlalchemy
} elsif $management_store == 'mongodb' {
class { '::zaqar::management::mongodb':
uri => $mongo_database_connection,
}
} else {
fail("unsupported Zaqar management_store set: ${management_store}")
}

View File

@ -1,37 +0,0 @@
# Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# == Class: tripleo::profile::pacemaker::database::mongodb::conn_validator
#
# Connection validator for a node that serves MongoDB. This is done to be able
# to iterate through the different servers in a more seamless way.
#
# === Parameters
#
# [*title*]
# the title or namevar of the resource will be used as the server of the
# actual mongodb_conn_validator.
#
# [*port*]
# The port in which the MongoDB server is listening on.
#
define tripleo::profile::pacemaker::database::mongodbvalidator(
$port,
) {
mongodb_conn_validator { "${title}_conn_validator" :
server => $title,
port => $port,
timeout => '600',
}
}

View File

@ -0,0 +1,8 @@
---
other:
- |
MongoDB hasn't been supported since Pike, it's time to remove the
deployment files. Starting in Stein, it's not possible to deploy MongoDB
anymore. It already changes the default zaqar management_store to
sqlalchemy and the zaqar messaging_store to redis, which is already
set by TripleO Heat Templates.