Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Kyle Brennan <[email protected]>
  • Loading branch information
iQQBot and kylos101 authored Mar 11, 2025
1 parent 1d07810 commit 049bfe8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions components/node-labeler/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,15 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req reconcile.Request) (r

healthy, err := checkPodHealth(pod)
if err != nil {
log.WithError(err).Error("checking pod health")
log.WithError(err).Error("cannot check pod health")
return reconcile.Result{RequeueAfter: defaultRequeueTime}, nil
}

var node corev1.Node
err = r.Get(ctx, types.NamespacedName{Name: nodeName}, &node)
if err != nil {
if !errors.IsNotFound(err) {
log.WithError(err).Error("obtaining node")
log.WithError(err).Error("cannot get node")
}
return reconcile.Result{}, client.IgnoreNotFound(err)
}
Expand All @@ -257,7 +257,11 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req reconcile.Request) (r

err = updateNodeTaint(taintKey, !healthy, nodeName, r)
if err != nil {
log.WithError(err).Error("updating node taint")
log.WithError(err).
WithField("taintKey", taintKey).
WithField("add", !healthy).
WithField("nodeName", nodeName).
Error("cannot update node taint")
return reconcile.Result{RequeueAfter: defaultRequeueTime}, nil
}

Expand Down

0 comments on commit 049bfe8

Please sign in to comment.