Deprecate MidoNet's puppet-zookeeper
Several changes to deprecate the MidoNet's zookeeper module. Deric's Zookeeper: https://github.com/deric/puppet-zookeeper Is well mantained and it has much more functionality. So the commit replaces the dependencies and sets some changes to adapt to the new module. I have kept the ::midonet::zookeeper manifest to maintain backwards compatiblity with tools that use MidoNet 2015.01 version. So the ::midonet::zookeeper manifest is just a gangway to the actual's deric one now. Change-Id: I6e6ebe8c9fea2e3d3195d9890b1c89362bd23d58
This commit is contained in:
parent
56bb8f5ff0
commit
675eb25a8c
@ -1,7 +1,9 @@
|
||||
fixtures:
|
||||
forge_modules:
|
||||
apt:
|
||||
apt:
|
||||
repo: "puppetlabs-apt"
|
||||
ref: "1.8.0"
|
||||
stdlib: "puppetlabs-stdlib"
|
||||
inifile: "puppetlabs-inifile"
|
||||
zookeeper: "deric-zookeeper"
|
||||
datacat: "richardc-datacat"
|
||||
|
@ -88,7 +88,7 @@ Midonet Repository adds midonet's repos into target system. By default it instal
|
||||
last released version of midonet:
|
||||
|
||||
To install other releases than the last default's Midonet OSS, you can override the
|
||||
default's midonet_repository atributes by a resource-like declaration:
|
||||
default's midonet\_repository atributes by a resource-like declaration:
|
||||
|
||||
class { 'midonet_repository':
|
||||
midonet_repo => 'http://repo.midonet.org/midonet/v2014.11',
|
||||
|
@ -0,0 +1,5 @@
|
||||
# Zookeeper-based attributes
|
||||
midonet::zookeeper::servers:
|
||||
- id: 1
|
||||
host: 'localhost'
|
||||
midonet::zookeeper::server_id: '1'
|
27
lib/puppet/parser/functions/zookeeper_servers.rb
Normal file
27
lib/puppet/parser/functions/zookeeper_servers.rb
Normal file
@ -0,0 +1,27 @@
|
||||
# Copyright 2015 Midokura SARL, 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.
|
||||
require 'logger'
|
||||
|
||||
module Puppet::Parser::Functions
|
||||
newfunction(:zookeeper_servers, :type => :rvalue
|
||||
) do |argv|
|
||||
|
||||
servers = argv[0]
|
||||
if servers.class == Hash
|
||||
servers = Array.new(1, servers)
|
||||
end
|
||||
return servers.map { |hash| hash["host"] }
|
||||
end
|
||||
|
||||
end
|
@ -43,19 +43,23 @@
|
||||
class midonet {
|
||||
|
||||
# Add zookeeper
|
||||
class {'::zookeeper': }
|
||||
class {'::midonet::zookeeper': }
|
||||
|
||||
# Add cassandra
|
||||
class {'::cassandra': }
|
||||
|
||||
# Add midonet-agent
|
||||
class { 'midonet::midonet_agent':
|
||||
require => [Class['::cassandra'],
|
||||
Class['::zookeeper']]
|
||||
zk_servers => [{
|
||||
'ip' => $::ipaddress}
|
||||
],
|
||||
require => [Class['::cassandra'], Class['::zookeeper']]
|
||||
}
|
||||
|
||||
# Add midonet-api
|
||||
class {'midonet::midonet_api':}
|
||||
class {'midonet::midonet_api':
|
||||
zk_servers => [{'ip' => $::ipaddress}]
|
||||
}
|
||||
|
||||
# Add midonet-cli
|
||||
class {'midonet::midonet_cli':}
|
||||
|
99
manifests/zookeeper.pp
Normal file
99
manifests/zookeeper.pp
Normal file
@ -0,0 +1,99 @@
|
||||
# == Class: ::midonet::zookeeper
|
||||
#
|
||||
# Install and run the zookeeper module.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*servers*]
|
||||
# Full list of ZooKeeper servers that run in the same cluster.
|
||||
# [*server_id*]
|
||||
# Identifier of this ZooKeeper server in the cluster.
|
||||
#
|
||||
# === Examples
|
||||
#
|
||||
# The easiest way to run the class is:
|
||||
#
|
||||
# include ::midonet::zookeeper
|
||||
#
|
||||
# And puppet will install a local zookeeper without cluster. For a
|
||||
# clustered zookeeper, the way you have to define your puppet site, is:
|
||||
#
|
||||
#
|
||||
# ... on Node1
|
||||
#
|
||||
# class {'::midonet::zookeeper':
|
||||
# servers => [{'id' => 1
|
||||
# 'host' => 'node_1'},
|
||||
# {'id' => 2,
|
||||
# 'host' => 'node_2'},
|
||||
# {'id' => 3,
|
||||
# 'host' => 'node_3'}],
|
||||
# server_id => 1}
|
||||
#
|
||||
# ... on Node2
|
||||
#
|
||||
# class {'::midonet::zookeeper':
|
||||
# servers => [{'id' => 1
|
||||
# 'host' => 'node_1'},
|
||||
# {'id' => 2,
|
||||
# 'host' => 'node_2'},
|
||||
# {'id' => 3,
|
||||
# 'host' => 'node_3'}],
|
||||
# server_id => 2}
|
||||
#
|
||||
# ... on Node3
|
||||
#
|
||||
# class {'::midonet::zookeeper':
|
||||
# servers => [{'id' => 1,
|
||||
# 'host' => 'node_1'},
|
||||
# {'id' => 2,
|
||||
# 'host' => 'node_2'},
|
||||
# {'id' => 3,
|
||||
# 'host' => 'node_3'}],
|
||||
# server_id => 3}
|
||||
#
|
||||
# defining the same servers for each puppet node, but using a different
|
||||
# server_id for each one. NOTE: node_X can be hostnames or IP addresses.
|
||||
#
|
||||
# you can alternatively use the Hiera.yaml style
|
||||
#
|
||||
# ::midonet::zookeeper::servers:
|
||||
# - id: 1
|
||||
# host: 'node_1'
|
||||
# - id: 2
|
||||
# host: 'node_2'
|
||||
# - id: 3
|
||||
# host: 'node_3'
|
||||
# ::midonet::zookeeper::server_id: '1'
|
||||
#
|
||||
# This module is a passthrough to already existent 'deric-zookeeper'
|
||||
# https://forge.puppetlabs.com/deric/zookeeper
|
||||
#
|
||||
# === 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::zookeeper($servers, $server_id) {
|
||||
|
||||
class {'::zookeeper':
|
||||
servers => zookeeper_servers($servers),
|
||||
id => $server_id
|
||||
}
|
||||
}
|
@ -9,8 +9,8 @@
|
||||
"issues_url": "https://midonet.atlassian.net/projects/MDT",
|
||||
"dependencies": [
|
||||
{ "name":"ripienaar-module_data","version_requirement":">=0.0.3" },
|
||||
{ "name": "puppetlabs/inifile", "version_requirement": ">=1.0.0 <2.0.0" },
|
||||
{ "name":"midonet-zookeeper","version_requirement":">=1.0.0" },
|
||||
{ "name":"puppetlabs-inifile", "version_requirement": ">=1.0.0 <2.0.0" },
|
||||
{ "name":"deric-zookeeper","version_requirement":">=0.3.9" },
|
||||
{ "name":"midonet-cassandra","version_requirement":">=1.0.0" },
|
||||
{ "name":"puppetlabs-apt","version_requirement":">=1.7.0 <2.0.0" },
|
||||
{ "name":"puppetlabs-java","version_requirement":">=1.3.0" },
|
||||
|
56
spec/classes/midonet_zookeeper_spec.rb
Normal file
56
spec/classes/midonet_zookeeper_spec.rb
Normal file
@ -0,0 +1,56 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'midonet::zookeeper' do
|
||||
|
||||
shared_examples_for 'cluster zookeeper' do
|
||||
let :params do
|
||||
{
|
||||
:servers => [{"id" => 1, "host" => 'node_1'},
|
||||
{"id" => 2, "host" => 'node_2'},
|
||||
{"id" => 3, "host" => 'node_3'}],
|
||||
:server_id => 3
|
||||
}
|
||||
end
|
||||
|
||||
let :zookeeper_params do
|
||||
{
|
||||
:servers => ['node_1', 'node_2', 'node_3'],
|
||||
:id => 3
|
||||
}
|
||||
end
|
||||
|
||||
it 'should call deric/zookeeper properly' do
|
||||
is_expected.to contain_class('zookeeper').with({
|
||||
'servers' => zookeeper_params[:servers],
|
||||
'id' => zookeeper_params[:id]
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian' do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:lsbdistrelease => '14.04',
|
||||
:lsbdistid => 'Ubuntu',
|
||||
:ipaddress => '127.0.0.1',
|
||||
:hostname => 'test.puppet'
|
||||
}
|
||||
end
|
||||
it_configures 'cluster zookeeper'
|
||||
end
|
||||
|
||||
context 'on RedHat' do
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'RedHat',
|
||||
:operatingsystemmajrelease => 7,
|
||||
:ipaddress => '127.0.0.1',
|
||||
:hostname => 'test.puppet'
|
||||
}
|
||||
end
|
||||
it_configures 'cluster zookeeper'
|
||||
end
|
||||
|
||||
end
|
13
spec/functions/zookeeper_servers_spec.rb
Normal file
13
spec/functions/zookeeper_servers_spec.rb
Normal file
@ -0,0 +1,13 @@
|
||||
require 'spec_helper'
|
||||
|
||||
input = [{'id' => '1', 'host' => 'host1'},
|
||||
{'id' => '2', 'host' => 'host2'}]
|
||||
output = ['host1', 'host2']
|
||||
|
||||
input2 = {'id' => '1', 'host' => 'host1'}
|
||||
output2 = ['host1']
|
||||
|
||||
describe 'zookeeper_servers' do
|
||||
it { is_expected.to run.with_params(input).and_return(output) }
|
||||
it { is_expected.to run.with_params(input2).and_return(output2) }
|
||||
end
|
@ -21,7 +21,7 @@ RSpec.configure do |c|
|
||||
shell("/bin/touch #{default['puppetpath']}/hiera.yaml")
|
||||
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 midonet-zookeeper'), {:acceptable_exit_codes => [0,1] }
|
||||
on host, puppet('module install deric-zookeeper'), {:acceptable_exit_codes => [0,1] }
|
||||
on host, puppet('module install midonet-cassandra'), {:acceptable_exit_codes => [0,1] }
|
||||
on host, puppet('module install puppetlabs-inifile'), {:acceptable_exit_codes => [0,1] }
|
||||
on host, puppet('module install puppetlabs-apt'), {:acceptable_exit_codes => [0,1] }
|
||||
|
Loading…
x
Reference in New Issue
Block a user