Skip to content

Commit

Permalink
fix: allow queue to clean up if not evict pods (#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
njtran authored Oct 13, 2023
1 parent 552d312 commit a1a59ae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/controllers/termination/terminator/eviction.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ func (q *Queue) Add(pods ...*v1.Pod) {
}

func (q *Queue) Reconcile(ctx context.Context, _ reconcile.Request) (reconcile.Result, error) {
// Check if the queue is empty. client-go recommends not using this function to gate the subsequent
// get call, but since we're popping items off the queue synchronously, there should be no synchonization
// issues.
if q.Len() == 0 {
return reconcile.Result{RequeueAfter: 1 * time.Second}, nil
}
// Get pod from queue. This waits until queue is non-empty.
item, shutdown := q.RateLimitingInterface.Get()
if shutdown {
Expand Down

0 comments on commit a1a59ae

Please sign in to comment.