Skip to content

Commit

Permalink
fix imagelist and imagejob resource errors (eraser-dev#106)
Browse files Browse the repository at this point in the history
Co-authored-by: Brian Goff <[email protected]>
  • Loading branch information
sozercan and cpuguy83 authored Feb 24, 2022
1 parent 39a7032 commit b7aec99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions controllers/imagejob/imagejob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
if err := r.updateJobStatus(ctx, imageJob); err != nil {
return ctrl.Result{}, err
}
return ctrl.Result{}, err
return ctrl.Result{}, client.IgnoreNotFound(err)
}

switch imageJob.Status.Phase {
Expand Down Expand Up @@ -361,8 +361,10 @@ func (r *Reconciler) updateImageListStatus(
}

func (r *Reconciler) updateJobStatus(ctx context.Context, imageJob *eraserv1alpha1.ImageJob) error {
if err := r.Status().Update(ctx, imageJob); err != nil {
return err
if imageJob.Name != "" {
if err := r.Status().Update(ctx, imageJob); err != nil {
return err
}
}
return nil
}
2 changes: 1 addition & 1 deletion controllers/imagelist/imagelist_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
imageList := &eraserv1alpha1.ImageList{}
err := r.Get(ctx, req.NamespacedName, imageList)
if err != nil {
return ctrl.Result{}, err
return ctrl.Result{}, client.IgnoreNotFound(err)
}

// Check to make sure reconcile isn't from updating ImageStatus
Expand Down

0 comments on commit b7aec99

Please sign in to comment.