From b5021363c889d7c00b9ec3f95403a734e53b34dd Mon Sep 17 00:00:00 2001 From: VaishnaviHire Date: Tue, 18 Jun 2024 08:10:32 -0400 Subject: [PATCH] Fix linter errors --- components/kserve/kserve_config_handler.go | 1 - components/workbenches/workbenches.go | 2 +- controllers/dscinitialization/suite_test.go | 1 - pkg/cluster/resources.go | 13 +++++++++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/components/kserve/kserve_config_handler.go b/components/kserve/kserve_config_handler.go index b455f29fe0d..878be34e590 100644 --- a/components/kserve/kserve_config_handler.go +++ b/components/kserve/kserve_config_handler.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" - "github.com/hashicorp/go-multierror" operatorv1 "github.com/openshift/api/operator/v1" corev1 "k8s.io/api/core/v1" diff --git a/components/workbenches/workbenches.go b/components/workbenches/workbenches.go index 133d040080f..484b5d4f0cc 100644 --- a/components/workbenches/workbenches.go +++ b/components/workbenches/workbenches.go @@ -151,7 +151,7 @@ func (w *Workbenches) ReconcileComponent(ctx context.Context, cli client.Client, } } } - if err = deploy.DeployManifestsFromPath(cli, owner, + if err := deploy.DeployManifestsFromPath(cli, owner, kfnotebookControllerPath, dscispec.ApplicationsNamespace, ComponentName, enabled); err != nil { diff --git a/controllers/dscinitialization/suite_test.go b/controllers/dscinitialization/suite_test.go index 0553ebb5d65..1f4be094535 100644 --- a/controllers/dscinitialization/suite_test.go +++ b/controllers/dscinitialization/suite_test.go @@ -25,7 +25,6 @@ import ( routev1 "github.com/openshift/api/route/v1" userv1 "github.com/openshift/api/user/v1" ofapi "github.com/operator-framework/api/pkg/operators/v1alpha1" - ofapiv2 "github.com/operator-framework/api/pkg/operators/v2" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" diff --git a/pkg/cluster/resources.go b/pkg/cluster/resources.go index 94a3b9b26b1..018d5731dac 100644 --- a/pkg/cluster/resources.go +++ b/pkg/cluster/resources.go @@ -172,3 +172,16 @@ func WaitForDeploymentAvailable(ctx context.Context, c client.Client, componentN return true, nil }) } + +func CreateWithRetry(ctx context.Context, cli client.Client, obj client.Object, timeoutMin int) error { + interval := time.Second * 5 // arbitrary value + timeout := time.Duration(timeoutMin) * time.Minute + + return wait.PollUntilContextTimeout(ctx, interval, timeout, true, func(ctx context.Context) (bool, error) { + err := cli.Create(ctx, obj) + if err != nil { + return false, nil //nolint:nilerr + } + return true, nil + }) +}