From c000ce6ab359c99bead42493bf110e3e6f712a14 Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Thu, 6 Jun 2024 14:07:55 +0300 Subject: [PATCH] main: move DSC creation after DSCIs one Reorder a bit to keep definition of cleanExistingResourceFunc next to the Add() call. Signed-off-by: Yauheni Kaliuta --- main.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index 3747357da6a..a3e1c931fb4 100644 --- a/main.go +++ b/main.go @@ -214,6 +214,14 @@ func main() { //nolint:funlen } } + // Create default DSC CR for managed RHODS + if platform == cluster.ManagedRhods { + if err := upgrade.CreateDefaultDSC(context.TODO(), setupClient); err != nil { + setupLog.Error(err, "unable to create default DSC CR by the operator") + os.Exit(1) + } + } + // Cleanup resources from previous v2 releases var cleanExistingResourceFunc manager.RunnableFunc = func(ctx context.Context) error { if err = upgrade.CleanupExistingResource(ctx, setupClient, platform, dscApplicationsNamespace, dscMonitoringNamespace); err != nil { @@ -222,13 +230,6 @@ func main() { //nolint:funlen return err } - // Create default DSC CR for managed RHODS - if platform == cluster.ManagedRhods { - if err := upgrade.CreateDefaultDSC(context.TODO(), setupClient); err != nil { - setupLog.Error(err, "unable to create default DSC CR by the operator") - os.Exit(1) - } - } err = mgr.Add(cleanExistingResourceFunc) if err != nil { setupLog.Error(err, "error remove deprecated resources from previous version")