mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 09:52:49 +00:00
Update comments in Horizontal Pod Autoscaler Controller.
This commit is contained in:
parent
1641ff4114
commit
7498c14218
@ -179,7 +179,9 @@ func (a *HorizontalController) enqueueHPA(obj interface{}) {
|
||||
return
|
||||
}
|
||||
|
||||
// always add rate-limited so we don't fetch metrics more that once per resync interval
|
||||
// Requests are always added to queue with resyncPeriod delay. If there's already
|
||||
// request for the HPA in the queue then a new request is always dropped. Requests spend resync
|
||||
// interval in queue so HPAs are processed every resync interval.
|
||||
a.queue.AddRateLimited(key)
|
||||
}
|
||||
|
||||
@ -211,10 +213,15 @@ func (a *HorizontalController) processNextWorkItem() bool {
|
||||
if err != nil {
|
||||
utilruntime.HandleError(err)
|
||||
}
|
||||
// Add request processing HPA after resync interval just in case last resync didn't insert
|
||||
// request into the queue. Request is not inserted into queue by resync if previous one wasn't processed yet.
|
||||
// This happens quite often because requests from previous resync are removed from the queue at the same moment
|
||||
// as next resync inserts new requests.
|
||||
// Add request processing HPA to queue with resyncPeriod delay.
|
||||
// Requests are always added to queue with resyncPeriod delay. If there's already request
|
||||
// for the HPA in the queue then a new request is always dropped. Requests spend resyncPeriod
|
||||
// in queue so HPAs are processed every resyncPeriod.
|
||||
// Request is added here just in case last resync didn't insert request into the queue. This
|
||||
// happens quite often because there is race condition between adding request after resyncPeriod
|
||||
// and removing them from queue. Request can be added by resync before previous request is
|
||||
// removed from queue. If we didn't add request here then in this case one request would be dropped
|
||||
// and HPA would processed after 2 x resyncPeriod.
|
||||
if !deleted {
|
||||
a.queue.AddRateLimited(key)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user