Pod Attach API support for Agent
Proposal
The Javascript Client should support websocket access to the Pod attach API to allow for two-way communication between the shell environment deployed by gitlab-org/gitlab#418264 and GitLab.com
Technical Proposal
Create a websocket factory that handles all 5 kubernetes stream:
- Stream 0 - stdin, sending
- Stream 1 - stdout, receiving
- Stream 2 - stderr, receiving
- Stream 3 - status, receiving
- Stream 4 - resize, sending
The websocket wrapper object should have roughly the following interface:
interface WebSocketWrapper {
// on... functions return functions that remove the callback
onStdout: ((string) => any) => () => any
onStderr: ((string) => any) => () => any
onStatus: ((string) => any) => () => any
sendStdin: (string) => any
sendResize: (string) => any
The attach essential options are:
interface AttachOptions {
stdin: boolean,
stdout: boolean,
stderr: boolean,
tty: boolean,
namespace: string,
pod: string
}
The url pattern is /api/v1/namespaces/{namespace}/pods/{podName}/attach?{...opts}
Edited by Andrew Fontaine