From b7d1522ea1060a2000dd5b5ec5fb8cbdc6c02295 Mon Sep 17 00:00:00 2001 From: Matthew Casperson Date: Tue, 8 Jan 2019 07:40:36 +1000 Subject: [PATCH 01/10] Added space for unassigned pods when there are no master nodes --- app/src/cluster.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/cluster.js b/app/src/cluster.js index abdb3d9..ef62448 100644 --- a/app/src/cluster.js +++ b/app/src/cluster.js @@ -29,10 +29,11 @@ export default class Cluster extends PIXI.Graphics { const left = 10 const top = 20 const padding = 5 + const initialMasterHeight = 15 let masterX = left let masterY = top let masterWidth = 0 - let masterHeight = 0 + let masterHeight = initialMasterHeight let workerX = left let workerY = top let workerWidth = 0 @@ -50,7 +51,7 @@ export default class Cluster extends PIXI.Graphics { masterY += nodeBox.height + padding masterHeight += nodeBox.height + padding } - if (masterHeight == 0) { + if (masterHeight == initialMasterHeight) { masterHeight = nodeBox.height + padding } nodeBox.x = masterX From a1fcd1c623d5427f229324e3d5a47f0ced8dd521 Mon Sep 17 00:00:00 2001 From: Matthew Casperson Date: Tue, 19 Mar 2019 09:29:06 +1000 Subject: [PATCH 02/10] Added space for unprovisioned pods only if there are no master nodes --- app/src/cluster.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/app/src/cluster.js b/app/src/cluster.js index ef62448..9797579 100644 --- a/app/src/cluster.js +++ b/app/src/cluster.js @@ -29,11 +29,10 @@ export default class Cluster extends PIXI.Graphics { const left = 10 const top = 20 const padding = 5 - const initialMasterHeight = 15 let masterX = left let masterY = top let masterWidth = 0 - let masterHeight = initialMasterHeight + let masterHeight = 0 let workerX = left let workerY = top let workerWidth = 0 @@ -51,7 +50,7 @@ export default class Cluster extends PIXI.Graphics { masterY += nodeBox.height + padding masterHeight += nodeBox.height + padding } - if (masterHeight == initialMasterHeight) { + if (masterHeight == 0) { masterHeight = nodeBox.height + padding } nodeBox.x = masterX @@ -78,16 +77,25 @@ export default class Cluster extends PIXI.Graphics { nodeBox.y += masterHeight } + if (masterX === left) { + masterX = workerX + } + + /* + Place unassigned pods to the left of the master nodes, or + to the left of the worker nodes if there were no masters. + */ + var unassignedX = masterX === left ? workerX : masterX for (const pod of Object.values(this.cluster.unassigned_pods)) { - var podBox = Pod.getOrCreate(pod, this, this.tooltip) - podBox.x = masterX + var podBox = Pod.getOrCreate(pod, this, this.tooltip, this.menu) + podBox.x = unassignedX podBox.y = masterY podBox.draw() this.addChild(podBox) - masterX += 20 + unassignedX += 20 } - masterWidth = Math.max(masterX, masterWidth) + masterWidth = Math.max(unassignedX, masterWidth) workerWidth = Math.max(workerX, workerWidth) this.lineStyle(2, App.current.theme.primaryColor, 1) From 02a101ff9905ac725cc85e51ebc30ad46a19f317 Mon Sep 17 00:00:00 2001 From: Matthew Casperson Date: Tue, 19 Mar 2019 09:45:47 +1000 Subject: [PATCH 03/10] Removed unnecessary reassignment --- app/src/cluster.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/src/cluster.js b/app/src/cluster.js index 9797579..3cb16d5 100644 --- a/app/src/cluster.js +++ b/app/src/cluster.js @@ -77,10 +77,6 @@ export default class Cluster extends PIXI.Graphics { nodeBox.y += masterHeight } - if (masterX === left) { - masterX = workerX - } - /* Place unassigned pods to the left of the master nodes, or to the left of the worker nodes if there were no masters. From 585c78f8a5ed1caa730601494ca406848627a8c1 Mon Sep 17 00:00:00 2001 From: Matthew Casperson Date: Tue, 19 Mar 2019 09:46:19 +1000 Subject: [PATCH 04/10] Removed menu reference --- app/src/cluster.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/cluster.js b/app/src/cluster.js index 3cb16d5..8bfaf7a 100644 --- a/app/src/cluster.js +++ b/app/src/cluster.js @@ -84,7 +84,7 @@ export default class Cluster extends PIXI.Graphics { var unassignedX = masterX === left ? workerX : masterX for (const pod of Object.values(this.cluster.unassigned_pods)) { - var podBox = Pod.getOrCreate(pod, this, this.tooltip, this.menu) + var podBox = Pod.getOrCreate(pod, this, this.tooltip) podBox.x = unassignedX podBox.y = masterY podBox.draw() From 8356058b6d1d8b9e919aeb670ed6589b731346ac Mon Sep 17 00:00:00 2001 From: Matthew Casperson Date: Tue, 19 Mar 2019 09:47:11 +1000 Subject: [PATCH 05/10] Fixed comment --- app/src/cluster.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/cluster.js b/app/src/cluster.js index 8bfaf7a..911ec26 100644 --- a/app/src/cluster.js +++ b/app/src/cluster.js @@ -78,8 +78,8 @@ export default class Cluster extends PIXI.Graphics { } /* - Place unassigned pods to the left of the master nodes, or - to the left of the worker nodes if there were no masters. + Place unassigned pods to the right of the master nodes, or + to the right of the worker nodes if there were no masters. */ var unassignedX = masterX === left ? workerX : masterX From a010aab777e5e702e81ea23c2b636b3a595dd12c Mon Sep 17 00:00:00 2001 From: Matthew Casperson Date: Tue, 19 Mar 2019 10:10:25 +1000 Subject: [PATCH 06/10] Combine all the Math.max calls --- app/src/cluster.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/cluster.js b/app/src/cluster.js index 911ec26..6e43ccd 100644 --- a/app/src/cluster.js +++ b/app/src/cluster.js @@ -91,11 +91,9 @@ export default class Cluster extends PIXI.Graphics { this.addChild(podBox) unassignedX += 20 } - masterWidth = Math.max(unassignedX, masterWidth) - workerWidth = Math.max(workerX, workerWidth) this.lineStyle(2, App.current.theme.primaryColor, 1) - const width = Math.max(masterWidth, workerWidth) + const width = Math.max(masterX, workerX, unassignedX) this.drawRect(0, 0, width, top + masterHeight + workerHeight) const topHandle = this.topHandle = new PIXI.Graphics() From 0b3b327b71fe96e3df8b8adc56a1e387b346c7c5 Mon Sep 17 00:00:00 2001 From: Matthew Casperson Date: Tue, 19 Mar 2019 10:11:52 +1000 Subject: [PATCH 07/10] combined math.max some more --- app/src/cluster.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/cluster.js b/app/src/cluster.js index 6e43ccd..dbe1e46 100644 --- a/app/src/cluster.js +++ b/app/src/cluster.js @@ -93,7 +93,7 @@ export default class Cluster extends PIXI.Graphics { } this.lineStyle(2, App.current.theme.primaryColor, 1) - const width = Math.max(masterX, workerX, unassignedX) + const width = Math.max(masterX, masterWidth, workerX, workerWidth, unassignedX) this.drawRect(0, 0, width, top + masterHeight + workerHeight) const topHandle = this.topHandle = new PIXI.Graphics() From 608615b7868c8f6d795a7d120cca71e66aca8382 Mon Sep 17 00:00:00 2001 From: Matthew Casperson Date: Wed, 20 Mar 2019 07:00:33 +1000 Subject: [PATCH 08/10] Fixing up line ending issues --- .gitattributes | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 07764a7..d9970d2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,4 @@ -* text eol=lf \ No newline at end of file +* text eol=lf +*.woff2 binary +*.png binary +*.ico binary From 760b3ecbcfda6ae76c9884a3f5585a6202b1192e Mon Sep 17 00:00:00 2001 From: Matthew Casperson Date: Wed, 20 Mar 2019 07:02:13 +1000 Subject: [PATCH 09/10] Update .gitattributes --- .gitattributes | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index d9970d2..2ca4a76 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,5 @@ * text eol=lf -*.woff2 binary *.png binary +*.jpg binary *.ico binary +*.woff2 binary From 047967121e600e3eb1b2b0446d4b963cfbe733cd Mon Sep 17 00:00:00 2001 From: Henning Jacobs Date: Sat, 23 Mar 2019 12:27:03 +0100 Subject: [PATCH 10/10] mock cluster without master nodes --- kube_ops_view/mock.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kube_ops_view/mock.py b/kube_ops_view/mock.py index a7f0b8d..950262a 100644 --- a/kube_ops_view/mock.py +++ b/kube_ops_view/mock.py @@ -85,7 +85,8 @@ def query_mock_cluster(cluster): if i == 8 and int(time.time() / 13) % 2 == 0: continue labels = {} - if i < 2: + # only the first two clusters have master nodes + if i < 2 and index < 2: if index == 0: labels['kubernetes.io/role'] = 'master' elif index == 1: