Skip to content

Commit

Permalink
main: move DSC creation after DSCIs one
Browse files Browse the repository at this point in the history
Reorder a bit to keep definition of cleanExistingResourceFunc next
to the Add() call.

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
  • Loading branch information
ykaliuta committed Jun 7, 2024
1 parent bd9b83c commit c000ce6
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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")
Expand Down

0 comments on commit c000ce6

Please sign in to comment.