diff --git a/api/handler/nodes.go b/api/handler/nodes.go index d73bfe3b6..97b89d54e 100644 --- a/api/handler/nodes.go +++ b/api/handler/nodes.go @@ -28,6 +28,8 @@ import ( const ( // NodeRolesLabelPrefix - NodeRolesLabelPrefix = "node-role.kubernetes.io" + // NodeRolesLabel - + NodeRolesLabel = "kubernetes.io/role" // NodeInternalIP - NodeInternalIP = "InternalIP" // NodeExternalIP - @@ -151,12 +153,16 @@ func (n *nodesHandle) HandleNodeInfo(node v1.Node) (nodeinfo model.NodeInfo, err } // get node roles var roles []string - for k := range node.Labels { + for k, v := range node.Labels { if strings.HasPrefix(k, NodeRolesLabelPrefix) { // string handle : node-role.kubernetes.io/worker: "true" role := strings.Split(k, "/")[1] roles = append(roles, role) } + if strings.HasPrefix(k, NodeRolesLabel) { + // string handle : kubernetes.io/role: master + roles = append(roles, v) + } continue } // req resource from Prometheus