Skip to content

Commit

Permalink
Merge branch 'master' into feature/#18850_add_internal_virtual_ips
Browse files Browse the repository at this point in the history
  • Loading branch information
rgomezborder committed Nov 13, 2024
2 parents 8fbd6e6 + 575316e commit 2518bb3
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 76 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
cookbook-rb-manager CHANGELOG
===============

## 4.4.7

- Rafael Gomez
- [a50d54f] Changing riak service to s3
- [787d0ae] Passing hd_services_current maxsize to druid-historical
- [55d679c] First version of harddisk_services NG

## 4.4.6

- Miguel Álvarez
- [7930ce6] Make same check for logstatter and logstash to configure

## 4.4.5

- Daniel Castro
- [77547bd] create sudoers file before redborder-monitor install

## 4.4.4

- ptorresred
Expand Down
4 changes: 2 additions & 2 deletions resources/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
default['redborder']['manager']['hd_services'] = [
{ 'name': 'kafka', 'count': 5, 'prefered': 'aggregate' },
{ 'name': 'zookeeper', 'count': 1, 'prefered': 'aggregate' },
{ 'name': 'riak', 'count': 50, 'prefered': 'raw' },
{ 'name': 'druid_historical', 'count': 50, 'prefered': 'raw' },
{ 'name': 's3', 'count': 50, 'prefered': 'raw' },
{ 'name': 'druid-historical', 'count': 50, 'prefered': 'raw' },
]

default['redborder']['manager']['hd_services_current'] = {}
Expand Down
77 changes: 14 additions & 63 deletions resources/libraries/harddisk_services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,24 @@ module RbManager
module Helpers
def harddisk_services
hd_services = {}

root_dev = node['redborder']['manager']['data_dev']['root']
raw_dev = node['redborder']['manager']['data_dev']['raw']
aggregate_dev = node['redborder']['manager']['data_dev']['aggregate']

root_dev = node['filesystem'].keys.first if node['filesystem'][root_dev].nil?
if node['filesystem'][raw_dev].nil? && node['filesystem'][aggregate_dev].nil?
raw_dev = root_dev
aggregate_dev = root_dev
elsif node['filesystem'][raw_dev].nil?
raw_dev = aggregate_dev
elsif node['filesystem'][aggregate_dev].nil?
aggregate_dev = raw_dev
end

hd_services_dev = {}
hd_services_dev['root'] = root_dev
hd_services_dev['raw'] = raw_dev
hd_services_dev['aggregate'] = aggregate_dev

hd_services_size = {}
hd_services_size[root_dev] = 0
hd_services_size[raw_dev] = 0
hd_services_size[aggregate_dev] = 0

hd_services_size_total = {}
hd_services_size_total[root_dev] = 0
hd_services_size_total[raw_dev] = 0
hd_services_size_total[aggregate_dev] = 0

maxsize = {}
hd_services_dev.each do |type, device|
maxsize[type] = if node['filesystem'][device].nil?
300_000_000_000
else
filesystem_data = node['filesystem'][device]
root_device = hd_services_dev['root']
size_kb = filesystem_data['kb_size'] || node['filesystem'][root_device]['kb_size']
size_bytes = size_kb.to_i * 1024
size_bytes -= 7 * 1024 * 1024 * 1024 if device == root_device
[size_bytes, 0].max
end
end
node['redborder']['manager']['hd_services'].each do |s|
if node['redborder']['services'][s[:name]]
hd_services_size[hd_services_dev[s[:prefered]]] += s[:count]
end
hd_services_size_total[hd_services_dev[s[:prefered]]] += s[:count]
root_dev_kb = node['filesystem']['by_mountpoint']['/']['kb_size']
size_bytes = root_dev_kb.to_i * 1024
size_bytes -= 7 * 1024 * 1024 * 1024
maxsize = size_bytes

hd_services_dev = node['redborder']['manager']['hd_services'].map do |service|
{
name: service[:name],
count: node['redborder']['services'][service[:name]] ? service[:count] + 1 : service[:count],
}
end

node['redborder']['manager']['hd_services'].each do |service|
preferred_device = hd_services_dev[service[:prefered]]
preferred_size = hd_services_size[preferred_device]
total_size = hd_services_size_total[preferred_device]

size = if preferred_size > 0
preferred_size
else
total_size > 0 ? total_size : 1
end

service_count = service[:count].to_i
max_preferred_size = maxsize[service[:prefered]].to_i
hd_services[service[:name]] = ((service_count * max_preferred_size * 0.90) / size.to_f) / (1024 * 1024)
hd_services_dev.each do |service|
service_count = service[:count].to_f / 100
hd_services[service[:name]] = service_count * maxsize * 0.90
end

hd_services
hd_services # hard disk services sizes are pased in bytes
end
end
end
2 changes: 1 addition & 1 deletion resources/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
maintainer_email '[email protected]'
license 'AGPL-3.0'
description 'Installs/Configures redborder manager'
version '4.4.4'
version '4.4.7'

depends 'rb-common'
depends 'chef-server'
Expand Down
21 changes: 11 additions & 10 deletions resources/recipes/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
end
end

# Sudoers
template '/etc/sudoers.d/redborder-manager' do
source 'redborder-manager.erb'
owner 'root'
group 'root'
mode '0440'
retries 2
end

consul_config 'Configure Consul Server' do
cdomain node['redborder']['cdomain']
dns_local_ip node['consul']['dns_local_ip']
Expand Down Expand Up @@ -195,6 +204,7 @@
name node['hostname']
ipaddress node['ipaddress_sync']
memory_kb node['redborder']['memory_services']['druid-historical']['memory']
maxsize node['redborder']['manager']['hd_services_current']['druid-historical'].to_i
action [:add, :register]
else
action [:remove, :deregister]
Expand Down Expand Up @@ -491,7 +501,7 @@
end

rblogstatter_config 'Configure redborder-logstatter' do
if manager_services['rb-logstatter']
if manager_services['rb-logstatter'] && manager_services['logstash'] && node.run_state['pipelines'] && !node.run_state['pipelines'].empty?
action :add
else
action :remove
Expand Down Expand Up @@ -667,15 +677,6 @@
end
end

# Sudoers
template '/etc/sudoers.d/redborder-manager' do
source 'redborder-manager.erb'
owner 'root'
group 'root'
mode '0440'
retries 2
end

# Pending Changes..
# pending_changes==0 -> has changes to apply at next chef-client run
# pending_changes==1 -> chef-client has to run once
Expand Down

0 comments on commit 2518bb3

Please sign in to comment.