Skip to content

Commit

Permalink
fix linting issue
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Breuer <fbreuer@pm.me>
  • Loading branch information
breuerfelix committed May 31, 2023
1 parent 3b2f771 commit b666303
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions controllers/yawollet/loadbalancer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ func (r *LoadBalancerReconciler) Reconcile(ctx context.Context, req ctrl.Request
}
}

err := r.reconcile(ctx, lb, lbm, conditions)
// this error will be returned later in order to always
// keep metrics and conditions up-to-date
reconcileError := r.reconcile(ctx, lb, lbm, conditions)

metricString, err := helper.GetMetricString(r.KeepalivedStatsFile)
if err != nil {
Expand All @@ -79,12 +81,16 @@ func (r *LoadBalancerReconciler) Reconcile(ctx context.Context, req ctrl.Request
return ctrl.Result{}, err
}

patch := []byte(`{ "status": { "conditions": ` + conditionString + `, "metrics": ` + metricString + `}}`)
if err := r.Client.Status().Patch(ctx, lbm, client.RawPatch(types.MergePatchType, patch)); err != nil {
patch := []byte(
`{ "status": { "conditions": ` + conditionString + `, "metrics": ` + metricString + `}}`,
)
if err := r.Client.Status().Patch(
ctx, lbm, client.RawPatch(types.MergePatchType, patch),
); err != nil {
return ctrl.Result{}, err
}

return ctrl.Result{RequeueAfter: time.Duration(r.RequeueTime) * time.Second}, err
return ctrl.Result{RequeueAfter: time.Duration(r.RequeueTime) * time.Second}, reconcileError
}

func (r *LoadBalancerReconciler) reconcile(
Expand Down

0 comments on commit b666303

Please sign in to comment.