diff --git a/pkg/addon-operator/operator.go b/pkg/addon-operator/operator.go index 63940930..6ca4521d 100644 --- a/pkg/addon-operator/operator.go +++ b/pkg/addon-operator/operator.go @@ -826,6 +826,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 ) + 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)) diff --git a/pkg/helm/helm3/helm3.go b/pkg/helm/helm3/helm3.go index 620b708b..e6d87a96 100644 --- a/pkg/helm/helm3/helm3.go +++ b/pkg/helm/helm3/helm3.go @@ -142,6 +142,7 @@ func (h *Helm3Client) UpgradeRelease(releaseName string, chart string, valuesPat args := []string{ "upgrade", releaseName, chart, "--install", + "--skip-crds", "--history-max", fmt.Sprintf("%d", Options.HistoryMax), "--timeout", Options.Timeout.String(), "--post-renderer", "./post-renderer", diff --git a/pkg/helm/helm3lib/helm3lib.go b/pkg/helm/helm3lib/helm3lib.go index 68952b9a..1da074fc 100644 --- a/pkg/helm/helm3lib/helm3lib.go +++ b/pkg/helm/helm3lib/helm3lib.go @@ -189,6 +189,7 @@ func (h *LibClient) upgradeRelease(releaseName string, chartName string, valuesP } upg.Install = true + upg.SkipCRDs = true upg.MaxHistory = int(options.HistoryMax) upg.Timeout = options.Timeout @@ -235,6 +236,7 @@ func (h *LibClient) upgradeRelease(releaseName string, chartName string, valuesP if helmPostRenderer != nil { instClient.PostRenderer = helmPostRenderer } + instClient.SkipCRDs = true instClient.Timeout = options.Timeout instClient.ReleaseName = releaseName instClient.UseReleaseName = true @@ -434,14 +436,14 @@ func (h *LibClient) Render(releaseName, chartName string, valuesPaths, setValues slog.String("chart", chartName), slog.String("namespace", namespace)) - inst := newInstAction(namespace, releaseName) + inst := newDryRunInstAction(namespace, releaseName) rs, err := inst.Run(chart, resultValues) if err != nil { // helm render can fail because the CRD were previously created // handling this case we can reinitialize RESTClient and repeat one more time by backoff _ = h.actionConfigInit() - inst = newInstAction(namespace, releaseName) + inst = newDryRunInstAction(namespace, releaseName) rs, err = inst.Run(chart, resultValues) } @@ -462,7 +464,7 @@ func (h *LibClient) Render(releaseName, chartName string, valuesPaths, setValues return rs.Manifest, nil } -func newInstAction(namespace, releaseName string) *action.Install { +func newDryRunInstAction(namespace, releaseName string) *action.Install { inst := action.NewInstall(actionConfig) inst.DryRun = true