mirror of https://github.com/k3s-io/k3s
print nodes for those metrics is somehow unreachable
parent
b9e46f5422
commit
dc2184f69f
|
@ -76,6 +76,12 @@ func (printer *TopCmdPrinter) PrintNodeMetrics(metrics []metricsapi.NodeMetrics,
|
|||
Metrics: usage,
|
||||
Available: availableResources[m.Name],
|
||||
})
|
||||
delete(availableResources, m.Name)
|
||||
}
|
||||
|
||||
// print lines for nodes of which the metrics is unreachable.
|
||||
for nodeName := range availableResources {
|
||||
printMissingMetricsNodeLine(w, nodeName)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -171,6 +177,14 @@ func printMetricsLine(out io.Writer, metrics *ResourceMetricsInfo) {
|
|||
fmt.Fprint(out, "\n")
|
||||
}
|
||||
|
||||
func printMissingMetricsNodeLine(out io.Writer, nodeName string) {
|
||||
printValue(out, nodeName)
|
||||
for i := 0; i < len(MeasuredResources); i++ {
|
||||
printValue(out, "-\t-\t")
|
||||
}
|
||||
fmt.Fprint(out, "\n")
|
||||
}
|
||||
|
||||
func printValue(out io.Writer, value interface{}) {
|
||||
fmt.Fprintf(out, "%v\t", value)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue