const NodeHealthUpdateRetry … const NodeEvictionPeriod … const EvictionRateLimiterBurst … type TimedValue … var now … type TimedQueue … // Len is the length of the queue. func (h TimedQueue) Len() int { … } // Less returns true if queue[i] < queue[j]. func (h TimedQueue) Less(i, j int) bool { … } // Swap swaps index i and j. func (h TimedQueue) Swap(i, j int) { … } // Push a new TimedValue on to the queue. func (h *TimedQueue) Push(x interface{ … } // Pop the lowest ProcessAt item. func (h *TimedQueue) Pop() interface{ … } type UniqueQueue … // Add a new value to the queue if it wasn't added before, or was // explicitly removed by the Remove call. Returns true if new value // was added. func (q *UniqueQueue) Add(value TimedValue) bool { … } // Replace replaces an existing value in the queue if it already // exists, otherwise it does nothing. Returns true if the item was // found. func (q *UniqueQueue) Replace(value TimedValue) bool { … } // RemoveFromQueue the value from the queue, but keeps it in the set, // so it won't be added second time. Returns true if something was // removed. func (q *UniqueQueue) RemoveFromQueue(value string) bool { … } // Remove the value from the queue, so Get() call won't return it, and // allow subsequent addition of the given value. If the value is not // present does nothing and returns false. func (q *UniqueQueue) Remove(value string) bool { … } // Get returns the oldest added value that wasn't returned yet. func (q *UniqueQueue) Get() (TimedValue, bool) { … } // Head returns the oldest added value that wasn't returned yet // without removing it. func (q *UniqueQueue) Head() (TimedValue, bool) { … } // Clear removes all items from the queue and duplication preventing // set. func (q *UniqueQueue) Clear() { … } type RateLimitedTimedQueue … // NewRateLimitedTimedQueue creates new queue which will use given // RateLimiter to oversee execution. func NewRateLimitedTimedQueue(limiter flowcontrol.RateLimiter) *RateLimitedTimedQueue { … } type ActionFunc … // Try processes the queue.Ends prematurely if RateLimiter forbids an // action and leak is true. Otherwise, requeues the item to be // processed. Each value is processed once if fn returns true, // otherwise it is added back to the queue. The returned remaining is // used to identify the minimum time to execute the next item in the // queue. The same value is processed only once unless Remove is // explicitly called on it (it's done by the cancelPodEviction // function in NodeController when Node becomes Ready again) TODO: // figure out a good way to do garbage collection for all Nodes that // were removed from the cluster. func (q *RateLimitedTimedQueue) Try(logger klog.Logger, fn ActionFunc) { … } // Add value to the queue to be processed. Won't add the same // value(comparison by value) a second time if it was already added // and not removed. func (q *RateLimitedTimedQueue) Add(value string, uid interface{ … } // Remove Node from the Evictor. The Node won't be processed until // added again. func (q *RateLimitedTimedQueue) Remove(value string) bool { … } // Clear removes all items from the queue func (q *RateLimitedTimedQueue) Clear() { … } // SwapLimiter safely swaps current limiter for this queue with the // passed one if capacities or qps's differ. func (q *RateLimitedTimedQueue) SwapLimiter(newQPS float32) { … }