Skip to content

Commit

Permalink
fix(nodeclaim): dedup logs marking consolidatable
Browse files Browse the repository at this point in the history
Signed-off-by: flavono123 <[email protected]>
  • Loading branch information
flavono123 committed Feb 21, 2025
1 parent c0e7299 commit 518ff10
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/controllers/nodeclaim/disruption/consolidation.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package disruption

import (
"context"
"time"

"github.com/samber/lo"
"k8s.io/utils/clock"
Expand Down Expand Up @@ -69,8 +70,12 @@ func (c *Consolidation) Reconcile(ctx context.Context, nodePool *v1.NodePool, no
return reconcile.Result{RequeueAfter: consolidatableTime.Sub(c.clock.Now())}, nil
}

// 6. Otherwise, add the consolidatable status condition
// 3. Otherwise, add the consolidatable status condition if not already set
nodeClaim.StatusConditions().SetTrue(v1.ConditionTypeConsolidatable)
// We sleep here after a set operation since we want to ensure that we are able to read our own writes
// so that we avoid duplicating log lines due to quick re-queues from our node watcher
time.Sleep(100 * time.Millisecond)

if !hasConsolidatableCondition {
log.FromContext(ctx).V(1).Info("marking consolidatable")
}
Expand Down

0 comments on commit 518ff10

Please sign in to comment.