From 81aebd4f82d7ba7fe6f50703d29a46acae45e2d3 Mon Sep 17 00:00:00 2001 From: tesla59 Date: Wed, 25 Sep 2024 11:56:27 +0000 Subject: [PATCH] core: (unorchestratedUpdates) update alert and throttling configs with other dynamic configs Signed-off-by: tesla59 --- KubeArmor/config/config.go | 7 ++++--- KubeArmor/core/unorchestratedUpdates.go | 7 +++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/KubeArmor/config/config.go b/KubeArmor/config/config.go index d26e7dd5f..461b847bc 100644 --- a/KubeArmor/config/config.go +++ b/KubeArmor/config/config.go @@ -299,9 +299,6 @@ func LoadConfig() error { GlobalCfg.StateAgent = viper.GetBool(ConfigStateAgent) - GlobalCfg.AlertThrottling = viper.GetBool(ConfigAlertThrottling) - GlobalCfg.MaxAlertPerSec = viper.GetInt(ConfigMaxAlertPerSec) - GlobalCfg.ThrottleSec = viper.GetInt(ConfigThrottleSec) GlobalCfg.AnnotateResources = viper.GetBool(ConfigAnnotateResources) LoadDynamicConfig() @@ -331,4 +328,8 @@ func LoadDynamicConfig() { GlobalCfg.HostVisibility = "none" } } + + GlobalCfg.AlertThrottling = viper.GetBool(ConfigAlertThrottling) + GlobalCfg.MaxAlertPerSec = viper.GetInt(ConfigMaxAlertPerSec) + GlobalCfg.ThrottleSec = viper.GetInt(ConfigThrottleSec) } diff --git a/KubeArmor/core/unorchestratedUpdates.go b/KubeArmor/core/unorchestratedUpdates.go index 4e62a2804..010e2137e 100644 --- a/KubeArmor/core/unorchestratedUpdates.go +++ b/KubeArmor/core/unorchestratedUpdates.go @@ -64,10 +64,6 @@ func (dm *KubeArmorDaemon) WatchConfigChanges() { Capabilities: dm.validateVisibility("capabilities", cfg.GlobalCfg.Visibility), } - // Log the current global posture and visibility - dm.Logger.Printf("Updating Global Posture to %v", globalPosture) - dm.Logger.Printf("Updating Visibility to %v", visibility) - // Apply the changes to the daemon dm.UpdateGlobalPosture(globalPosture) @@ -77,6 +73,9 @@ func (dm *KubeArmorDaemon) WatchConfigChanges() { dm.UpdateDefaultPosture("MODIFIED", ep.NamespaceName, globalPosture, false) dm.UpdateVisibility("MODIFIED", ep.NamespaceName, visibility) } + + // Update throttling configs + dm.SystemMonitor.UpdateThrottlingConfig() }) viper.WatchConfig() }