diff options
author | Matthew Heon <matthew.heon@pm.me> | 2020-01-10 13:37:10 -0500 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2020-01-16 13:49:21 -0500 |
commit | ac47e80b07ddc1e56e7c4fd6b0deca9f3bdc5f54 (patch) | |
tree | 7d5f49fde60dd3b9299991e248d3eb37f756d73a /libpod/oci_missing.go | |
parent | db00ee97e950290a6bc5d669cde0cbc54bb94afe (diff) | |
download | podman-ac47e80b07ddc1e56e7c4fd6b0deca9f3bdc5f54.tar.gz podman-ac47e80b07ddc1e56e7c4fd6b0deca9f3bdc5f54.tar.bz2 podman-ac47e80b07ddc1e56e7c4fd6b0deca9f3bdc5f54.zip |
Add an API for Attach over HTTP API
The new APIv2 branch provides an HTTP-based remote API to Podman.
The requirements of this are, unfortunately, incompatible with
the existing Attach API. For non-terminal attach, we need append
a header to what was copied from the container, to multiplex
STDOUT and STDERR; to do this with the old API, we'd need to copy
into an intermediate buffer first, to handle the headers.
To avoid this, provide a new API to handle all aspects of
terminal and non-terminal attach, including closing the hijacked
HTTP connection. This might be a bit too specific, but for now,
it seems to be the simplest approach.
At the same time, add a Resize endpoint. This needs to be a
separate endpoint, so our existing channel approach does not work
here.
I wanted to rework the rest of attach at the same time (some
parts of it, particularly how we start the Attach session and how
we do resizing, are (in my opinion) handled much better here.
That may still be on the table, but I wanted to avoid breaking
existing APIs in this already massive change.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/oci_missing.go')
-rw-r--r-- | libpod/oci_missing.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libpod/oci_missing.go b/libpod/oci_missing.go index 0faa1805b..ff7eea625 100644 --- a/libpod/oci_missing.go +++ b/libpod/oci_missing.go @@ -1,13 +1,16 @@ package libpod import ( + "bufio" "fmt" + "net" "path/filepath" "sync" "github.com/containers/libpod/libpod/define" "github.com/pkg/errors" "github.com/sirupsen/logrus" + "k8s.io/client-go/tools/remotecommand" ) var ( @@ -107,6 +110,16 @@ func (r *MissingRuntime) UnpauseContainer(ctr *Container) error { return r.printError() } +// HTTPAttach is not available as the runtime is missing +func (r *MissingRuntime) HTTPAttach(ctr *Container, httpConn net.Conn, httpBuf *bufio.ReadWriter, streams *HTTPAttachStreams, detachKeys *string, cancel <-chan bool) error { + return r.printError() +} + +// AttachResize is not available as the runtime is missing +func (r *MissingRuntime) AttachResize(ctr *Container, newSize remotecommand.TerminalSize) error { + return r.printError() +} + // ExecContainer is not available as the runtime is missing func (r *MissingRuntime) ExecContainer(ctr *Container, sessionID string, options *ExecOptions) (int, chan error, error) { return -1, nil, r.printError() |