diff --git a/controllers/storagecluster/provider_server.go b/controllers/storagecluster/provider_server.go index 8516abc57c..b9bb7a15ae 100644 --- a/controllers/storagecluster/provider_server.go +++ b/controllers/storagecluster/provider_server.go @@ -496,9 +496,12 @@ func (o *ocsProviderServer) createJob(r *StorageClusterReconciler, instance *ocs if errors.IsNotFound(err) { onboardingSecretGeneratorJob := getOnboardingJobObject(instance) - err = r.Client.Create(context.Background(), onboardingSecretGeneratorJob) - } - if err != nil { + jobErr := r.Client.Create(context.Background(), onboardingSecretGeneratorJob) + if jobErr != nil && !errors.IsAlreadyExists(jobErr) { + r.Log.Error(jobErr, "failed to create onboarding job") + return reconcile.Result{}, jobErr + } + } else if err != nil { r.Log.Error(err, "failed to create/ensure secret") return reconcile.Result{}, err }