Skip to content

Commit

Permalink
Remove frequent status updates
Browse files Browse the repository at this point in the history
  • Loading branch information
martinhny committed Nov 29, 2023
1 parent 675acf1 commit 050e0f2
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions controllers/application/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (r *ApplicationReconciler) Reconcile(ctx context.Context, req reconcile.Req
return res, nil
}
}
//r.GetClient().Status().Update(ctx, application)
r.GetClient().Status().Update(ctx, application)
r.EmitNormalEvent(application, "ReconcileEnd", fmt.Sprintf("Application %v has finished reconciliation loop", application.Name))

return reconcile.Result{}, err
Expand Down Expand Up @@ -241,21 +241,12 @@ func ValidateIngresses(application *skiperatorv1alpha1.Application) error {

func (r *ApplicationReconciler) manageControllerStatus(context context.Context, app *skiperatorv1alpha1.Application, controller string, statusName skiperatorv1alpha1.StatusNames, message string) (reconcile.Result, error) {
app.UpdateControllerStatus(controller, message, statusName)
err := r.GetClient().Status().Update(context, app)
if err != nil {
return reconcile.Result{Requeue: true}, err
}
return reconcile.Result{Requeue: true}, nil
return reconcile.Result{}, nil
}

func (r *ApplicationReconciler) manageControllerStatusError(context context.Context, app *skiperatorv1alpha1.Application, controller string, issue error) (reconcile.Result, error) {
app.UpdateControllerStatus(controller, issue.Error(), skiperatorv1alpha1.ERROR)
err := r.GetClient().Status().Update(context, app)
r.EmitWarningEvent(app, "ControllerFault", fmt.Sprintf("%v controller experienced an error: %v", controller, issue.Error()))

if err != nil {
return reconcile.Result{}, err
}
return reconcile.Result{}, issue
}

Expand Down

0 comments on commit 050e0f2

Please sign in to comment.