From 1f129952d9ccc8fd79deec663612b329d60dd844 Mon Sep 17 00:00:00 2001 From: Luis Blanco Date: Tue, 7 May 2024 11:28:50 +0100 Subject: [PATCH 01/13] exclude chef-client from memservice --- resources/recipes/prepare_system.rb | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/resources/recipes/prepare_system.rb b/resources/recipes/prepare_system.rb index 1bfa0ab..061486c 100644 --- a/resources/recipes/prepare_system.rb +++ b/resources/recipes/prepare_system.rb @@ -69,13 +69,4 @@ #getting total system memory less 10% reserved by system sysmem_total = (node["memory"]["total"].to_i * 0.90).to_i #node attributes related with memory are changed inside the function to have simplicity using recursivity -memory_services(sysmem_total) - - - - - - - - - +memory_services(sysmem_total, ['chef-client']) # Don't assign memory to chef because the service will get handled From 78b2ed78254e840c8aeb369ecc24a8fbd3dc71c8 Mon Sep 17 00:00:00 2001 From: Luis Blanco Date: Tue, 7 May 2024 12:06:57 +0100 Subject: [PATCH 02/13] excluded mem services is a new attribute of data structure set --- resources/attributes/default.rb | 3 +++ resources/recipes/prepare_system.rb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/attributes/default.rb b/resources/attributes/default.rb index bbf3870..d2c5fe1 100644 --- a/resources/attributes/default.rb +++ b/resources/attributes/default.rb @@ -1,3 +1,4 @@ +require 'set' #Default attributes #general @@ -41,6 +42,8 @@ default["redborder"]["memory_services"]["redborder-nmsp"] = {"count" => 10, "memory" => 0 } default["redborder"]["memory_services"]["n2klocd"] = {"count" => 10, "memory" => 0 } default["redborder"]["memory_services"]["k2http"] = {"count" => 10, "memory" => 0 } +# excluded mem services +default['redborder']['excluded_memservices'] = Set.new(['chef-client']) # Don't assign memory to chef because the service will get handled default["redborder"]["services"] = {} default["redborder"]["services"]["chef-client"] = true diff --git a/resources/recipes/prepare_system.rb b/resources/recipes/prepare_system.rb index 061486c..8ee6094 100644 --- a/resources/recipes/prepare_system.rb +++ b/resources/recipes/prepare_system.rb @@ -69,4 +69,4 @@ #getting total system memory less 10% reserved by system sysmem_total = (node["memory"]["total"].to_i * 0.90).to_i #node attributes related with memory are changed inside the function to have simplicity using recursivity -memory_services(sysmem_total, ['chef-client']) # Don't assign memory to chef because the service will get handled +memory_services(sysmem_total, node['redborder']['excluded_memservices']) From 021900eb4f159128da8b375deebbb2fd1322736c Mon Sep 17 00:00:00 2001 From: Luis Blanco Date: Tue, 7 May 2024 12:09:07 +0100 Subject: [PATCH 03/13] must provide excluded mem services --- resources/libraries/memory_services.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/libraries/memory_services.rb b/resources/libraries/memory_services.rb index a1d0ec2..c4ca0bc 100644 --- a/resources/libraries/memory_services.rb +++ b/resources/libraries/memory_services.rb @@ -1,6 +1,6 @@ module Rb_proxy module Helpers - def memory_services(sysmem_total, excluded_services=[]) + def memory_services(sysmem_total, excluded_services) memory_serv = {} memory_services_size = 0 memory_services_size_total = 0 From dfca0e649db642a069f6daf0acad751ee9fced93 Mon Sep 17 00:00:00 2001 From: Luis Blanco Date: Tue, 7 May 2024 12:09:43 +0100 Subject: [PATCH 04/13] lint --- resources/libraries/memory_services.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/libraries/memory_services.rb b/resources/libraries/memory_services.rb index c4ca0bc..7acdf99 100644 --- a/resources/libraries/memory_services.rb +++ b/resources/libraries/memory_services.rb @@ -50,4 +50,3 @@ def memory_services(sysmem_total, excluded_services) end end end - \ No newline at end of file From 6926d41ea1e9e0bb1138794b5e489ec644ae2eba Mon Sep 17 00:00:00 2001 From: Luis Blanco Date: Tue, 7 May 2024 12:43:26 +0100 Subject: [PATCH 05/13] Revert "must provide excluded mem services" This reverts commit 021900eb4f159128da8b375deebbb2fd1322736c. --- resources/libraries/memory_services.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/libraries/memory_services.rb b/resources/libraries/memory_services.rb index 7acdf99..f464b41 100644 --- a/resources/libraries/memory_services.rb +++ b/resources/libraries/memory_services.rb @@ -1,6 +1,6 @@ module Rb_proxy module Helpers - def memory_services(sysmem_total, excluded_services) + def memory_services(sysmem_total, excluded_services=[]) memory_serv = {} memory_services_size = 0 memory_services_size_total = 0 From 64690cd30f204b5088f8f84492ea47e5085808da Mon Sep 17 00:00:00 2001 From: Luis Blanco Date: Tue, 7 May 2024 12:44:51 +0100 Subject: [PATCH 06/13] normalization --- resources/attributes/default.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/attributes/default.rb b/resources/attributes/default.rb index d2c5fe1..829b403 100644 --- a/resources/attributes/default.rb +++ b/resources/attributes/default.rb @@ -1,4 +1,4 @@ -require 'set' +# require 'set' TODO: refactor to this #Default attributes #general @@ -43,7 +43,8 @@ default["redborder"]["memory_services"]["n2klocd"] = {"count" => 10, "memory" => 0 } default["redborder"]["memory_services"]["k2http"] = {"count" => 10, "memory" => 0 } # excluded mem services -default['redborder']['excluded_memservices'] = Set.new(['chef-client']) # Don't assign memory to chef because the service will get handled +# default['redborder']['excluded_memservices'] = Set.new(['chef-client']) TODO: refactor to this +default['redborder']['excluded_memservices'] = ['chef-client'] # Don't assign memory to chef because the service will get handled default["redborder"]["services"] = {} default["redborder"]["services"]["chef-client"] = true From 8d08754908ebf56d0aef371b098dc7cd5c976ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81lvarez?= <128592227+malvads@users.noreply.github.com> Date: Tue, 7 May 2024 13:05:16 +0100 Subject: [PATCH 07/13] Update default.rb --- resources/attributes/default.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/attributes/default.rb b/resources/attributes/default.rb index 829b403..c4a5136 100644 --- a/resources/attributes/default.rb +++ b/resources/attributes/default.rb @@ -44,7 +44,7 @@ default["redborder"]["memory_services"]["k2http"] = {"count" => 10, "memory" => 0 } # excluded mem services # default['redborder']['excluded_memservices'] = Set.new(['chef-client']) TODO: refactor to this -default['redborder']['excluded_memservices'] = ['chef-client'] # Don't assign memory to chef because the service will get handled +default['redborder']['excluded_memory_services'] = ['chef-client'] # Don't assign memory to chef because the service will get handled default["redborder"]["services"] = {} default["redborder"]["services"]["chef-client"] = true From 48fe519edadc5c93da056f151e120e5a21c8ec49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81lvarez?= <128592227+malvads@users.noreply.github.com> Date: Tue, 7 May 2024 13:05:28 +0100 Subject: [PATCH 08/13] Update prepare_system.rb --- resources/recipes/prepare_system.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/recipes/prepare_system.rb b/resources/recipes/prepare_system.rb index 8ee6094..2a6aa4d 100644 --- a/resources/recipes/prepare_system.rb +++ b/resources/recipes/prepare_system.rb @@ -69,4 +69,4 @@ #getting total system memory less 10% reserved by system sysmem_total = (node["memory"]["total"].to_i * 0.90).to_i #node attributes related with memory are changed inside the function to have simplicity using recursivity -memory_services(sysmem_total, node['redborder']['excluded_memservices']) +memory_services(sysmem_total, node['redborder']['excluded_memory_services']) From 47c06c842b746a3a27495146b469010231f9a8fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81lvarez?= <128592227+malvads@users.noreply.github.com> Date: Wed, 8 May 2024 15:17:22 +0100 Subject: [PATCH 09/13] Clean comments --- resources/attributes/default.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/attributes/default.rb b/resources/attributes/default.rb index c4a5136..c94d595 100644 --- a/resources/attributes/default.rb +++ b/resources/attributes/default.rb @@ -42,9 +42,9 @@ default["redborder"]["memory_services"]["redborder-nmsp"] = {"count" => 10, "memory" => 0 } default["redborder"]["memory_services"]["n2klocd"] = {"count" => 10, "memory" => 0 } default["redborder"]["memory_services"]["k2http"] = {"count" => 10, "memory" => 0 } -# excluded mem services -# default['redborder']['excluded_memservices'] = Set.new(['chef-client']) TODO: refactor to this -default['redborder']['excluded_memory_services'] = ['chef-client'] # Don't assign memory to chef because the service will get handled + +# exclude mem services, setting memory to 0 for each. +default['redborder']['excluded_memory_services'] = ['chef-client'] default["redborder"]["services"] = {} default["redborder"]["services"]["chef-client"] = true From 86466b0c8f300cea691012767486f9e3e1d6b233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81lvarez?= <128592227+malvads@users.noreply.github.com> Date: Wed, 8 May 2024 15:17:51 +0100 Subject: [PATCH 10/13] Update prepare_system.rb --- resources/recipes/prepare_system.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/recipes/prepare_system.rb b/resources/recipes/prepare_system.rb index 2a6aa4d..43358c6 100644 --- a/resources/recipes/prepare_system.rb +++ b/resources/recipes/prepare_system.rb @@ -69,4 +69,4 @@ #getting total system memory less 10% reserved by system sysmem_total = (node["memory"]["total"].to_i * 0.90).to_i #node attributes related with memory are changed inside the function to have simplicity using recursivity -memory_services(sysmem_total, node['redborder']['excluded_memory_services']) +memory_services(sysmem_total) From fe69f8ff8f174728ff2a76458acd2eb21fbdf1a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81lvarez?= <128592227+malvads@users.noreply.github.com> Date: Wed, 8 May 2024 15:20:18 +0100 Subject: [PATCH 11/13] Update memory_services.rb --- resources/libraries/memory_services.rb | 29 ++++++++++++++------------ 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/resources/libraries/memory_services.rb b/resources/libraries/memory_services.rb index f464b41..df3be73 100644 --- a/resources/libraries/memory_services.rb +++ b/resources/libraries/memory_services.rb @@ -9,7 +9,9 @@ def memory_services(sysmem_total, excluded_services=[]) node["redborder"]["memory_services"].each do |name,mem_s| if node["redborder"]["services"][name] and !excluded_services.include?(name) - memory_services_size = memory_services_size + mem_s["count"] + if !node["redborder"]["excluded_memory_services"].include?(name) + memory_services_size = memory_services_size + mem_s["count"] + end end memory_services_size_total = memory_services_size_total + mem_s["count"] end @@ -24,18 +26,19 @@ def memory_services(sysmem_total, excluded_services=[]) node["redborder"]["memory_services"].each do |name,mem_s| if node["redborder"]["services"][name] and !excluded_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 - #if the service has a limit of memory, we have to recalculate all using recursivity - if !mem_s["max_limit"].nil? and memory_serv[name] > mem_s["max_limit"] - memlimit_found = true - excluded_services << name - #assigning the limit of memory for this service - node.default["redborder"]["memory_services"][name]["memory"] = mem_s["max_limit"] - #now we have to take off the memory excluded from the total to recalculate memory wihout excluded services by limit - sysmem_total_limitsless = sysmem_total - mem_s["max_limit"] - end + if !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 + #if the service has a limit of memory, we have to recalculate all using recursivity + if !mem_s["max_limit"].nil? and memory_serv[name] > mem_s["max_limit"] + memlimit_found = true + excluded_services << name + #assigning the limit of memory for this service + node.default["redborder"]["memory_services"][name]["memory"] = mem_s["max_limit"] + #now we have to take off the memory excluded from the total to recalculate memory wihout excluded services by limit + sysmem_total_limitsless = sysmem_total - mem_s["max_limit"] + end + end end end From 59ce33e9117a0cfe4bbf04d7a7579a9e79328f0c Mon Sep 17 00:00:00 2001 From: JuanSheba Date: Fri, 10 May 2024 15:11:44 +0100 Subject: [PATCH 12/13] Release 0.1.6 --- CHANGELOG.md | 16 ++++++++++++++++ resources/metadata.rb | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd706c1..d031511 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,22 @@ cookbook-rb-proxy CHANGELOG =============== +## 0.1.6 + + - Miguel Álvarez + - [fe69f8f] Update memory_services.rb + - [86466b0] Update prepare_system.rb + - [47c06c8] Clean comments + - [48fe519] Update prepare_system.rb + - [8d08754] Update default.rb + - Luis Blanco + - [64690cd] normalization + - [6926d41] Revert "must provide excluded mem services" + - [dfca0e6] lint + - [021900e] must provide excluded mem services + - [78b2ed7] excluded mem services is a new attribute of data structure set + - [1f12995] exclude chef-client from memservice + ## 0.1.5 - David Vanhoucke diff --git a/resources/metadata.rb b/resources/metadata.rb index b450972..525a6fb 100644 --- a/resources/metadata.rb +++ b/resources/metadata.rb @@ -4,7 +4,7 @@ license 'All rights reserved' description 'Installs/Configures redborder proxy' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '0.1.5' +version '0.1.6' depends 'rb-selinux' depends 'zookeeper' From 7ade8ff664ccf7808e34de43f52f701553e4f63a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81lvarez?= <128592227+malvads@users.noreply.github.com> Date: Fri, 10 May 2024 15:18:02 +0100 Subject: [PATCH 13/13] Update CHANGELOG.md --- CHANGELOG.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d031511..42f4563 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,13 +9,6 @@ cookbook-rb-proxy CHANGELOG - [47c06c8] Clean comments - [48fe519] Update prepare_system.rb - [8d08754] Update default.rb - - Luis Blanco - - [64690cd] normalization - - [6926d41] Revert "must provide excluded mem services" - - [dfca0e6] lint - - [021900e] must provide excluded mem services - - [78b2ed7] excluded mem services is a new attribute of data structure set - - [1f12995] exclude chef-client from memservice ## 0.1.5