• Kubernetes Submit Queue's avatar
    Merge pull request #63040 from misterikkit/ecache-race · 62514022
    Kubernetes Submit Queue authored
    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
    62514022
Name
Last commit
Last update
..
apiserver Loading commit data...
auth Loading commit data...
benchmark/jsonify Loading commit data...
client Loading commit data...
configmap Loading commit data...
daemonset Loading commit data...
defaulttolerationseconds Loading commit data...
deployment Loading commit data...
etcd Loading commit data...
evictions Loading commit data...
examples Loading commit data...
framework Loading commit data...
garbagecollector Loading commit data...
ipamperf Loading commit data...
master Loading commit data...
metrics Loading commit data...
objectmeta Loading commit data...
openshift Loading commit data...
pods Loading commit data...
quota Loading commit data...
replicaset Loading commit data...
replicationcontroller Loading commit data...
scale Loading commit data...
scheduler Loading commit data...
scheduler_perf Loading commit data...
secrets Loading commit data...
serviceaccount Loading commit data...
statefulset Loading commit data...
storageclasses Loading commit data...
tls Loading commit data...
ttlcontroller Loading commit data...
util Loading commit data...
volume Loading commit data...
BUILD Loading commit data...
benchmark-controller.json Loading commit data...
doc.go Loading commit data...
utils.go Loading commit data...