-
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
allocs: Add nomad alloc signal command #5515
Conversation
This command will be used to send a signal to either a single task within an allocation, or all of the tasks if <task-name> is omitted. If the sent signal terminates the allocation, it will be treated as if the allocation has crashed, rather than as if it was operator-terminated. Signal validation is currently handled by the driver itself and nomad does not attempt to restrict or validate them.
b8ad346
to
1a04e22
Compare
1a04e22
to
33dfda2
Compare
command/alloc_signal.go
Outdated
} | ||
|
||
count := len(a.All) | ||
if count > 3 { |
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.
this is preventing auto-complete from working if they have already typed nomad alloc -s SIGUSR1
is that intended?
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.
oh - nope. I'll take a look into the predictor to see how to work around that - good spot 😭
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.
some questions about autocomplete, otherwise, LGTM
command/alloc_signal.go
Outdated
return []string{} | ||
} else if count <= 2 { | ||
// Searching for an alloc because we either have only [signal] or [signal prefix] | ||
resp, _, err := client.Search().PrefixSearch(a.Last, contexts.Allocs, nil) |
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.
this will return all extant allocations, even if they are stopped... do we want to (can we afford to) filter down by running allocations?
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.
there's no good way to do this here tbh - I assume people usually want this for "i know the first few characters", which there's usually fairly minimal overlap of
5f1b3e7
to
7f102bc
Compare
@@ -4,6 +4,8 @@ import ( | |||
"fmt" | |||
"sort" | |||
"time" | |||
|
|||
"github.com/hashicorp/nomad/nomad/structs" |
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.
The API package shouldn't reference the internal nomad/structs package - doing so leaks many internal packages and transitive dependencies to api clients and make dependency management more complicated, specially for go mod users.
Can you copy the relevant structs here?
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. |
This command will be used to send a signal to either a single task within
an allocation, or all of the tasks if is omitted. If the sent
signal terminates the allocation, it will be treated as if the allocation
has crashed, rather than as if it was operator-terminated.
Signal validation is currently handled by the driver itself and nomad does
not attempt to restrict or validate them. There is future work to ensure
compatibility of drivers and portability of signal names.