Skip to content

Commit

Permalink
Adding Ready Count
Browse files Browse the repository at this point in the history
Signed-off-by: Bader Boland <baderbuddy@gmail.com>
  • Loading branch information
baderbuddy committed Dec 30, 2019
1 parent 7907ce7 commit 4eda90f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pkg/fleet/overview.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,22 @@ func nodesOverview(cfg api.Config, context string) (string, error) {
return "", errors.Wrap(err, "Can't create a clientset based on config provided")
}
nodes, err := cs.CoreV1().Nodes().List(metav1.ListOptions{})
nodeCount := len(nodes.Items)
readyCount := 0
for _, node in nodes.Items {
for _, nodeCondition in node.Status.Conditions {
if nodeCondition.Type == "Ready" {
if nodeCondition.Status == "True" {
readyCount++
}
break
}
}
}
if err != nil {
return "", errors.Wrap(err, "Can't get nodes in cluster")
}
noverview := fmt.Sprintf("%v", len(nodes.Items))
noverview := fmt.Sprintf("%v/%v", readyCount, nodeCount)
return noverview, nil
}

Expand Down

0 comments on commit 4eda90f

Please sign in to comment.