kubernetes/test
Kubernetes Submit Queue 6251402266
Merge pull request #63040 from misterikkit/ecache-race
Automatic merge from submit-queue (batch tested with PRs 62432, 62868, 63040). 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>.

scheduler: fix race condition in equivalence cache

**What this PR does / why we need it**:
This adds an equivalence cache test to exercise the race condition observed in https://github.com/kubernetes/kubernetes/issues/62921 and then fixes the race.

The `Cache` interface needed a new method to check whether a `NodeInfo` is stale, and `genericScheduler` needed some plumbing to make the `Cache` object available to `podFitsOnNode()`.

The solution is, right before writing to the eCache, check the scheduler cache to see if the current `NodeInfo` object is out of date. If the node is out of date, then don't write to the eCache. If the `NodeInfo` is stale, it is because of a cache update that should also invalidate the eCache entry. That invalidation either happens before `podFitsOnNode()` acquires the eCache lock (original bug, so we don't do the write) or blocks until we release that lock (removing the potentially bad entry).

Fixes #62921 

**Special notes for your reviewer**:

**Release note**:

equivalence cache is still alpha, so no release note.
```release-note
NONE
```
/sig scheduling
/assign bsalalamat
/assign resouer
2018-04-25 12:56:14 -07:00
..
conformance A test we always skip should not be a conformance test 2018-04-10 09:12:10 -04:00
e2e Merge pull request #62432 from ixdy/pkg-generated-bindata 2018-04-25 12:56:08 -07:00
e2e_node add easy to use dynamic client 2018-04-25 08:55:26 -04:00
fixtures aggregate objs before printing in apply cmd 2018-04-19 19:39:10 -04:00
images Fix flaky crd e2e tests 2018-04-11 14:08:05 -07:00
integration Merge pull request #63040 from misterikkit/ecache-race 2018-04-25 12:56:14 -07:00
kubemark Merge pull request #62660 from krzysied/kubemark_dns 2018-04-17 17:31:23 -07:00
list Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
soak Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
typecheck Deduplicate identical typecheck errors between platforms. 2018-03-28 19:42:48 -07:00
utils Merge pull request #62195 from serathius/prometheus 2018-04-18 02:17:48 -07:00
BUILD Add test/typecheck, a fast typecheck for all build platforms. 2018-02-27 13:53:32 -08:00
OWNERS Adding rramkumar1 and MrHohn as reviewer & approver to pkg/test 2018-03-21 11:53:18 -07:00
test_owners.csv Merge pull request #62151 from thockin/build-cleanup-with-go-1-10 2018-04-23 22:45:24 -07:00
test_owners.json Remove all traces of federation 2017-10-26 13:37:37 -07:00