Skip to content

Commit

Permalink
fix: spurious logging from capacity reservation controller (#7847)
Browse files Browse the repository at this point in the history
  • Loading branch information
rschalo authored Mar 5, 2025
1 parent dd9dc93 commit 17fb899
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/controllers/nodeclaim/capacityreservation/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,15 @@ func (c *Controller) syncCapacityType(ctx context.Context, capacityType string,
if capacityType != karpv1.CapacityTypeOnDemand {
return false, nil
}
updated := false
if nc.Labels[karpv1.CapacityTypeLabelKey] == karpv1.CapacityTypeReserved {
stored := nc.DeepCopy()
nc.Labels[karpv1.CapacityTypeLabelKey] = karpv1.CapacityTypeOnDemand
delete(nc.Labels, cloudprovider.ReservationIDLabel)
if err := c.kubeClient.Patch(ctx, nc, client.MergeFrom(stored)); client.IgnoreNotFound(err) != nil {
return false, fmt.Errorf("patching nodeclaim %q, %w", nc.Name, err)
}
updated = true
}

// If the reservation expired before the NodeClaim became registered, there may not be a Node on the cluster. Note
Expand Down Expand Up @@ -148,6 +150,7 @@ func (c *Controller) syncCapacityType(ctx context.Context, capacityType string,
if err := c.kubeClient.Patch(ctx, n, client.MergeFrom(stored)); client.IgnoreNotFound(err) != nil {
return false, fmt.Errorf("patching node %q, %w", n.Name, err)
}
updated = true
}
return true, nil
return updated, nil
}

0 comments on commit 17fb899

Please sign in to comment.