-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the Nomad agent version to the node-status CLI output. #3002
Conversation
nomad/structs/structs.go
Outdated
@@ -996,6 +996,9 @@ type Node struct { | |||
// together for the purpose of determining scheduling pressure. | |||
NodeClass string | |||
|
|||
// Build represents the Nomad version the node is running | |||
Build string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove from the Node struct
and only add to the stub
nomad/structs/structs.go
Outdated
@@ -1072,6 +1076,7 @@ type NodeListStub struct { | |||
Datacenter string | |||
Name string | |||
NodeClass string | |||
Build string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build
-> Version
nomad/structs/structs.go
Outdated
@@ -1057,6 +1060,7 @@ func (n *Node) Stub() *NodeListStub { | |||
Datacenter: n.Datacenter, | |||
Name: n.Name, | |||
NodeClass: n.NodeClass, | |||
Build: n.Build, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can pull this out of the attributes map. The key is nomad.version
command/node_status.go
Outdated
@@ -149,9 +149,9 @@ func (c *NodeStatusCommand) Run(args []string) int { | |||
// Format the nodes list | |||
out := make([]string, len(nodes)+1) | |||
if c.list_allocs { | |||
out[0] = "ID|DC|Name|Class|Drain|Status|Running Allocs" | |||
out[0] = "ID|DC|Name|Class|Build|Drain|Status|Running Allocs" | |||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep it for only -verbose
. Most people aren't running mixed clusters so it will just needlessly expand the width of output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any thoughts on how to best accomplish this @dadgar? From my understanding verbose is currently only used to determine the length of the nodeID displayed. I am trying to avoid using numerous else ifs to reconcile the differences between the -allocs and -verbose flag usage:
if c.list_allocs && !c.verbose {
out[0] = "ID|DC|Name|Class|Drain|Status|Running Allocs"
} else if c.list_allocs && c.verbose {
out[0] = "ID|DC|Name|Class|Build|Drain|Status|Running Allocs"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, you may want to try breaking it into:
out := "ID|DC|Name|Class|"
if c.verbose {
out += "Version|"
}
out += "Drain|Status"
if c.list_allocs {
out += "|Running Allocs"
}
|
I don't think the failure is related to this change. |
@dadgar anything else I can do to get this merged in? |
Sorry for the delay! LGTM |
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
The Nomad agent version will now be displayed when running the
nomad node-status
command which brings the command inline with thenomad server-members
command which already displays the version information.Closes #2993