Skip to content

Commit

Permalink
Respect new node role label to detect master nodes (hjacobs#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Pawelczak committed Jan 15, 2018
1 parent 1181f36 commit b57f6dc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app/src/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ export default class Node extends PIXI.Graphics {
}

isMaster() {
return this.node.labels.master == 'true'
for (var key in this.node.labels) {
if (key == 'node-role.kubernetes.io/master' ||
key == 'kubernetes.io/role' && this.node.labels[key] == 'master' ||
key == 'master' && this.node.labels[key] == 'true' ) {
return true
}
}
}

getResourceUsage() {
Expand Down
7 changes: 6 additions & 1 deletion kube_ops_view/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ def query_mock_cluster(cluster):
continue
labels = {}
if i < 2:
labels['master'] = 'true'
if index == 0:
labels['kubernetes.io/role'] = 'master'
elif index == 1:
labels['node-role.kubernetes.io/master'] = ''
else:
labels['master'] = 'true'
pods = {}
for j in range(hash_int((index + 1) * (i + 1)) % 32):
# add/remove some pods every 7 seconds
Expand Down

0 comments on commit b57f6dc

Please sign in to comment.