Skip to content

Commit

Permalink
core: (unorchestratedUpdates) update alert and throttling configs wit…
Browse files Browse the repository at this point in the history
…h other dynamic configs

Signed-off-by: tesla59 <[email protected]>
  • Loading branch information
tesla59 committed Sep 25, 2024
1 parent 9f81d10 commit 81aebd4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 4 additions & 3 deletions KubeArmor/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -331,4 +328,8 @@ func LoadDynamicConfig() {
GlobalCfg.HostVisibility = "none"
}
}

GlobalCfg.AlertThrottling = viper.GetBool(ConfigAlertThrottling)
GlobalCfg.MaxAlertPerSec = viper.GetInt(ConfigMaxAlertPerSec)
GlobalCfg.ThrottleSec = viper.GetInt(ConfigThrottleSec)
}
7 changes: 3 additions & 4 deletions KubeArmor/core/unorchestratedUpdates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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()
}
Expand Down

0 comments on commit 81aebd4

Please sign in to comment.