-
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
[ui] Actions service and flyout #19084
Conversation
Ember Test Audit comparison
|
c8935bd
to
ac1dd80
Compare
7b22c91
to
42069a8
Compare
3c9c975
to
eb68dab
Compare
* @param {string} allocID | ||
* @returns {string} | ||
*/ | ||
getActionSocketUrl(job, action, allocID) { |
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 file previously did much more than an Ember adapter ought to; it has since been moved to a dedicated Action service.
Copyright (c) HashiCorp, Inc. | ||
SPDX-License-Identifier: BUSL-1.1 | ||
~}} | ||
|
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.
A componentized dropdown/select box, which we use on the Job page, the Task page, and within the Actions flyout (within the context of a job or a task)
Copyright (c) HashiCorp, Inc. | ||
SPDX-License-Identifier: BUSL-1.1 | ||
~}} | ||
|
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.
be27f8e
to
cf26beb
Compare
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.
LGTM! Great work, Phil!
I found the code surprisingly straightforward to follow (coming from a non-JS background) and very well-structured and clearly written.
I did a lot of smoke-testing and the feature behaves as expected, with some corner cases that I described in the comments.
* | ||
* @param {import('../models/action-instance').default} actionInstance - The action instance model. | ||
*/ | ||
handleSocketClose(actionInstance) { |
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 something 🐟-y going on here. Whenever I stop actions, I get websocket errors from Nomad API.
2023-11-23T15:17:59.002+0100 [ERROR] http: request failed: method=GET path="/v1/job/actions-demo/action?namespace=default&action=echo%20time&allocID=d2604ab1-97d2-2e0a-ee02-448aad287525&task=task&group=group&tty=true&ws_handshake=true" error="websocket: close 1005 (no status)" code=500
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 fixed by #19172 (thank you, @pkazmierczak!)
import { base64DecodeString } from '../utils/encode'; | ||
import config from 'nomad-ui/config/environment'; | ||
|
||
export default class NomadActionsService extends Service { |
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 very well structured and easy to read code, I like it.
I found an issue with permissions that I'm a bit confused with. If I give myself a read
policy with no write permissions, the behavior is as expected: no actions-related widgets or buttons appear anywhere in the UI. So far so good. But if I give myself a minimal ACL that should allow me to use actions:
namespace "default" {
policy = "read"
capabilities = ["alloc-exec", "alloc-lifecycle"]
}
I then do get actions-related buttons and widgets, but whenever I try to run an action, I get a 500, and no output.
Logs say it's a permissions issue:
2023-11-23T15:48:38.229+0100 [ERROR] http: request failed: method=GET path="/v1/job/actions-demo/action?namespace=default&action=weather&allocID=5a2ba29f-ae21-cab1-df29-388a8bd081b7&task=task&group=group&tty=true&ws_handshake=true" error="Permission denied" code=500
But the code is wrong then, shouldn't be a 500. Also the UI doesn't give useful feedback on this:
Wouldn't it be better if it said that it's a permissions issue?
Or am I perhaps setting the ACL wrong somehow?
command/alloc_exec.go
Outdated
@@ -38,7 +38,7 @@ Usage: nomad alloc exec [options] <allocation> <command> | |||
When ACLs are enabled, this command requires a token with the 'alloc-exec', | |||
'read-job', and 'list-jobs' capabilities for the allocation's namespace. If | |||
the task driver does not have file system isolation (as with 'raw_exec'), | |||
this command requires the 'alloc-node-exec', 'read-job', and 'list-jobs' | |||
this command requires the 'alloc-node-exec', 'alloc-exec', 'read-job', and 'list-jobs' |
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.
Note: in testing this out, noticed that raw_exec
jobs required both alloc-exec
AND alloc-node-exec
capabilities. Updating the docs to reflect.
Hi @pkazmierczak , thanks for the review — opened up an issue re: error frames/response headers not surfacing for websockets @ #19164 IMO we should handle that separate of this PR, but it should still be handled. |
2ed4ffb
to
bd329b7
Compare
agreed. |
881cb71
to
532f7ae
Compare
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. |
A re-think to how we've handled Nomad Actions in the UI. Specifically, this means to address:
Resolves #19066