mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 18:02:01 +00:00
Merge pull request #72629 from krzysztof-jastrzebski/hpa_fix
Update comments in Horizontal Pod Autoscaler Controller.
This commit is contained in:
commit
922cf406c4
@ -179,7 +179,9 @@ func (a *HorizontalController) enqueueHPA(obj interface{}) {
|
|||||||
return
|
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)
|
a.queue.AddRateLimited(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,10 +213,15 @@ func (a *HorizontalController) processNextWorkItem() bool {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
utilruntime.HandleError(err)
|
utilruntime.HandleError(err)
|
||||||
}
|
}
|
||||||
// Add request processing HPA after resync interval just in case last resync didn't insert
|
// Add request processing HPA to queue with resyncPeriod delay.
|
||||||
// request into the queue. Request is not inserted into queue by resync if previous one wasn't processed yet.
|
// Requests are always added to queue with resyncPeriod delay. If there's already request
|
||||||
// This happens quite often because requests from previous resync are removed from the queue at the same moment
|
// for the HPA in the queue then a new request is always dropped. Requests spend resyncPeriod
|
||||||
// as next resync inserts new requests.
|
// 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 {
|
if !deleted {
|
||||||
a.queue.AddRateLimited(key)
|
a.queue.AddRateLimited(key)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user