Skip to content

Commit

Permalink
Merge pull request #155 from redBorder/development
Browse files Browse the repository at this point in the history
Release 2.1.0
  • Loading branch information
JPeraltaNic authored Jun 18, 2024
2 parents 6fb3728 + 4fae667 commit 6cc36c6
Show file tree
Hide file tree
Showing 7 changed files with 272 additions and 101 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
cookbook-rb-manager CHANGELOG
===============

## 2.1.0

- David Vanhoucke
- [161b5dd] add library to get virtual ips
- [32fe52b] add keepalived and balanced services

## 2.0.1

- Miguel Alvarez
Expand Down
165 changes: 86 additions & 79 deletions resources/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,91 +125,98 @@
default['redborder']['services_group']['postgresql'] = %w(postgresql redborder-postgresql)

default['redborder']['services'] = {}
default['redborder']['services']['chef-client'] = true
default['redborder']['services']['chef-server'] = false
default['redborder']['services']['consul'] = false
default['redborder']['services']['consul-client'] = false
default['redborder']['services']['keepalived'] = false
default['redborder']['services']['druid-coordinator'] = false
default['redborder']['services']['druid-realtime'] = false
default['redborder']['services']['druid-historical'] = false
default['redborder']['services']['druid-broker'] = false
default['redborder']['services']['druid-overlord'] = false
default['redborder']['services']['druid-middlemanager'] = false
default['redborder']['services']['kafka'] = false
default['redborder']['services']['zookeeper'] = false
default['redborder']['services']['http2k'] = false
default['redborder']['services']['webui'] = false
default['redborder']['services']['postgresql'] = false
default['redborder']['services']['redborder-postgresql'] = false
default['redborder']['services']['nginx'] = false
default['redborder']['services']['redborder-cep'] = false
default['redborder']['services']['rb-aioutliers'] = false
default['redborder']['services']['rb-logstatter'] = true
default['redborder']['services']['rb-arubacentral'] = false
default['redborder']['services']['memcached'] = true
default['redborder']['services']['rb-monitor'] = false
default['redborder']['services']['secor'] = false
default['redborder']['services']['s3'] = false
default['redborder']['services']['mongodb'] = false
default['redborder']['services']['hadoop-nodemanager'] = false
default['redborder']['services']['hadoop-resourcemanager'] = false
default['redborder']['services']['redborder-monitor'] = true
default['redborder']['services']['redborder-scanner'] = false
default['redborder']['services']['snmp'] = true
default['redborder']['services']['f2k'] = false
default['redborder']['services']['logstash'] = false
default['redborder']['services']['pmacct'] = false
default['redborder']['services']['redborder-dswatcher'] = false
default['redborder']['services']['redborder-events-counter'] = false
default['redborder']['services']['rsyslog'] = true
default['redborder']['services']['redborder-nmsp'] = false
default['redborder']['services']['redborder-ale'] = false
default['redborder']['services']['n2klocd'] = false
default['redborder']['services']['radiusd'] = false
default['redborder']['services']['postfix'] = true

default['redborder']['systemdservices']['chef-client'] = ['chef-client']
default['redborder']['systemdservices']['chef-server'] = ['opscode-erchef']
default['redborder']['systemdservices']['consul'] = ['consul']
default['redborder']['systemdservices']['consul-client'] = ['consul']
default['redborder']['systemdservices']['druid-realtime'] = ['druid-realtime']
default['redborder']['systemdservices']['druid-coordinator'] = ['druid-coordinator']
default['redborder']['systemdservices']['druid-historical'] = ['druid-historical']
default['redborder']['systemdservices']['druid-broker'] = ['druid-broker']
default['redborder']['systemdservices']['kafka'] = ['kafka']
default['redborder']['systemdservices']['zookeeper'] = ['zookeeper']
default['redborder']['systemdservices']['webui'] = ['webui']
default['redborder']['systemdservices']['postgresql'] = ['postgresql']
default['redborder']['systemdservices']['redborder-postgresql'] = ['redborder-postgresql']
default['redborder']['systemdservices']['nginx'] = ['nginx']
default['redborder']['systemdservices']['redborder-cep'] = ['redborder-cep']
default['redborder']['systemdservices']['rb-aioutliers'] = ['rb-aioutliers']
default['redborder']['systemdservices']['rb-logstatter'] = ['rb-logstatter']
default['redborder']['systemdservices']['rb-arubacentral'] = ['rb-arubacentral']
default['redborder']['systemdservices']['memcached'] = ['memcached']
default['redborder']['systemdservices']['s3'] = ['minio']
default['redborder']['systemdservices']['mongodb'] = ['mongod']
default['redborder']['systemdservices']['redborder-monitor'] = ['redborder-monitor']
default['redborder']['systemdservices']['redborder-scanner'] = ['redborder-scanner']
default['redborder']['systemdservices']['snmp'] = ['snmpd']
default['redborder']['systemdservices']['f2k'] = ['f2k']
default['redborder']['systemdservices']['logstash'] = ['logstash']
default['redborder']['systemdservices']['pmacct'] = ['sfacctd']
default['redborder']['systemdservices']['redborder-dswatcher'] = ['redborder-dswatcher']
default['redborder']['services']['chef-client'] = true
default['redborder']['services']['chef-server'] = false
default['redborder']['services']['consul'] = false
default['redborder']['services']['consul-client'] = false
default['redborder']['services']['keepalived'] = false
default['redborder']['services']['druid-coordinator'] = false
default['redborder']['services']['druid-realtime'] = false
default['redborder']['services']['druid-historical'] = false
default['redborder']['services']['druid-broker'] = false
default['redborder']['services']['druid-overlord'] = false
default['redborder']['services']['druid-middlemanager'] = false
default['redborder']['services']['kafka'] = false
default['redborder']['services']['zookeeper'] = false
default['redborder']['services']['http2k'] = false
default['redborder']['services']['webui'] = false
default['redborder']['services']['postgresql'] = false
default['redborder']['services']['redborder-postgresql'] = false
default['redborder']['services']['nginx'] = false
default['redborder']['services']['redborder-cep'] = false
default['redborder']['services']['rb-aioutliers'] = false
default['redborder']['services']['rb-logstatter'] = true
default['redborder']['services']['rb-arubacentral'] = false
default['redborder']['services']['memcached'] = true
default['redborder']['services']['rb-monitor'] = false
default['redborder']['services']['secor'] = false
default['redborder']['services']['s3'] = false
default['redborder']['services']['mongodb'] = false
default['redborder']['services']['hadoop-nodemanager'] = false
default['redborder']['services']['hadoop-resourcemanager'] = false
default['redborder']['services']['redborder-monitor'] = true
default['redborder']['services']['redborder-scanner'] = false
default['redborder']['services']['snmp'] = true
default['redborder']['services']['f2k'] = false
default['redborder']['services']['logstash'] = false
default['redborder']['services']['pmacct'] = false
default['redborder']['services']['redborder-dswatcher'] = false
default['redborder']['services']['redborder-events-counter'] = false
default['redborder']['services']['rsyslog'] = true
default['redborder']['services']['redborder-nmsp'] = false
default['redborder']['services']['redborder-ale'] = false
default['redborder']['services']['n2klocd'] = false
default['redborder']['services']['radiusd'] = false
default['redborder']['services']['postfix'] = true
default['redborder']['services']['keepalived'] = false

default['redborder']['systemdservices']['chef-client'] = ['chef-client']
default['redborder']['systemdservices']['chef-server'] = ['opscode-erchef']
default['redborder']['systemdservices']['consul'] = ['consul']
default['redborder']['systemdservices']['consul-client'] = ['consul']
default['redborder']['systemdservices']['druid-realtime'] = ['druid-realtime']
default['redborder']['systemdservices']['druid-coordinator'] = ['druid-coordinator']
default['redborder']['systemdservices']['druid-historical'] = ['druid-historical']
default['redborder']['systemdservices']['druid-broker'] = ['druid-broker']
default['redborder']['systemdservices']['kafka'] = ['kafka']
default['redborder']['systemdservices']['zookeeper'] = ['zookeeper']
default['redborder']['systemdservices']['webui'] = ['webui']
default['redborder']['systemdservices']['postgresql'] = ['postgresql']
default['redborder']['systemdservices']['redborder-postgresql'] = ['redborder-postgresql']
default['redborder']['systemdservices']['nginx'] = ['nginx']
default['redborder']['systemdservices']['redborder-cep'] = ['redborder-cep']
default['redborder']['systemdservices']['rb-aioutliers'] = ['rb-aioutliers']
default['redborder']['systemdservices']['rb-logstatter'] = ['rb-logstatter']
default['redborder']['systemdservices']['rb-arubacentral'] = ['rb-arubacentral']
default['redborder']['systemdservices']['memcached'] = ['memcached']
default['redborder']['systemdservices']['s3'] = ['minio']
default['redborder']['systemdservices']['mongodb'] = ['mongod']
default['redborder']['systemdservices']['redborder-monitor'] = ['redborder-monitor']
default['redborder']['systemdservices']['redborder-scanner'] = ['redborder-scanner']
default['redborder']['systemdservices']['snmp'] = ['snmpd']
default['redborder']['systemdservices']['f2k'] = ['f2k']
default['redborder']['systemdservices']['logstash'] = ['logstash']
default['redborder']['systemdservices']['pmacct'] = ['sfacctd']
default['redborder']['systemdservices']['redborder-dswatcher'] = ['redborder-dswatcher']
default['redborder']['systemdservices']['redborder-events-counter'] = ['redborder-events-counter']
default['redborder']['systemdservices']['http2k'] = ['http2k']
default['redborder']['systemdservices']['rsyslog'] = ['rsyslog']
default['redborder']['systemdservices']['redborder-nmsp'] = ['redborder-nmsp']
default['redborder']['systemdservices']['redborder-ale'] = ['redborder-ale']
default['redborder']['systemdservices']['n2klocd'] = ['n2klocd']
default['redborder']['systemdservices']['radiusd'] = ['radiusd']
default['redborder']['systemdservices']['postfix'] = ['postfix']
default['redborder']['systemdservices']['http2k'] = ['http2k']
default['redborder']['systemdservices']['rsyslog'] = ['rsyslog']
default['redborder']['systemdservices']['redborder-nmsp'] = ['redborder-nmsp']
default['redborder']['systemdservices']['redborder-ale'] = ['redborder-ale']
default['redborder']['systemdservices']['n2klocd'] = ['n2klocd']
default['redborder']['systemdservices']['radiusd'] = ['radiusd']
default['redborder']['systemdservices']['postfix'] = ['postfix']
default['redborder']['systemdservices']['keepalived'] = ['keepalived']

default['redborder']['manager']['balanced'] = [ { port: 443, protocol: 'tcp', name: 'redborder webui', service: 'webui', redirected_service: 'nginx', persistence_timeout: 9600 }, { port: 2055, protocol: 'udp', name: 'netflow,ipfix/sflow daemon', service: 'f2k', redirected_service: 'f2k', persistence_timeout: 30 }, { port: 6343, protocol: 'udp', name: 'sflow daemon', service: 'sfacctd', redirected_service: 'sfacctd', persistence_timeout: 30 }, { port: 9092, protocol: 'tcp', name: 'kafka', service: 'kafka', redirected_service: 'kafka', persistence_timeout: 30 } ]

# Tier
default['redborder']['druid']['historical']['tier'] = 'default'
default['redborder']['druid']['historical']['maxsize'] = -1

# Virtual Ips
default['redborder']['manager']['virtual_ips'] = { external: [ { service: 'webui', deps: ['nginx'] }, { service: 'f2k' }, { service: 'sfacctd' }, { service: 'kafka' } ] }

# Realtime
default['redborder']['druid']['realtime']['partition_num'] = 0

Expand Down
16 changes: 2 additions & 14 deletions resources/libraries/get_managers_all.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,10 @@ def get_managers_all
managers_keys.each do |m_key|
m = Chef::Node.load m_key
m = node if m.name == node.name
begin
roles = m.roles
rescue NoMethodError
begin
roles = m.run_list
rescue
roles = []
end
if m.role?('manager')
managers << m
end
next unless roles.nil?

next unless roles.include?('manager')

managers << m
end

managers
end
end
Expand Down
104 changes: 104 additions & 0 deletions resources/libraries/get_virtual_ip_info.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
module RbManager
module Helpers
def get_virtual_ip_info(managers)
virtual_ips = {}
ip_regex = /^([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])$/
has_any_virtual_ip = false
node['redborder']['manager']['virtual_ips'].each do |type, services|
virtual_ips[type.to_s] = {}
services.each do |service|
begin
virtual_dg = data_bag_item('rBglobal', "ipvirtual-#{type}-#{service['service']}")
rescue
virtual_dg = {}
end
hash = {}
hash['ip'] = virtual_dg['ip']
hash['loadbalance'] = (virtual_dg['loadbalance'].nil? ? true : virtual_dg['loadbalance'])
hash['service'] = service['service']
hash['enable'] = if virtual_dg['ip'] =~ ip_regex && !hash['ip'].nil?
true
else
false
end

if hash['enable']
hash['virtual'] = true
hash['run_anywhere'] = true
has_any_virtual_ip = true if hash['ip'] && manager_services[service['service']]
hash['iface'] = node['redborder']['management_interface']
if manager_services[service['service']]
all_deps_enabled = true
unless service['deps'].nil?
service['deps'].each do |srv_dep|
all_deps_enabled = false if manager_services[srv_dep].nil? || manager_services[srv_dep] == false
end
end
hash['enable'] = all_deps_enabled
else
hash['enable'] = false
end
else
# The virtual ip is not valid or it has not been specified. We need to set at least one
hash['virtual'] = false
hash['run_anywhere'] = false
nodeservice = nil
managers.each do |m|
hash['iface'] = node['redborder']['management_interface']
run_anywhere_flag = false

if m.name == node.name
run_anywhere_flag = manager_services[service['service']]
elsif !m['redborder'].nil? && !m['redborder']['manager'].nil? && !m['redborder']['manager']['services'].nil? && !m['redborder']['manager']['services']['current'].nil?
run_anywhere_flag = m['redborder']['manager']['services']['current'][service['service']]
end

if run_anywhere_flag && !m['redborder']['manager'][hash['iface']].nil?
nodeservice = m
break
end
end

if nodeservice.nil?
managers.each do |m|
hash['iface'] = node['redborder']['management_interface']
run_anywhere_flag = false
run_anywhere_flag = m['redborder']['manager']['services']['overwrite'][service['service']] unless m['redborder']['manager']['services']['overwrite'].nil?
run_anywhere_flag = m['redborder']['manager']['services'][m['redborder']['manager']['mode']][service['service']] if run_anywhere_flag != true && !m['redborder']['manager']['services'][m['redborder']['manager']['mode']].nil?
if run_anywhere_flag && !m['redborder']['manager'][hash['iface']].nil?
nodeservice = m
break
end
end
end

if !nodeservice.nil? && !nodeservice['redborder']['manager'][hash['iface']].nil?
hash['virtual'] = false
hash['ip'] = nodeservice['redborder']['manager'][hash['iface']]['ip']
hash['physical_ip'] = hash['ip']
hash['prefixlen'] = nodeservice['redborder']['manager'][hash['iface']]['prefixlen']
hash['run_anywhere'] = true
end
end
virtual_ips[type.to_s][service['service']] = hash
end
end

[virtual_ips, has_any_virtual_ip]
end

def get_virtual_ips_per_ip_info(virtual_ips)
virtual_ips_per_ip = {}
virtual_ips.each do |_type, data|
data.each.each do |_service, vi|
if vi['ip']
virtual_ips_per_ip[vi['ip']] = [] if virtual_ips_per_ip[vi['ip']].nil?
virtual_ips_per_ip[vi['ip']] << vi
end
end
end

virtual_ips_per_ip
end
end
end
3 changes: 2 additions & 1 deletion resources/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
maintainer_email '[email protected]'
license 'AGPL-3.0'
description 'Installs/Configures redborder manager'
version '2.0.1'
version '2.1.0'

depends 'rb-common'
depends 'chef-server'
Expand Down Expand Up @@ -42,3 +42,4 @@
depends 'rblogstatter'
depends 'rb-arubacentral'
depends 'rb-postfix'
depends 'keepalived'
Loading

0 comments on commit 6cc36c6

Please sign in to comment.