mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-02 01:39:02 +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
|
||||
// function.
|
||||
// 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()
|
||||
defer cache.mu.RUnlock()
|
||||
|
||||
@@ -191,7 +191,7 @@ func (cache *schedulerCache) Snapshot() *Snapshot {
|
||||
assumedPods[k] = v
|
||||
}
|
||||
|
||||
return &Snapshot{
|
||||
return &Dump{
|
||||
Nodes: nodes,
|
||||
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) {
|
||||
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
|
||||
}
|
||||
|
||||
snapshot := c.Cache.Snapshot()
|
||||
dump := c.Cache.Dump()
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
|
@@ -43,9 +43,9 @@ func (d *CacheDumper) DumpAll() {
|
||||
|
||||
// dumpNodes writes NodeInfo to the scheduler logs.
|
||||
func (d *CacheDumper) dumpNodes() {
|
||||
snapshot := d.cache.Snapshot()
|
||||
dump := d.cache.Dump()
|
||||
klog.Info("Dump of cached NodeInfo")
|
||||
for _, nodeInfo := range snapshot.Nodes {
|
||||
for _, nodeInfo := range dump.Nodes {
|
||||
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
|
||||
func (c *Cache) Snapshot() *internalcache.Snapshot {
|
||||
return &internalcache.Snapshot{}
|
||||
func (c *Cache) Dump() *internalcache.Dump {
|
||||
return &internalcache.Dump{}
|
||||
}
|
||||
|
||||
// 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.
|
||||
UpdateNodeInfoSnapshot(nodeSnapshot *nodeinfosnapshot.Snapshot) error
|
||||
|
||||
// Snapshot takes a snapshot on current cache
|
||||
Snapshot() *Snapshot
|
||||
// Dump produces a dump of the current cache.
|
||||
Dump() *Dump
|
||||
}
|
||||
|
||||
// Snapshot is a snapshot of cache state
|
||||
type Snapshot struct {
|
||||
// Dump is a dump of the cache state.
|
||||
type Dump struct {
|
||||
AssumedPods map[string]bool
|
||||
Nodes map[string]*schedulernodeinfo.NodeInfo
|
||||
}
|
||||
|
Reference in New Issue
Block a user