Skip to content

Commit

Permalink
Logged error in case of status update fails
Browse files Browse the repository at this point in the history
  • Loading branch information
msafwankarim committed Feb 12, 2025
1 parent df39b87 commit 9615d1b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions internal/controller/routewhitelist_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,13 @@ func (r *RouteWhitelistReconciler) patchResourceAndStatus(ctx context.Context, o
if err != nil {
logger.Error(err, "failed to update resource")
}
return r.patchStatusWithRetries(ctx, obj, patch)

err = r.patchStatusWithRetries(ctx, obj, patch)
if err != nil {
logger.Error(err, "failed to update status")
}

return err
}

//+kubebuilder:rbac:groups=networking.stakater.com,resources=routewhitelists,verbs=get;list;watch;create;update;patch;delete
Expand Down Expand Up @@ -245,9 +251,7 @@ func (r *RouteWhitelistReconciler) handleUpdate(ctx context.Context, routes *rou

if err != nil {
err = r.patchResourceAndStatus(ctx, cr, patch, logger)
if err != nil {
logger.Error(err, "failed to update status")
}
// error will be logged in the patchResourceAndStatus function so ignoring it
return ctrl.Result{RequeueAfter: 3 * time.Minute}, nil
}

Expand Down

0 comments on commit 9615d1b

Please sign in to comment.