Skip to content

Commit

Permalink
Fix possible Registration TTL race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis committed Sep 15, 2024
1 parent 932d958 commit 81c29c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/controllers/nodeclaim/lifecycle/liveness.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ func (l *Liveness) Reconcile(ctx context.Context, nodeClaim *v1.NodeClaim) (reco
return reconcile.Result{Requeue: true}, nil
}
// If the Registered statusCondition hasn't gone True during the TTL since we first updated it, we should terminate the NodeClaim
if l.clock.Since(registered.LastTransitionTime.Time) < registrationTTL {
return reconcile.Result{RequeueAfter: registrationTTL - l.clock.Since(registered.LastTransitionTime.Time)}, nil
if ttl := registrationTTL - l.clock.Since(registered.LastTransitionTime.Time); ttl > 0 {
return reconcile.Result{RequeueAfter: ttl}, nil
}
// Delete the NodeClaim if we believe the NodeClaim won't register since we haven't seen the node
if err := l.kubeClient.Delete(ctx, nodeClaim); err != nil {
Expand Down

0 comments on commit 81c29c8

Please sign in to comment.