diff --git a/main.go b/main.go index a3e1c931fb4..7e4e9971142 100644 --- a/main.go +++ b/main.go @@ -216,12 +216,19 @@ 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") + var createDefaultDSCFunc manager.RunnableFunc = func(ctx context.Context) error { + err := upgrade.CreateDefaultDSC(context.TODO(), setupClient) + if err != nil { + setupLog.Error(err, "unable to create default DSC CR by the operator") + } + return err + } + err := mgr.Add(createDefaultDSCFunc) + if err != nil { + setupLog.Error(err, "error scheduling DSC creation") 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 { diff --git a/pkg/upgrade/upgrade.go b/pkg/upgrade/upgrade.go index 064bc087a8a..b2e478198fb 100644 --- a/pkg/upgrade/upgrade.go +++ b/pkg/upgrade/upgrade.go @@ -102,7 +102,7 @@ func CreateDefaultDSC(ctx context.Context, cli client.Client) error { }, }, } - err := cli.Create(ctx, releaseDataScienceCluster) + err := cluster.CreateWithRetry(ctx, cli, releaseDataScienceCluster, 1) // 1 min timeout switch { case err == nil: fmt.Printf("created DataScienceCluster resource\n")