Cassandra: Initial commit

Allow puppet-openstack-cloud to deploy Cassandra nodes and hence
cluster.

Change-Id: I5c9b64def9406357a817d48a415e986401b90fa9
This commit is contained in:
Yanis Guenane 2015-06-04 16:47:18 +02:00
parent 360ddfaae8
commit 1159275582
3 changed files with 122 additions and 0 deletions

View File

@ -74,6 +74,9 @@ mod 'cloud',
mod 'common',
:git => 'git://github.com/enovance/puppet-module-common.git',
:ref => '2d0606fce1078222dd483e731ec32807f5b4ca53'
mod 'cassandra',
:git => 'git://github.com/enovance/cassandra.git',
:ref => '124f472128d178f52e2233d6aa8a0f1285f73c49'
mod 'concat',
:git => 'git://github.com/enovance/puppet-concat.git',
:ref => 'ab06c2b8c09d9da82b53a62a5389427720519cd5'

View File

@ -0,0 +1,40 @@
#
# Copyright (C) 2015 eNovance SAS <licensing@enovance.com>
#
# 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: cloud::database::nosql::cassandra
#
# Install a Cassandra node
#
# === Parameters:
#
# [*firewall_settings*]
# (optional) Allow to add custom parameters to firewall rules
# Should be an hash.
# Default to {}
#
class cloud::database::nosql::cassandra (
$firewall_settings = {},
){
include ::cassandra
if $::cloud::manage_firewall {
cloud::firewall::rule{ '100 allow cassandra access':
port => '7000',
extras => $firewall_settings,
}
}
}

View File

@ -0,0 +1,79 @@
#
# Copyright (C) 2015 eNovance SAS <licensing@enovance.com>
#
# 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.
#
# Unit tests for cloud::cache::cassandra
#
require 'spec_helper'
describe 'cloud::database::nosql::cassandra' do
shared_examples_for 'cassandra server' do
let :params do
{ }
end
it 'configure cassandra with some params' do
is_expected.to contain_class('cassandra')
end
context 'with default firewall enabled' do
let :pre_condition do
"class { 'cloud': manage_firewall => true }"
end
it 'configure cassandra firewall rules' do
is_expected.to contain_firewall('100 allow cassandra access').with(
:port => '7000',
:proto => 'tcp',
:action => 'accept',
)
end
end
context 'with custom firewall enabled' do
let :pre_condition do
"class { 'cloud': manage_firewall => true }"
end
before :each do
params.merge!(:firewall_settings => { 'limit' => '50/sec' } )
end
it 'configure cassandra firewall rules with custom parameter' do
is_expected.to contain_firewall('100 allow cassandra access').with(
:port => '7000',
:proto => 'tcp',
:action => 'accept',
:limit => '50/sec',
)
end
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'cassandra server'
end
end