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 c140a61
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/controllers/node/health/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,19 @@ 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)
}
c.deleteNodeClaim(ctx, nodeClaim, node)

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 nil

Check failure on line 131 in pkg/controllers/node/health/controller.go

View workflow job for this annotation

GitHub Actions / presubmit (1.25.x)

not enough return values

Check failure on line 131 in pkg/controllers/node/health/controller.go

View workflow job for this annotation

GitHub Actions / Analyze Go

not enough return values

Check failure on line 131 in pkg/controllers/node/health/controller.go

View workflow job for this annotation

GitHub Actions / presubmit (1.26.x)

not enough return values

Check failure on line 131 in pkg/controllers/node/health/controller.go

View workflow job for this annotation

GitHub Actions / presubmit (1.27.x)

not enough return values

Check failure on line 131 in pkg/controllers/node/health/controller.go

View workflow job for this annotation

GitHub Actions / presubmit (1.28.x)

not enough return values

Check failure on line 131 in pkg/controllers/node/health/controller.go

View workflow job for this annotation

GitHub Actions / presubmit (1.29.x)

not enough return values

Check failure on line 131 in pkg/controllers/node/health/controller.go

View workflow job for this annotation

GitHub Actions / presubmit (1.30.x)

not enough return values

Check failure on line 131 in pkg/controllers/node/health/controller.go

View workflow job for this annotation

GitHub Actions / presubmit (1.31.x)

not enough return values
}
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 c140a61

Please sign in to comment.