Skip to content

Commit

Permalink
refresh states of disabled modules on first converge
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail Scherba <[email protected]>
  • Loading branch information
miklezzzz committed Dec 29, 2024
1 parent 7c39f50 commit fd89c09
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/addon-operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,20 @@ func (op *AddonOperator) HandleConvergeModules(t sh_task.Task, logLabels map[str
// Set ModulesToEnable list to properly run onStartup hooks for first converge.
if !op.IsStartupConvergeDone() {
state.ModulesToEnable = state.AllEnabledModules
// send ModuleEvents for each disabled module on first converge to update dsabled modules' states (for the sake of disabled by <extender_name>)
enabledModules := make(map[string]struct{}, len(state.AllEnabledModules))
for _, enabledModule := range state.AllEnabledModules {
enabledModules[enabledModule] = struct{}{}
}

for _, moduleName := range op.ModuleManager.GetModuleNames() {
if _, enabled := enabledModules[moduleName]; !enabled {
op.ModuleManager.SendModuleEvent(events.ModuleEvent{
ModuleName: moduleName,
EventType: events.ModuleDisabled,
})
}
}
}
tasks := op.CreateConvergeModulesTasks(state, t.GetLogLabels(), string(taskEvent))

Expand Down

0 comments on commit fd89c09

Please sign in to comment.