• 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
..
api-rules Loading commit data...
openapi-spec Loading commit data...
swagger-spec Loading commit data...
OWNERS Loading commit data...