Skip to content

Commit

Permalink
fix: handle copy preflight results job already exists error
Browse files Browse the repository at this point in the history
  • Loading branch information
emosbaugh committed Dec 18, 2024
1 parent af688c8 commit f09e95c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions operator/controllers/installation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"github.com/replicatedhq/embedded-cluster/pkg/runtimeconfig"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -508,7 +508,7 @@ func (r *InstallationReconciler) CopyHostPreflightResultsFromNodes(ctx context.C
}

if err := r.Create(ctx, job); err != nil {
if !errors.IsAlreadyExists(err) {
if !k8serrors.IsAlreadyExists(err) {
return fmt.Errorf("failed to create job: %w", err)
}
} else {
Expand Down Expand Up @@ -641,7 +641,7 @@ func (r *InstallationReconciler) Reconcile(ctx context.Context, req ctrl.Request

// save the installation status. nothing more to do with it.
if err := r.Status().Update(ctx, in.DeepCopy()); err != nil {
if errors.IsConflict(err) {
if k8serrors.IsConflict(err) {
return ctrl.Result{}, fmt.Errorf("failed to update status: conflict")
}
return ctrl.Result{}, fmt.Errorf("failed to update installation status: %w", err)
Expand Down

0 comments on commit f09e95c

Please sign in to comment.