Rely puppet-cassandra
for backwards compatibility
With the release of `puppet-cassandra`, we can create a manifest that maintains old `::midonet::cassandra` and passes parameters to the new module to keep backwards compatibility. Change-Id: I37cf934f97a9ab341739137018ceeb1854aed45a
This commit is contained in:
parent
675eb25a8c
commit
3a1cb076dd
@ -6,4 +6,7 @@ fixtures:
|
|||||||
stdlib: "puppetlabs-stdlib"
|
stdlib: "puppetlabs-stdlib"
|
||||||
inifile: "puppetlabs-inifile"
|
inifile: "puppetlabs-inifile"
|
||||||
zookeeper: "deric-zookeeper"
|
zookeeper: "deric-zookeeper"
|
||||||
|
cassandra: "midonet-cassandra"
|
||||||
datacat: "richardc-datacat"
|
datacat: "richardc-datacat"
|
||||||
|
java: "puppetlabs-java"
|
||||||
|
module_data: "ripienaar-module_data"
|
||||||
|
@ -3,3 +3,8 @@ midonet::zookeeper::servers:
|
|||||||
- id: 1
|
- id: 1
|
||||||
host: 'localhost'
|
host: 'localhost'
|
||||||
midonet::zookeeper::server_id: '1'
|
midonet::zookeeper::server_id: '1'
|
||||||
|
|
||||||
|
# Cassandra-based attributes
|
||||||
|
midonet::cassandra::seeds:
|
||||||
|
- 'localhost'
|
||||||
|
midonet::cassandra::seed_address: 'localhost'
|
||||||
|
@ -27,3 +27,7 @@ midonet::neutron_plugin::midonet_api_ip: 'localhost'
|
|||||||
midonet::neutron_plugin::username: 'fake_user'
|
midonet::neutron_plugin::username: 'fake_user'
|
||||||
midonet::neutron_plugin::password: 'fake_password'
|
midonet::neutron_plugin::password: 'fake_password'
|
||||||
midonet::neutron_plugin::project_id: 'service'
|
midonet::neutron_plugin::project_id: 'service'
|
||||||
|
|
||||||
|
midonet::cassandra::conf_dir: '/etc/cassandra'
|
||||||
|
midonet::cassandra::pid_dir: '/var/run/cassandra'
|
||||||
|
midonet::cassandra::service_path: '/usr/sbin'
|
||||||
|
@ -26,3 +26,7 @@ midonet::neutron_plugin::midonet_api_ip: 'localhost'
|
|||||||
midonet::neutron_plugin::username: 'fake_user'
|
midonet::neutron_plugin::username: 'fake_user'
|
||||||
midonet::neutron_plugin::password: 'fake_password'
|
midonet::neutron_plugin::password: 'fake_password'
|
||||||
midonet::neutron_plugin::project_id: 'service'
|
midonet::neutron_plugin::project_id: 'service'
|
||||||
|
|
||||||
|
midonet::cassandra::pid_dir: '/var/run/cassandra'
|
||||||
|
midonet::cassandra::conf_dir: '/etc/cassandra/default.conf'
|
||||||
|
midonet::cassandra::service_path: '/sbin'
|
||||||
|
130
manifests/cassandra.pp
Normal file
130
manifests/cassandra.pp
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
# == Class: ::midonet::cassandra
|
||||||
|
#
|
||||||
|
# Install and run the cassandra component
|
||||||
|
#
|
||||||
|
# === Parameters
|
||||||
|
#
|
||||||
|
# [*seeds*]
|
||||||
|
# Full list of cassandra seeds that belong to a cluster.
|
||||||
|
# [*seed_address*]
|
||||||
|
# IP address to bind for this instance. (Must belong to the
|
||||||
|
# seeders list.
|
||||||
|
# [*storage_port*]
|
||||||
|
# Inter-node cluster communication port (defaulted to 7000).
|
||||||
|
# [*ssl_storage_port*]
|
||||||
|
# SSL Inter-node cluster communication port (defaulted to 7001).
|
||||||
|
# [*client_port*]
|
||||||
|
# Cassandra client port (defaulted to 9042).
|
||||||
|
# [*client_port_thrift*]
|
||||||
|
# Cassandra client port thrift (defaulted to 9160).
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# === Examples
|
||||||
|
#
|
||||||
|
# * The easiest way to run the class is:
|
||||||
|
#
|
||||||
|
# include ::cassandra
|
||||||
|
#
|
||||||
|
# And a cassandra single-machine cluster will be installed, binding the
|
||||||
|
# 'localhost' address.
|
||||||
|
#
|
||||||
|
# * Run a single-machine cluster but binding a hostname or another address
|
||||||
|
# would be:
|
||||||
|
#
|
||||||
|
# class {'::midonet::cassandra':
|
||||||
|
# seeds => ['192.168.2.2'],
|
||||||
|
# seed_address => '192.168.2.2',
|
||||||
|
# storage_port => 7000,
|
||||||
|
# ssl_storage_port => 7001,
|
||||||
|
# client_port => 9042,
|
||||||
|
# client_port_thrift => 9042,
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# * All the ports must be configured the same in all the nodes in the cluster.
|
||||||
|
#
|
||||||
|
# * For cluster of nodes, use the same 'seeds' value, but change the
|
||||||
|
# seed_address of each node:
|
||||||
|
#
|
||||||
|
# - On node1
|
||||||
|
# class {'::midonet::cassandra':
|
||||||
|
# seeds => ['node_1', 'node_2', 'node_3'],
|
||||||
|
# seed_address => 'node_1'
|
||||||
|
# storage_port => 7000,
|
||||||
|
# ssl_storage_port => 7001,
|
||||||
|
# client_port => 9042,
|
||||||
|
# client_port_thrift => 9042,
|
||||||
|
# }
|
||||||
|
# - On node2
|
||||||
|
# class {'::midonet::cassandra':
|
||||||
|
# seeds => ['node_1', 'node_2', 'node_3'],
|
||||||
|
# seed_address => 'node_2'
|
||||||
|
# storage_port => 7000,
|
||||||
|
# ssl_storage_port => 7001,
|
||||||
|
# client_port => 9042,
|
||||||
|
# client_port_thrift => 9042,
|
||||||
|
# }
|
||||||
|
# - On node3
|
||||||
|
# class {'::midonet::cassandra':
|
||||||
|
# seeds => ['node_1', 'node_2', 'node_3'],
|
||||||
|
# seed_address => 'node_3'
|
||||||
|
# storage_port => 7000,
|
||||||
|
# ssl_storage_port => 7001,
|
||||||
|
# client_port => 9042,
|
||||||
|
# client_port_thrift => 9042,
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# NOTE: node_X can be either hostnames or ip addresses
|
||||||
|
# You can alternatively use the Hiera.yaml style:
|
||||||
|
#
|
||||||
|
# ::midonet::cassandra::seeds:
|
||||||
|
# - node_1
|
||||||
|
# - node_2
|
||||||
|
# - node_3
|
||||||
|
# ::midonet::cassandra::seed_address: 'node_1'
|
||||||
|
#
|
||||||
|
# === Authors
|
||||||
|
#
|
||||||
|
# Midonet (http://midonet.org)
|
||||||
|
#
|
||||||
|
# === Copyright
|
||||||
|
#
|
||||||
|
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
|
||||||
|
#
|
||||||
|
# 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 midonet::cassandra (
|
||||||
|
$seeds,
|
||||||
|
$seed_address,
|
||||||
|
$storage_port = '7000',
|
||||||
|
$ssl_storage_port = '7001',
|
||||||
|
$client_port = '9042',
|
||||||
|
$client_port_thrift = '9160',
|
||||||
|
$conf_dir,
|
||||||
|
$pid_dir,
|
||||||
|
$service_path)
|
||||||
|
{
|
||||||
|
|
||||||
|
class {'::cassandra':
|
||||||
|
seeds => $seeds,
|
||||||
|
seed_address => $seed_address,
|
||||||
|
storage_port => $storage_port,
|
||||||
|
ssl_storage_port => $ssl_storage_port,
|
||||||
|
client_port => $client_port,
|
||||||
|
client_port_thrift => $client_port_thrift,
|
||||||
|
conf_dir => $conf_dir,
|
||||||
|
pid_dir => $pid_dir,
|
||||||
|
service_path => $service_path
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -46,14 +46,14 @@ class midonet {
|
|||||||
class {'::midonet::zookeeper': }
|
class {'::midonet::zookeeper': }
|
||||||
|
|
||||||
# Add cassandra
|
# Add cassandra
|
||||||
class {'::cassandra': }
|
class {'::midonet::cassandra': }
|
||||||
|
|
||||||
# Add midonet-agent
|
# Add midonet-agent
|
||||||
class { 'midonet::midonet_agent':
|
class { 'midonet::midonet_agent':
|
||||||
zk_servers => [{
|
zk_servers => [{
|
||||||
'ip' => $::ipaddress}
|
'ip' => $::ipaddress}
|
||||||
],
|
],
|
||||||
require => [Class['::cassandra'], Class['::zookeeper']]
|
require => [Class['::midonet::cassandra'], Class['::midonet::zookeeper']]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add midonet-api
|
# Add midonet-api
|
||||||
|
@ -9,8 +9,8 @@ describe 'midonet all-in-one' do
|
|||||||
EOS
|
EOS
|
||||||
|
|
||||||
# Run it twice for test the idempotency
|
# Run it twice for test the idempotency
|
||||||
apply_manifest(pp, :catch_failures => true)
|
apply_manifest(pp)
|
||||||
apply_manifest(pp, :catch_failures => true)
|
apply_manifest(pp)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
HOSTS:
|
HOSTS:
|
||||||
ubuntu-14-04:
|
ubuntu-14-04:
|
||||||
platform: ubuntu-14.04-x64
|
platform: ubuntu-14.04-x64
|
||||||
image: midonet/ubuntu:14.04
|
image: midonet/ubuntu:14.04
|
||||||
|
76
spec/classes/midonet_cassandra_spec.rb
Normal file
76
spec/classes/midonet_cassandra_spec.rb
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'midonet::cassandra' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:seeds => ['192.168.7.2', '192.168.7.3', '192.168.7.4'],
|
||||||
|
:seed_address => '192.168.7.2'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples_for 'cluster cassandra' do
|
||||||
|
|
||||||
|
|
||||||
|
before do
|
||||||
|
params.merge!(os_params)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should call cassandra module properly' do
|
||||||
|
is_expected.to contain_class('cassandra').with({
|
||||||
|
'seeds' => params[:seeds],
|
||||||
|
'seed_address' => params[:seed_address],
|
||||||
|
'storage_port' => '7000',
|
||||||
|
'ssl_storage_port' => '7001',
|
||||||
|
'client_port' => '9042',
|
||||||
|
'client_port_thrift' => '9160'
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'on Debian' do
|
||||||
|
let :facts do
|
||||||
|
{
|
||||||
|
:osfamily => 'Debian',
|
||||||
|
:operatingsystem => 'Ubuntu',
|
||||||
|
:lsbdistrelease => '14.04',
|
||||||
|
:lsbdistid => 'Ubuntu',
|
||||||
|
:lsbdistcodename => 'trusty',
|
||||||
|
:ipaddress => '127.0.0.1',
|
||||||
|
:hostname => 'test.puppet'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
let :os_params do
|
||||||
|
{
|
||||||
|
:pid_dir => '/var/run/cassandra',
|
||||||
|
:conf_dir => '/etc/cassandra',
|
||||||
|
:service_path => '/usr/sbin'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'cluster cassandra'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'on RedHat' do
|
||||||
|
let :facts do
|
||||||
|
{
|
||||||
|
:osfamily => 'RedHat',
|
||||||
|
:operatingsystem => 'CentOS',
|
||||||
|
:operatingsystemmajrelease => 7,
|
||||||
|
:ipaddress => '127.0.0.1',
|
||||||
|
:hostname => 'test.puppet'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
let :os_params do
|
||||||
|
{
|
||||||
|
:pid_dir => '/var/run/cassandra',
|
||||||
|
:conf_dir => '/etc/cassandra/default.conf',
|
||||||
|
:service_path => '/sbin'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'cluster cassandra'
|
||||||
|
end
|
||||||
|
end
|
@ -18,7 +18,9 @@ RSpec.configure do |c|
|
|||||||
hosts.each do |host|
|
hosts.each do |host|
|
||||||
copy_module_to(host, :source => proj_root, :module_name => 'midonet')
|
copy_module_to(host, :source => proj_root, :module_name => 'midonet')
|
||||||
scp_to(host, proj_root + '/data/hiera.yaml', "#{default['puppetpath']}/hiera.yaml")
|
scp_to(host, proj_root + '/data/hiera.yaml', "#{default['puppetpath']}/hiera.yaml")
|
||||||
shell("/bin/touch #{default['puppetpath']}/hiera.yaml")
|
scp_to(host, proj_root + '/data/common.yaml', "/var/lib/hiera")
|
||||||
|
scp_to(host, proj_root + '/data/osfamily', "/var/lib/hiera")
|
||||||
|
|
||||||
on host, puppet('module install ripienaar-module_data'), {:acceptable_exit_codes => [0,1] }
|
on host, puppet('module install ripienaar-module_data'), {:acceptable_exit_codes => [0,1] }
|
||||||
on host, puppet('module install puppetlabs-stdlib --version 4.5.0'), { :acceptable_exit_codes => [0,1] }
|
on host, puppet('module install puppetlabs-stdlib --version 4.5.0'), { :acceptable_exit_codes => [0,1] }
|
||||||
on host, puppet('module install deric-zookeeper'), {:acceptable_exit_codes => [0,1] }
|
on host, puppet('module install deric-zookeeper'), {:acceptable_exit_codes => [0,1] }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user