From d153561b133a71b7b77a8cb6d44898b6ffb6eda2 Mon Sep 17 00:00:00 2001 From: Danielle Lancashire Date: Fri, 20 Dec 2019 12:48:34 +0100 Subject: [PATCH] node_status: Add CSI Summary info This commit introduces two new fields to the basic output of `nomad node status `. 1) "CSI Controllers", which displays the names of registered controller plugins. 2) "CSI Drivers", which displays the names of registered CSI Node plugins. However, it does not implement support for verbose output, such as including health status or other fingerprinted data. --- command/node_status.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/command/node_status.go b/command/node_status.go index 4bbf443b9..3f8424e76 100644 --- a/command/node_status.go +++ b/command/node_status.go @@ -299,6 +299,24 @@ func nodeDrivers(n *api.Node) []string { return drivers } +func nodeCSIControllerNames(n *api.Node) []string { + var names []string + for name := range n.CSIControllerPlugins { + names = append(names, name) + } + sort.Strings(names) + return names +} + +func nodeCSINodeNames(n *api.Node) []string { + var names []string + for name := range n.CSINodePlugins { + names = append(names, name) + } + sort.Strings(names) + return names +} + func nodeVolumeNames(n *api.Node) []string { var volumes []string for name := range n.HostVolumes { @@ -340,6 +358,8 @@ func (c *NodeStatusCommand) formatNode(client *api.Client, node *api.Node) int { fmt.Sprintf("Drain|%v", formatDrain(node)), fmt.Sprintf("Eligibility|%s", node.SchedulingEligibility), fmt.Sprintf("Status|%s", node.Status), + fmt.Sprintf("CSI Controllers|%s", strings.Join(nodeCSIControllerNames(node), ",")), + fmt.Sprintf("CSI Drivers|%s", strings.Join(nodeCSINodeNames(node), ",")), } if c.short {