• Kubernetes Submit Queue's avatar
    Merge pull request #42778 from k82cn/sched_cache_sync · 342ef111
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue (batch tested with PRs 42762, 42739, 42425, 42778)
    
    Fixed potential OutOfSync of nodeInfo.
    
    The cloned NodeInfo still share the same resource objects in cache; it may make `requestedResource` and Pods OutOfSync, for example, if the pod was deleted, the `requestedResource` is updated by Pods are not in cloned info. Found this when investigating #32531 , but seems not the root cause, as nodeInfo are readonly in predicts & priorities.
    
    Sample codes for `&(*)`:
    
    ```
    package main
    
    import (
    	"fmt"
    )
    
    type Resource struct {
    	A int
    }
    
    type Node struct {
    	Res *Resource
    }
    
    func main() {
    	r1 := &Resource { A:10 }
    	n1 := &Node{Res: r1}
    	r2 := &(*n1.Res)
    	r2.A = 11
    
    	fmt.Printf("%t, %d %d\n", r1==r2, r1, r2)
    }
    ```
    
    Output:
    
    ```
    true, &{11} &{11}
    ```
    342ef111
Name
Last commit
Last update
..
algorithm Loading commit data...
algorithmprovider Loading commit data...
api Loading commit data...
core Loading commit data...
factory Loading commit data...
metrics Loading commit data...
schedulercache Loading commit data...
testing Loading commit data...
util Loading commit data...
BUILD Loading commit data...
OWNERS Loading commit data...
scheduler.go Loading commit data...
scheduler_test.go Loading commit data...