k3s/api
Kubernetes Submit Queue 663551bebd
Merge pull request #67252 from jbartosik/metric-sanitization
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.
```
2018-08-24 15:25:07 -07:00
..
api-rules Make HPA more configurable 2018-08-24 13:13:02 +02:00
openapi-spec Merge pull request #67737 from tallclair/runtimeclass-podapi 2018-08-23 16:53:29 -07:00
swagger-spec Merge pull request #67737 from tallclair/runtimeclass-podapi 2018-08-23 16:53:29 -07:00
OWNERS Create api-{approvers,reviewers} alias 2017-10-18 10:54:28 -07:00