Skip to content

Commit

Permalink
Avoid multiple logs messages for the node health controller
Browse files Browse the repository at this point in the history
  • Loading branch information
engedaam committed Dec 18, 2024
1 parent e339ada commit c883f3c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/controllers/node/health/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,18 @@ func (c *Controller) Reconcile(ctx context.Context, node *corev1.Node) (reconcil
if err := c.annotateTerminationGracePeriod(ctx, nodeClaim); err != nil {
return reconcile.Result{}, client.IgnoreNotFound(err)
}

return c.deleteNodeClaim(ctx, nodeClaim, node)
}

// deleteNodeClaim removes the NodeClaim from the api-server
func (c *Controller) deleteNodeClaim(ctx context.Context, nodeClaim *v1.NodeClaim, node *corev1.Node) (reconcile.Result, error) {
if !nodeClaim.DeletionTimestamp.IsZero() {
return reconcile.Result{}, nil
}
if err := c.kubeClient.Delete(ctx, nodeClaim); err != nil {
return reconcile.Result{}, client.IgnoreNotFound(err)
}

// The deletion timestamp has successfully been set for the Node, update relevant metrics.
log.FromContext(ctx).V(1).Info("deleting unhealthy node")
metrics.NodeClaimsDisruptedTotal.Inc(map[string]string{
Expand Down

0 comments on commit c883f3c

Please sign in to comment.