Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated scheduler files comparer.go, dumper.go, node_tree.go to structured logging #105968

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions pkg/scheduler/internal/cache/debugger/comparer.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ type CacheComparer struct {

// Compare compares the nodes and pods of NodeLister with Cache.Snapshot.
func (c *CacheComparer) Compare() error {
klog.V(3).Info("cache comparer started")
defer klog.V(3).Info("cache comparer finished")
klog.V(3).InfoS("Cache comparer started")
defer klog.V(3).InfoS("Cache comparer finished")

nodes, err := c.NodeLister.List(labels.Everything())
if err != nil {
Expand All @@ -57,11 +57,11 @@ func (c *CacheComparer) Compare() error {
pendingPods := c.PodQueue.PendingPods()

if missed, redundant := c.CompareNodes(nodes, dump.Nodes); len(missed)+len(redundant) != 0 {
klog.InfoS("cache mismatch", "missed nodes", missed, "redundant nodes", redundant)
klog.InfoS("Cache mismatch", "missedNodes", missed, "redundantNodes", redundant)
}

if missed, redundant := c.ComparePods(pods, pendingPods, dump.Nodes); len(missed)+len(redundant) != 0 {
klog.InfoS("cache mismatch", "missed pods", missed, "redundant pods", redundant)
klog.InfoS("Cache mismatch", "missedPods", missed, "redundantPods", redundant)
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/scheduler/internal/cache/debugger/dumper.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (d *CacheDumper) DumpAll() {
// dumpNodes writes NodeInfo to the scheduler logs.
func (d *CacheDumper) dumpNodes() {
dump := d.cache.Dump()
klog.Info("Dump of cached NodeInfo")
klog.InfoS("Dump of cached NodeInfo")
for name, nodeInfo := range dump.Nodes {
klog.Info(d.printNodeInfo(name, nodeInfo))
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/scheduler/internal/cache/node_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (nt *nodeTree) addNode(n *v1.Node) {
if na, ok := nt.tree[zone]; ok {
for _, nodeName := range na {
if nodeName == n.Name {
klog.Warningf("node %q already exist in the NodeTree", n.Name)
klog.InfoS("Node already exists in the NodeTree", "node", klog.KObj(n))
return
}
}
Expand All @@ -62,7 +62,7 @@ func (nt *nodeTree) addNode(n *v1.Node) {
nt.zones = append(nt.zones, zone)
nt.tree[zone] = []string{n.Name}
}
klog.V(2).Infof("Added node %q in group %q to NodeTree", n.Name, zone)
klog.V(2).InfoS("Added node in listed group to NodeTree", "node", klog.KObj(n), "zone", zone)
nt.numNodes++
}

Expand All @@ -76,13 +76,13 @@ func (nt *nodeTree) removeNode(n *v1.Node) error {
if len(nt.tree[zone]) == 0 {
nt.removeZone(zone)
}
klog.V(2).Infof("Removed node %q in group %q from NodeTree", n.Name, zone)
klog.V(2).InfoS("Removed node in listed group from NodeTree", "node", klog.KObj(n), "zone", zone)
nt.numNodes--
return nil
}
}
}
klog.Errorf("Node %q in group %q was not found", n.Name, zone)
klog.ErrorS(nil, "Node in listed group was not found", "node", klog.KObj(n), "zone", zone)
return fmt.Errorf("node %q in group %q was not found", n.Name, zone)
}

Expand Down