#49 transfer pods as dicts

This commit is contained in:
Henning Jacobs
2017-01-14 00:57:41 +01:00
parent cbb2a65bf2
commit c5033d91f3
4 changed files with 19 additions and 14 deletions

View File

@@ -30,7 +30,9 @@ export default class Node extends PIXI.Graphics {
resources[key]['used'] = parseResource(this.node.usage[key])
}
}
for (const pod of this.node.pods) {
let numberOfPods = 0
for (const pod of Object.values(this.node.pods)) {
numberOfPods++
for (const container of pod.containers) {
if (container.resources && container.resources.requests) {
for (const key of Object.keys(container.resources.requests)) {
@@ -39,8 +41,8 @@ export default class Node extends PIXI.Graphics {
}
}
}
resources['pods'].requested = this.node.pods.length
resources['pods'].used = this.node.pods.length
resources['pods'].requested = numberOfPods
resources['pods'].used = numberOfPods
return resources
}
@@ -89,7 +91,7 @@ export default class Node extends PIXI.Graphics {
const nodeBox = this
let px = 24
let py = 20
const pods = this.node.pods.sort(sorterFn)
const pods = Object.values(this.node.pods).sort(sorterFn)
for (const pod of pods) {
if (pod.namespace != 'kube-system') {
const podBox = Pod.getOrCreate(pod, this.cluster, this.tooltip)