Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 3.0.0 #55

Merged
merged 5 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
cookbook-rb-proxy CHANGELOG
===============

## 3.0.0

- Miguel Negrón
- [9a6edd4] Merge pull request #54 from redBorder/improvement/#18961_service_list_without_chef

## 2.1.0

- Miguel Negrón
Expand Down
64 changes: 29 additions & 35 deletions resources/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,56 +24,50 @@

# memory
default['redborder']['memory_services'] = {}
default['redborder']['memory_services']['kafka'] = { 'count': 150, 'memory': 0, 'max_limit': 524288 }
default['redborder']['memory_services']['zookeeper'] = { 'count': 20, 'memory': 0 }
default['redborder']['memory_services']['chef-client'] = { 'count': 10, 'memory': 0 }
default['redborder']['memory_services']['http2k'] = { 'count': 10, 'memory': 0 }
default['redborder']['memory_services']['chef-server'] = { 'count': 10, 'memory': 0 }
default['redborder']['memory_services']['snmp'] = { 'count': 5, 'memory': 0, 'max_limit': 10000 }
default['redborder']['memory_services']['redborder-monitor'] = { 'count': 5, 'memory': 0, 'max_limit': 20000 }
default['redborder']['memory_services']['f2k'] = { 'count': 40, 'memory': 0 }
default['redborder']['memory_services']['redborder-nmsp'] = { 'count': 10, 'memory': 0 }
default['redborder']['memory_services']['n2klocd'] = { 'count': 10, 'memory': 0 }
default['redborder']['memory_services']['http2k'] = { 'count': 10, 'memory': 0 }
default['redborder']['memory_services']['k2http'] = { 'count': 10, 'memory': 0 }

# exclude mem services, setting memory to 0 for each.
default['redborder']['excluded_memory_services'] = ['chef-client']
default['redborder']['memory_services']['kafka'] = { 'count': 150, 'memory': 0, 'max_limit': 524288 }
default['redborder']['memory_services']['n2klocd'] = { 'count': 10, 'memory': 0 }
default['redborder']['memory_services']['redborder-monitor'] = { 'count': 5, 'memory': 0, 'max_limit': 20000 }
default['redborder']['memory_services']['redborder-nmsp'] = { 'count': 10, 'memory': 0 }
default['redborder']['memory_services']['snmp'] = { 'count': 5, 'memory': 0, 'max_limit': 10000 }
default['redborder']['memory_services']['zookeeper'] = { 'count': 20, 'memory': 0 }

default['redborder']['services'] = {}
default['redborder']['services']['chef-client'] = true
default['redborder']['services']['kafka'] = true
default['redborder']['services']['zookeeper'] = true
default['redborder']['services']['rb-monitor'] = true
default['redborder']['services']['redborder-monitor'] = true
default['redborder']['services']['redborder-scanner'] = true
default['redborder']['services']['snmp'] = true
default['redborder']['services']['chrony'] = true
default['redborder']['services']['f2k'] = true
default['redborder']['services']['k2http'] = true
default['redborder']['services']['kafka'] = true
default['redborder']['services']['logstash'] = false
default['redborder']['services']['pmacct'] = true
default['redborder']['services']['rsyslog'] = true
default['redborder']['services']['redborder-nmsp'] = true
default['redborder']['services']['redborder-ale'] = false
default['redborder']['services']['n2klocd'] = true
default['redborder']['services']['pmacct'] = true
default['redborder']['services']['radiusd'] = false
default['redborder']['services']['k2http'] = true
default['redborder']['services']['redborder-ale'] = false
default['redborder']['services']['redborder-exporter'] = true
default['redborder']['services']['clamav'] = true
default['redborder']['services']['chrony'] = true
default['redborder']['services']['redborder-monitor'] = true
default['redborder']['services']['redborder-nmsp'] = true
default['redborder']['services']['redborder-scanner'] = true
default['redborder']['services']['rsyslog'] = true
default['redborder']['services']['snmp'] = true
default['redborder']['services']['zookeeper'] = true

default['redborder']['systemdservices']['chef-client'] = ['chef-client']
default['redborder']['systemdservices']['kafka'] = ['kafka']
default['redborder']['systemdservices']['zookeeper'] = ['zookeeper']
default['redborder']['systemdservices']['redborder-monitor'] = ['redborder-monitor']
default['redborder']['systemdservices']['redborder-scanner'] = ['redborder-scanner']
default['redborder']['systemdservices']['snmp'] = ['snmpd']
default['redborder']['systemdservices']['chrony'] = ['chronyd']
default['redborder']['systemdservices']['f2k'] = ['f2k']
default['redborder']['systemdservices']['k2http'] = ['k2http']
default['redborder']['systemdservices']['kafka'] = ['kafka']
default['redborder']['systemdservices']['logstash'] = ['logstash']
default['redborder']['systemdservices']['pmacct'] = ['sfacctd']
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']['pmacct'] = ['sfacctd']
default['redborder']['systemdservices']['radiusd'] = ['radiusd']
default['redborder']['systemdservices']['k2http'] = ['k2http']
default['redborder']['systemdservices']['redborder-ale'] = ['redborder-ale']
default['redborder']['systemdservices']['redborder-exporter'] = ['rb-exporter']
default['redborder']['systemdservices']['chrony'] = ['chronyd']
default['redborder']['systemdservices']['redborder-monitor'] = ['redborder-monitor']
default['redborder']['systemdservices']['redborder-nmsp'] = ['redborder-nmsp']
default['redborder']['systemdservices']['redborder-scanner'] = ['redborder-scanner']
default['redborder']['systemdservices']['rsyslog'] = ['rsyslog']
default['redborder']['systemdservices']['snmp'] = ['snmpd']
default['redborder']['systemdservices']['zookeeper'] = ['zookeeper']
6 changes: 1 addition & 5 deletions resources/libraries/memory_services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ def memory_services(sysmem_total, excluded_services = [])

node['redborder']['memory_services'].each do |name, mem_s|
if node['redborder']['services'][name] && !excluded_services.include?(name)
unless node['redborder']['excluded_memory_services'].include?(name)
memory_services_size += mem_s['count']
end
memory_services_size += mem_s['count']
end

memory_services_size_total += mem_s['count']
Expand All @@ -24,8 +22,6 @@ def memory_services(sysmem_total, excluded_services = [])
node['redborder']['memory_services'].each do |name, mem_s|
next unless node['redborder']['services'][name] && !excluded_services.include?(name)

next unless !node['redborder']['excluded_memory_services'].include?(name)

# service count memory assigned * system memory / assigned services memory size
memory_serv[name] = (mem_s['count'] * sysmem_total / memory_services_size).round

Expand Down
2 changes: 1 addition & 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 proxy'
version '2.1.0'
version '3.0.0'

depends 'rb-common'
depends 'rb-selinux'
Expand Down
2 changes: 1 addition & 1 deletion resources/recipes/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
end

rb_clamav_config 'Configure ClamAV' do
action(proxy_services['clamav'] ? :add : :remove)
action :add
end

rb_chrony_config 'Configure Chrony' do
Expand Down
12 changes: 12 additions & 0 deletions resources/recipes/prepare_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,15 @@
retries 2
variables(hosts_entries: hosts_entries)
end

# Build service list for rbcli
services = node['redborder']['services'] || []
systemd_services = node['redborder']['systemdservices'] || []
service_enablement = {}

systemd_services.each do |service_name, systemd_name|
service_enablement[systemd_name.first] = services[service_name]
end

Chef::Log.info('Saving services enablement into /etc/redborder/services.json')
File.write('/etc/redborder/services.json', JSON.pretty_generate(service_enablement))
Loading