• Solly Ross's avatar
    HPA: Consider unready pods and missing metrics · 2c66d477
    Solly Ross authored
    Currently, the HPA considers unready pods the same as ready pods when
    looking at their CPU and custom metric usage.  However, pods frequently
    use extra CPU during initialization, so we want to consider them
    separately.
    
    This commit causes the HPA to consider unready pods as having 0 CPU
    usage when scaling up, and ignores them when scaling down.  If, when
    scaling up, factoring the unready pods as having 0 CPU would cause a
    downscale instead, we simply choose not to scale.  Otherwise, we simply
    scale up at the reduced amount caculated by factoring the pods in at
    zero CPU usage.
    
    The effect is that unready pods cause the autoscaler to be a bit more
    conservative -- large increases in CPU usage can still cause scales,
    even with unready pods in the mix, but will not cause the scale factors
    to be as large, in anticipation of the new pods later becoming ready and
    handling load.
    
    Similarly, if there are pods for which no metrics have been retrieved,
    these pods are treated as having 100% of the requested metric when
    scaling down, and 0% when scaling up.  As above, this cannot change the
    direction of the scale.
    
    This commit also changes the HPA to ignore superfluous metrics -- as
    long as metrics for all ready pods are present, the HPA we make scaling
    decisions.  Currently, this only works for CPU.  For custom metrics, we
    cannot identify which metrics go to which pods if we get superfluous
    metrics, so we abort the scale.
    2c66d477
Name
Last commit
Last update
..
metrics Loading commit data...
BUILD Loading commit data...
doc.go Loading commit data...
horizontal.go Loading commit data...
horizontal_test.go Loading commit data...
replica_calculator.go Loading commit data...
replica_calculator_test.go Loading commit data...