• Kubernetes Submit Queue's avatar
    Merge pull request #67252 from jbartosik/metric-sanitization · 663551be
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue (batch tested with PRs 66916, 67252, 67794, 67619, 67328). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
    
    Fix HPA sample sanitization
    
    **What this PR does / why we need it**: @mwielgus pointed out a case when HPA fails as a result of my changes to HPA algorithm:
    - Have pods that use a lot of CPU during initilization, become ready right after they initialize,
    - Trigger a scale up,
    - When new pods become ready will will count their usage (even though it's not related to any work that needs doing),
    - This triggers another scale up, even though existing pods can handle work, no problem.
    
    The fix is:
    - Use all samples for non-cpu metrics.
    - Only use CPU samples if:
      - Pod is ready and was started more than 2 minutes ago, or
      - Pod is unready and last readiness change happened more than 10s after it was started.
    
    Reasoning behind this in: https://docs.google.com/document/d/1UdtYedhmCxjaJIQi6hwJMY0eHQQKxlVD8lSHZC1BPOA/edit
    
    **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
    
    **Special notes for your reviewer**:
    
    **Release note**:
    ```release-note
    Replace scale up forbidden window with disregarding CPU samples collected when pod was initializing.
    ```
    663551be
Name
Last commit
Last update
..
bootstrap Loading commit data...
certificates Loading commit data...
cloud Loading commit data...
clusterroleaggregation Loading commit data...
cronjob Loading commit data...
daemon Loading commit data...
deployment Loading commit data...
disruption Loading commit data...
endpoint Loading commit data...
garbagecollector Loading commit data...
history Loading commit data...
job Loading commit data...
namespace Loading commit data...
nodeipam Loading commit data...
nodelifecycle Loading commit data...
podautoscaler Loading commit data...
podgc Loading commit data...
replicaset Loading commit data...
replication Loading commit data...
resourcequota Loading commit data...
route Loading commit data...
service Loading commit data...
serviceaccount Loading commit data...
statefulset Loading commit data...
testutil Loading commit data...
ttl Loading commit data...
util/node Loading commit data...
volume Loading commit data...
.import-restrictions Loading commit data...
BUILD Loading commit data...
OWNERS Loading commit data...
client_builder.go Loading commit data...
controller_ref_manager.go Loading commit data...
controller_ref_manager_test.go Loading commit data...
controller_utils.go Loading commit data...
controller_utils_test.go Loading commit data...
doc.go Loading commit data...
lookup_cache.go Loading commit data...