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 1.9.1 #144

Merged
merged 10 commits into from
Jun 5, 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
19 changes: 18 additions & 1 deletion .github/workflows/rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,41 +26,58 @@ jobs:
echo "TAG=$TAG" >> $GITHUB_ENV
shell: bash

- name: Check if Tag Exists
id: check_tag
run: |
if git rev-parse "refs/tags/${{ env.TAG }}" >/dev/null 2>&1; then
echo "Tag ${{ env.TAG }} already exists, exiting."
exit 1
fi
shell: bash

- name: Set Version
if: success()
run: echo "VERSION=${{ env.TAG }}" >> $GITHUB_ENV

- name: Run Docker Container
if: success()
run: docker run --privileged -d --name builder --network host rockylinux:9 /bin/sleep infinity

- name: Install build tools RPM
if: success()
run: |
docker cp ./ builder:/build
docker exec builder bash -c "yum install -y epel-release && yum install -y make git mock"
docker exec builder bash -c "rm -rf /etc/mock/default.cfg"

- name: Setup SDK
if: success()
run: |
docker exec builder bash -c "curl https://raw.githubusercontent.com/redBorder/repoinit/master/sdk9.cfg > /build/sdk9.cfg"
docker exec builder bash -c "echo \"config_opts['use_host_resolv'] = True\" >> /build/sdk9.cfg"
docker exec builder bash -c "ln -s /build/sdk9.cfg /etc/mock/default.cfg"

- name: Build RPM using mock
if: success()
run: |
docker exec builder bash -c "git config --global --add safe.directory /build"
docker exec builder bash -c "cd /build/ && VERSION=${{ env.TAG }} make rpm"

- name: Copy RPMS
if: success()
run: |
docker cp builder:/build/packaging/rpm/pkgs/. ./rpms

- name: Delete non-.rpm files
if: success()
run: |
find ./rpms -type f -not -name '*.rpm' -exec rm {} \;

- name: Release
if: success()
uses: softprops/action-gh-release@v1
with:
files: ./rpms/*
tag_name: ${{ env.TAG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions CHANGELOG.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could change Merge pull request ... to a summarized description of what was changed in that branch

Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
cookbook-rb-manager CHANGELOG
===============

## 1.9.1

- David Vanhoucke
- [f22a469] add temporary variables in node.run_state
- Miguel Negrón
- [7d26b70] Update README.md
- [d29155f] Update rpm.yml
- [4a4efaa] Update metadata.rb
- [1120885] Merge pull request #142 from redBorder/bugfix/missing_specific_dist_kernel_info_in_motd
- [31682a0] Add full kernel release info in motd

## 1.9.0

- Miguel Negrón
Expand Down
33 changes: 13 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
# manager Cookbook
[![Build Status][build-shield]][build-url]
[![Linters][linters-shield]][linters-url]
[![License][license-shield]][license-url]

<!-- Badges -->
[build-shield]: https://github.com/redBorder/cookbook-rb-manager/actions/workflows/rpm.yml/badge.svg?branch=master
[build-url]: https://github.com/redBorder/cookbook-rb-manager/actions/workflows/rpm.yml?query=branch%3Amaster
[linters-shield]: https://github.com/redBorder/cookbook-rb-manager/actions/workflows/lint.yml/badge.svg?event=push
[linters-url]: https://github.com/redBorder/cookbook-rb-manager/actions/workflows/lint.yml
[license-shield]: https://img.shields.io/badge/license-AGPLv3-blue.svg
[license-url]: https://github.com/cookbook-rb-manager/blob/HEAD/LICENSE

Cookbook to configure a redborder manager

## Requirements

depends 'kafka', '0.0.1'
depends 'zookeeper', '0.0.1'

### Platforms

- Rocky Linux 9

### Chef

- Chef 12.0 or later

# BUILDING

- Build rpm package for redborder platform:
* git clone https://github.com/redborder/cookbook-rb-manager.git
* cd cookbook-rb-manager
* make
* RPM packages is under packaging/rpm/pkgs/
- Chef 15.7.0 or later

## Contributing

Expand All @@ -33,10 +31,5 @@ depends 'zookeeper', '0.0.1'
6. Submit a Pull Request using Github

## License
GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007

## Authors
Carlos Javier Mateos <[email protected]>
Juan Jesús Prieto <[email protected]>
Enrique Jimenez <[email protected]>
Alberto Rodríguez <[email protected]>
GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
2 changes: 1 addition & 1 deletion resources/libraries/get_pipelines.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Helpers

def get_pipelines()
logstash_pipelines = []
sensors = node["redborder"]["sensors_info_all"]
sensors = node.run_state["sensors_info_all"]
namespaces = get_namespaces()
main_logstash = determine_main_logstash_node()

Expand Down
12 changes: 5 additions & 7 deletions resources/metadata.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name 'rb-manager'
maintainer 'Miguel Negrón'
maintainer_email 'manegron@redborder.com'
license 'All rights reserved'
name 'rb-manager'
maintainer 'Eneo Tecnología S.L.'
maintainer_email 'git@redborder.com'
license 'AGPL-3.0'
description 'Installs/Configures redborder manager'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '1.9.0'
version '1.9.1'

depends 'rb-common'
depends 'chef-server'
Expand Down Expand Up @@ -37,7 +36,6 @@
depends 'freeradius'
depends 'rbcep'
depends 'cron'
# depends 'ohai'
depends 'rb-selinux'
depends 'rbaioutliers'
depends 'rbcgroup'
Expand Down
58 changes: 29 additions & 29 deletions resources/recipes/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,16 @@

rbmonitor_config "Configure redborder-monitor" do
name node["hostname"]
device_nodes node["redborder"]["sensors_info_all"]["device-sensor"]
flow_nodes node["redborder"]["sensors_info_all"]["flow-sensor"]
device_nodes node.run_state["sensors_info_all"]["device-sensor"]
flow_nodes node.run_state["sensors_info_all"]["flow-sensor"]
managers node["redborder"]["managers_list"]
cluster node["redborder"]["cluster_info"]
hostip node["redborder"]["cluster_info"][name]["ip"]
action (manager_services["redborder-monitor"] ? :add : :remove)
end

rbscanner_config "Configure redborder-scanner" do
scanner_nodes node["redborder"]["sensors_info_all"]["scanner-sensor"]
scanner_nodes node.run_state["sensors_info_all"]["scanner-sensor"]
action (manager_services["redborder-scanner"] ? [:add, :register] : [:remove, :deregister])
end

Expand Down Expand Up @@ -253,10 +253,10 @@
kafka_hosts node["redborder"]["managers_per_services"]["kafka"]
memory node["redborder"]["memory_services"]["http2k"]["memory"]
port node["redborder"]["http2k"]["port"]
proxy_nodes node["redborder"]["sensors_info"]["proxy-sensor"]
ips_nodes node["redborder"]["sensors_info"]["ips-sensor"]
ipsg_nodes node["redborder"]["sensors_info"]["ipsg-sensor"]
ipscp_nodes node["redborder"]["sensors_info"]["ipscp-sensor"]
proxy_nodes node.run_state["sensors_info"]["proxy-sensor"]
ips_nodes node.run_state["sensors_info"]["ips-sensor"]
ipsg_nodes node.run_state["sensors_info"]["ipsg-sensor"]
ipscp_nodes node.run_state["sensors_info"]["ipscp-sensor"]
organizations node["redborder"]["organizations"]
locations_list node["redborder"]["locations"]
action (manager_services["http2k"] ? [:add, :register] : [:remove, :deregister])
Expand All @@ -269,29 +269,29 @@
end

f2k_config "Configure f2k" do
sensors node["redborder"]["sensors_info"]["flow-sensor"]
sensors node.run_state["sensors_info"]["flow-sensor"]
action (manager_services["f2k"] ? [:add, :register] : [:remove, :deregister])
end

pmacct_config "Configure pmacct" do
sensors node["redborder"]["sensors_info"]["flow-sensor"]
sensors node.run_state["sensors_info"]["flow-sensor"]
kafka_hosts node["redborder"]["managers_per_services"]["kafka"]
action (manager_services["pmacct"] ? [:add, :register] : [:remove, :deregister])
end

if node["redborder"]["logstash"]["pipelines"].nil? || node["redborder"]["logstash"]["pipelines"].empty?
if node.run_state["pipelines"].nil? || node.run_state["pipelines"].empty?
service 'logstash' do
action [:disable, :stop]
end
else
logstash_config "Configure logstash" do
cdomain node["redborder"]["cdomain"]
flow_nodes node["redborder"]["all_flow_sensors_info"]["flow-sensor"]
namespaces node["redborder"]["namespaces"]
vault_nodes node["redborder"]["sensors_info_all"]["vault-sensor"]
scanner_nodes node["redborder"]["sensors_info_all"]["scanner-sensor"]
device_nodes node["redborder"]["sensors_info_all"]["device-sensor"]
logstash_pipelines node["redborder"]["logstash"]["pipelines"]
flow_nodes node.run_state["all_flow_sensors_info"]["flow-sensor"]
namespaces node.run_state["namespaces"]
vault_nodes node.run_state["sensors_info_all"]["vault-sensor"]
scanner_nodes node.run_state["sensors_info_all"]["scanner-sensor"]
device_nodes node.run_state["sensors_info_all"]["device-sensor"]
logstash_pipelines node.run_state["pipelines"]
action (manager_services["logstash"] ? [:add, :register] : [:remove, :deregister])
end
end
Expand All @@ -307,29 +307,29 @@
end

rsyslog_config "Configure rsyslog" do
vault_nodes node["redborder"]["sensors_info_all"]["vault-sensor"] + node["redborder"]["sensors_info_all"]["cep-sensor"]
ips_nodes node["redborder"]["sensors_info_all"]["ips-sensor"] + node["redborder"]["sensors_info_all"]["ipsv2-sensor"] + node["redborder"]["sensors_info_all"]["ipscp-sensor"]
vault_nodes node.run_state["sensors_info_all"]["vault-sensor"] + node.run_state["sensors_info_all"]["cep-sensor"]
ips_nodes node.run_state["sensors_info_all"]["ips-sensor"] + node.run_state["sensors_info_all"]["ipsv2-sensor"] + node.run_state["sensors_info_all"]["ipscp-sensor"]
action (manager_services["rsyslog"] ? [:add, :register] : [:remove, :deregister])
end

rbnmsp_config "Configure redborder-nmsp" do
memory node["redborder"]["memory_services"]["redborder-nmsp"]["memory"]
proxy_nodes node["redborder"]["sensors_info_all"]["proxy-sensor"]
flow_nodes node["redborder"]["sensors_info_all"]["flow-sensor"]
proxy_nodes node.run_state["sensors_info_all"]["proxy-sensor"]
flow_nodes node.run_state["sensors_info_all"]["flow-sensor"]
hosts node["redborder"]["zookeeper"]["zk_hosts"]
action (manager_services["redborder-nmsp"] ? [:add, :configure_keys, :register] : [:remove, :deregister])
end

n2klocd_config "Configure n2klocd" do
mse_nodes node["redborder"]["sensors_info_all"]["mse-sensor"]
meraki_nodes node["redborder"]["sensors_info_all"]["meraki-sensor"]
mse_nodes node.run_state["sensors_info_all"]["mse-sensor"]
meraki_nodes node.run_state["sensors_info_all"]["meraki-sensor"]
n2klocd_managers node["redborder"]["managers_per_services"]["n2klocd"]
memory node["redborder"]["memory_services"]["n2klocd"]["memory"]
action (manager_services["n2klocd"] ? [:add, :register] : [:remove, :deregister])
end

rbale_config "Configure redborder-ale" do
ale_nodes node["redborder"]["sensors_info_all"]["ale-sensor"]
ale_nodes node.run_state["sensors_info_all"]["ale-sensor"]
action (node["redborder"]["services"]["redborder-ale"] ? [:add, :register] : [:remove, :deregister])
end

Expand All @@ -338,13 +338,13 @@
end

rb_arubacentral_config "Configure rb-arubacentral" do
arubacentral_nodes node["redborder"]["sensors_info_all"]["arubacentral-sensor"]
flow_nodes node["redborder"]["sensors_info_all"]["flow-sensor"]
arubacentral_nodes node.run_state["sensors_info_all"]["arubacentral-sensor"]
flow_nodes node.run_state["sensors_info_all"]["flow-sensor"]
action (node["redborder"]["services"]["rb-arubacentral"] ? :add : :remove)
end

#freeradius_config "Configure radiusd" do
# flow_nodes node["redborder"]["sensors_info_all"]["flow-sensor"]
# flow_nodes node.run_state["sensors_info_all"]["flow-sensor"]
# action (node["redborder"]["services"]["radiusd"] ? [:config_common, :config_manager, :register] : [:remove, :deregister])
#end

Expand All @@ -353,9 +353,9 @@
end

rbcep_config "Configure redborder-cep" do
flow_nodes node["redborder"]["sensors_info_all"]["flow-sensor"]
vault_nodes node["redborder"]["sensors_info_all"]["vault-sensor"]
ips_nodes node["redborder"]["sensors_info_all"]["ips-sensor"] + node["redborder"]["sensors_info_all"]["ipsv2-sensor"] + node["redborder"]["sensors_info_all"]["ipscp-sensor"]
flow_nodes node.run_state["sensors_info_all"]["flow-sensor"]
vault_nodes node.run_state["sensors_info_all"]["vault-sensor"]
ips_nodes node.run_state["sensors_info_all"]["ips-sensor"] + node.run_state["sensors_info_all"]["ipsv2-sensor"] + node.run_state["sensors_info_all"]["ipscp-sensor"]
action (node["redborder"]["services"]["redborder-cep"] ? [:add, :register] : [:remove, :deregister])
end

Expand Down
10 changes: 5 additions & 5 deletions resources/recipes/prepare_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@
node.default["redborder"]["organizations"] = get_orgs() if node["redborder"]["services"]["http2k"]

#get sensors info
node.default["redborder"]["sensors_info"] = get_sensors_info()
node.run_state["sensors_info"] = get_sensors_info()

#get sensors info full info
node.default["redborder"]["sensors_info_all"] = get_sensors_all_info()
node.run_state["sensors_info_all"] = get_sensors_all_info()

#get sensors info of all flow sensors
node.default["redborder"]["all_flow_sensors_info"] = get_all_flow_sensors_info()
node.run_state["all_flow_sensors_info"] = get_all_flow_sensors_info()

#get logstash pipelines
node.default["redborder"]["logstash"]["pipelines"] = get_pipelines()
node.run_state["pipelines"] = get_pipelines()

#get namespaces
node.default["redborder"]["namespaces"] = get_namespaces
node.run_state["namespaces"] = get_namespaces

#get string with all zookeeper hosts and port separated by commas, its needed for multiples services
zk_port = node["redborder"]["zookeeper"]["port"]
Expand Down
2 changes: 1 addition & 1 deletion resources/templates/default/motd.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Welcome to '<%= node["redborder"]["manager"]["cluster_name"] %>' redborder cluster:
<% else %>
Welcome to redborder-ng Manager [<%= node["hostname"] %>.<%= node["redborder"]["cdomain"] %>] (<%= node['platform'] %> - <%= node['platform_version'] %>):
Kernel: <%= node['os_version'].gsub("el9", "") %>
Kernel: <%= node['os_version'] %>
<% end %>

<% if !node["redborder"].nil? and !node["redborder"]["rpms"].nil? %>
Expand Down
Loading