-
Notifications
You must be signed in to change notification settings - Fork 712
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 controls form container start, stop, pause, etc #598
Conversation
4ec4b3e
to
08a8d18
Compare
@@ -11,6 +12,15 @@ const NodeDetailsTable = React.createClass({ | |||
{this.props.title} | |||
</h4> | |||
|
|||
|
|||
<div className="node-details-table-row"> | |||
{this.props.capabilities.map(function(capability) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
handlers = map[string]xfer.CapabilityHandler{} | ||
) | ||
|
||
// HandleCapabilityRequest performs a capability request. |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Just curious how you see the request/response model working with longer-running (interactive) capabilities, like shell? Bridging through a websocket to the user's browser? or separate request/response for each chunk of data? |
const capabilityKey = "capability" | ||
|
||
// CapabilityRouter handles the impedence mismatch between posted Capability calls, | ||
// and websocket connections. |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
08a8d18
to
db576eb
Compare
I don't think we can build shell / logs with this just yet. I think we need to layer some more abstraction/plumbing on top first. I'm currently thinking that a request could return a 'pipe' instead a response. The pipe would have a different lifecycle, and use different messages on the same websocket. We might be able to use app<->client websocket too. Anyway I suggest we get the short-lived RPCs bit (start, stop, restart etc) right first, then think about logs & terminals. |
260c822
to
9e71d98
Compare
nodeID = vars["nodeID"] | ||
control = vars["control"] | ||
) | ||
handler, ok := cr.probes[probeID] |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Would it make sense to have this? i.e. treating controls as a "plugin" with app and probe components.
Thinking about it, they are fairly tightly integrated with the docker probe plugin and everything else, so maybe this doesn't make sense... |
re: treating as a plugin; as you say, the code it pretty tightly integrated, so I think the division you suggest would be pretty artificial. I'm trying to do the following:
The bit that doesn't fit it the probe's connection to the app logic, which I've put in xfer/, as thats where the http publisher are. On could argue this belongs in probe/, but I'm not too fussed either way. |
return xfer.ResponseErrorf("Invalid ID: %s", req.NodeID) | ||
} | ||
|
||
return xfer.ResponseError(container.Stop()) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Should probably show the container state in the details panel. |
Needs a |
done. |
After discussion, this has been punted to the next PR. |
38da875
to
970f75f
Compare
) | ||
|
||
func TestControls(t *testing.T) { | ||
controls.Register("foo", func(req xfer.Request) xfer.Response { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
7cc0fca
to
a8edc2c
Compare
+0.2% on coverage with 1.2k new loc! |
9bb9662
to
dfadc3e
Compare
Backend LGTM |
…g, and a filter for those containers. Also add integration test for container controls.
2bcca11
to
951bb55
Compare
- Make backend address configurable via env variable - `BACKEND_HOST=1.2.3.4:4040 npm start` points the frontend to the app on that server. Just for development - Render control icons - removed close x for details panel - added control icons in its space - closing of panel still works by clicking on same node, or background - Dont allow control while pending - Render and auto-dismiss control error - Make tests pass
951bb55
to
abcb94b
Compare
Frontend LGTM. |
Add controls form container start, stop, pause, etc
Add control interface for Scope. Allows UI to do RPCs all the way back to the probe, with the app doing the routing in the middle. Add metadata in the API so these controls can be appropriately rendered, and add some basic support in the UI.
This is a very hacky, very early implementation. Fixes #315 (see bug for some design notes).
Also:
Todo
Punted out of this PR: