Skip to content

Commit b19d19c

Browse files
authored
refresh states of disabled modules on first converge (#549)
Signed-off-by: Mikhail Scherba <mikhail.scherba@flant.com>
1 parent 693cc49 commit b19d19c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pkg/addon-operator/operator.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,20 @@ func (op *AddonOperator) HandleConvergeModules(t sh_task.Task, logLabels map[str
826826
// Set ModulesToEnable list to properly run onStartup hooks for first converge.
827827
if !op.IsStartupConvergeDone() {
828828
state.ModulesToEnable = state.AllEnabledModules
829+
// send ModuleEvents for each disabled module on first converge to update dsabled modules' states (for the sake of disabled by <extender_name>)
830+
enabledModules := make(map[string]struct{}, len(state.AllEnabledModules))
831+
for _, enabledModule := range state.AllEnabledModules {
832+
enabledModules[enabledModule] = struct{}{}
833+
}
834+
835+
for _, moduleName := range op.ModuleManager.GetModuleNames() {
836+
if _, enabled := enabledModules[moduleName]; !enabled {
837+
op.ModuleManager.SendModuleEvent(events.ModuleEvent{
838+
ModuleName: moduleName,
839+
EventType: events.ModuleDisabled,
840+
})
841+
}
842+
}
829843
}
830844
tasks := op.CreateConvergeModulesTasks(state, t.GetLogLabels(), string(taskEvent))
831845

0 commit comments

Comments
 (0)