kubernetes/pkg/controller/podautoscaler
Joseph Burnett 1ccaaa768d Ignore deleted pods.
When a pod is deleted, it is given a deletion timestamp. However the
pod might still run for some time during graceful shutdown. During
this time it might still produce CPU utilization metrics and be in a
Running phase.

Currently the HPA replica calculator attempts to ignore deleted pods
by skipping over them. However by not adding them to the ignoredPods
set, their metrics are not removed from the average utilization
calculation. This allows pods in the process of shutting down to drag
down the recommmended number of replicas by producing near 0%
utilization metrics.

In fact the ignoredPods set is misnomer. Those pods are not fully
ignored. When the replica calculator recommends to scale up, 0%
utilization metrics are filled in for those pods to limit the scale
up. This prevents overscaling when pods take some time to startup. In
fact, there should be 4 sets considered (readyPods, unreadyPods,
missingPods, ignoredPods) not just 3.

This change renames ignoredPods as unreadyPods and leaves the scaleup
limiting semantics. Another set (actually) ignoredPods is added to
which delete pods are added instead of being skipped during
grouping. Both ignoredPods and unreadyPods have their metrics removed
from consideration. But only unreadyPods have 0% utilization metrics
filled in upon scaleup.
2020-10-14 16:45:06 +02:00
..
config Autogenerated code 2019-10-24 20:21:00 +02:00
metrics Run hack/update-vendor.sh 2020-05-16 07:54:33 -04:00
BUILD Run hack/update-vendor.sh 2020-05-16 07:54:33 -04:00
doc.go Use Go canonical import paths 2016-07-16 13:48:21 -04:00
horizontal_test.go Fixed Golint errors in pkg/controller/podautoscaler 2020-02-06 17:16:38 +01:00
horizontal.go Replace StartLogging(klog.Infof) with StartStructuredLogging(0) 2020-06-15 17:48:35 +09:00
legacy_horizontal_test.go Fixed Golint errors in pkg/controller/podautoscaler 2020-02-06 17:16:38 +01:00
legacy_replica_calculator_test.go Fixed Golint errors in pkg/controller/podautoscaler 2020-02-06 17:16:38 +01:00
OWNERS Prune inactive owners from autoscaling related OWNERS files. 2019-10-13 08:52:14 -04:00
rate_limiters.go Clarified comments 2020-02-07 09:09:49 +01:00
replica_calculator_test.go Ignore deleted pods. 2020-10-14 16:45:06 +02:00
replica_calculator.go Ignore deleted pods. 2020-10-14 16:45:06 +02:00