mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-03 10:17:46 +00:00
Rename cache's Snapshot to Dump
Signed-off-by: Aldo Culquicondor <acondor@google.com>
This commit is contained in:
4
pkg/scheduler/internal/cache/cache.go
vendored
4
pkg/scheduler/internal/cache/cache.go
vendored
@@ -177,7 +177,7 @@ func (cache *schedulerCache) removeNodeInfoFromList(name string) {
|
|||||||
// debugging purposes only and shouldn't be confused with UpdateNodeInfoSnapshot
|
// debugging purposes only and shouldn't be confused with UpdateNodeInfoSnapshot
|
||||||
// function.
|
// function.
|
||||||
// This method is expensive, and should be only used in non-critical path.
|
// This method is expensive, and should be only used in non-critical path.
|
||||||
func (cache *schedulerCache) Snapshot() *Snapshot {
|
func (cache *schedulerCache) Dump() *Dump {
|
||||||
cache.mu.RLock()
|
cache.mu.RLock()
|
||||||
defer cache.mu.RUnlock()
|
defer cache.mu.RUnlock()
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ func (cache *schedulerCache) Snapshot() *Snapshot {
|
|||||||
assumedPods[k] = v
|
assumedPods[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Snapshot{
|
return &Dump{
|
||||||
Nodes: nodes,
|
Nodes: nodes,
|
||||||
AssumedPods: assumedPods,
|
AssumedPods: assumedPods,
|
||||||
}
|
}
|
||||||
|
2
pkg/scheduler/internal/cache/cache_test.go
vendored
2
pkg/scheduler/internal/cache/cache_test.go
vendored
@@ -398,7 +398,7 @@ func TestSnapshot(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
snapshot := cache.Snapshot()
|
snapshot := cache.Dump()
|
||||||
if len(snapshot.Nodes) != len(cache.nodes) {
|
if len(snapshot.Nodes) != len(cache.nodes) {
|
||||||
t.Errorf("Unequal number of nodes in the cache and its snapshot. expected: %v, got: %v", len(cache.nodes), len(snapshot.Nodes))
|
t.Errorf("Unequal number of nodes in the cache and its snapshot. expected: %v, got: %v", len(cache.nodes), len(snapshot.Nodes))
|
||||||
}
|
}
|
||||||
|
@@ -52,15 +52,15 @@ func (c *CacheComparer) Compare() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
snapshot := c.Cache.Snapshot()
|
dump := c.Cache.Dump()
|
||||||
|
|
||||||
pendingPods := c.PodQueue.PendingPods()
|
pendingPods := c.PodQueue.PendingPods()
|
||||||
|
|
||||||
if missed, redundant := c.CompareNodes(nodes, snapshot.Nodes); len(missed)+len(redundant) != 0 {
|
if missed, redundant := c.CompareNodes(nodes, dump.Nodes); len(missed)+len(redundant) != 0 {
|
||||||
klog.Warningf("cache mismatch: missed nodes: %s; redundant nodes: %s", missed, redundant)
|
klog.Warningf("cache mismatch: missed nodes: %s; redundant nodes: %s", missed, redundant)
|
||||||
}
|
}
|
||||||
|
|
||||||
if missed, redundant := c.ComparePods(pods, pendingPods, snapshot.Nodes); len(missed)+len(redundant) != 0 {
|
if missed, redundant := c.ComparePods(pods, pendingPods, dump.Nodes); len(missed)+len(redundant) != 0 {
|
||||||
klog.Warningf("cache mismatch: missed pods: %s; redundant pods: %s", missed, redundant)
|
klog.Warningf("cache mismatch: missed pods: %s; redundant pods: %s", missed, redundant)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,9 +43,9 @@ func (d *CacheDumper) DumpAll() {
|
|||||||
|
|
||||||
// dumpNodes writes NodeInfo to the scheduler logs.
|
// dumpNodes writes NodeInfo to the scheduler logs.
|
||||||
func (d *CacheDumper) dumpNodes() {
|
func (d *CacheDumper) dumpNodes() {
|
||||||
snapshot := d.cache.Snapshot()
|
dump := d.cache.Dump()
|
||||||
klog.Info("Dump of cached NodeInfo")
|
klog.Info("Dump of cached NodeInfo")
|
||||||
for _, nodeInfo := range snapshot.Nodes {
|
for _, nodeInfo := range dump.Nodes {
|
||||||
klog.Info(d.printNodeInfo(nodeInfo))
|
klog.Info(d.printNodeInfo(nodeInfo))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -89,8 +89,8 @@ func (c *Cache) FilteredList(filter schedulerlisters.PodFilter, selector labels.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Snapshot is a fake method for testing
|
// Snapshot is a fake method for testing
|
||||||
func (c *Cache) Snapshot() *internalcache.Snapshot {
|
func (c *Cache) Dump() *internalcache.Dump {
|
||||||
return &internalcache.Snapshot{}
|
return &internalcache.Dump{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetNodeInfo is a fake method for testing.
|
// GetNodeInfo is a fake method for testing.
|
||||||
|
8
pkg/scheduler/internal/cache/interface.go
vendored
8
pkg/scheduler/internal/cache/interface.go
vendored
@@ -102,12 +102,12 @@ type Cache interface {
|
|||||||
// on this node.
|
// on this node.
|
||||||
UpdateNodeInfoSnapshot(nodeSnapshot *nodeinfosnapshot.Snapshot) error
|
UpdateNodeInfoSnapshot(nodeSnapshot *nodeinfosnapshot.Snapshot) error
|
||||||
|
|
||||||
// Snapshot takes a snapshot on current cache
|
// Dump produces a dump of the current cache.
|
||||||
Snapshot() *Snapshot
|
Dump() *Dump
|
||||||
}
|
}
|
||||||
|
|
||||||
// Snapshot is a snapshot of cache state
|
// Dump is a dump of the cache state.
|
||||||
type Snapshot struct {
|
type Dump struct {
|
||||||
AssumedPods map[string]bool
|
AssumedPods map[string]bool
|
||||||
Nodes map[string]*schedulernodeinfo.NodeInfo
|
Nodes map[string]*schedulernodeinfo.NodeInfo
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user