146 Commits

Author SHA1 Message Date
65c3a56602 fix misc remote build issues
address problem when multiple -t were sent.  and rework remote build's tarball if a context dir is given other than ".".

Fixes: #6578
Fixes: #6577

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-06-17 09:01:43 -05:00
4fb0f56063 Merge pull request #6638 from jwhonce/issues/6548
[CI:DOCS] Fixes #6548
2020-06-17 11:20:51 +02:00
64d3508a94 [CI:DOCS] Fixes #6548
* Update swagger documentation

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-06-16 15:57:38 -07:00
05b90a04b2 [CI:DOCS] Fix carriage returns in API v2 header
ReadTheDocs was wrapping lines and removing leading spaces unless there
a blank line in between.  This adds the blank lines to make the
examples more readable on https://docs.podman.io/en/latest/_static/api.html

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2020-06-11 16:02:06 -04:00
dee1bf0d2f [CI:DOCS] Add quick start directions to APIv2 Dock
Adds some quick start up directions to the top of the
API v2 documentation and a few examples.
This strongly leverages comments from @jgallucci32 in #6535.

Fixes: #6535

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2020-06-11 09:15:51 -04:00
4bb43b898d Fixup issues found by golint
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-10 05:49:41 -04:00
e0d9404634 Enable detached exec for remote
The biggest obstacle here was cleanup - we needed a way to remove
detached exec sessions after they exited, but there's no way to
tell if an exec session will be attached or detached when it's
created, and that's when we must add the exit command that would
do the removal. The solution was adding a delay to the exit
command (5 minutes), which gives sufficient time for attached
exec sessions to retrieve the exit code of the session after it
exits, but still guarantees that they will be removed, even for
detached sessions. This requires Conmon 2.0.17, which has the new
`--exit-delay` flag.

As part of the exit command rework, we can drop the hack we were
using to clean up exec sessions (remove them as part of inspect).
This is a lot cleaner, and I'm a lot happier about it.

Otherwise, this is just plumbing - we need a bindings call for
detached exec, and that needed to be added to the tunnel mode
backend for entities.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-06-02 15:30:42 -04:00
45a7e7266e Add bindings for exec and enable attached remote
This adds bindings for starting exec sessions, and then uses them
to wire up detached exec. Code is heavily based on Attach code
for containers, slightly modified to handle exec sessions.

Bindings are presently attached-only, detached is pending on a
Conmon update landing in CI. I'll probably get to that next.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-06-01 17:24:00 -04:00
c479d63dd6 Merge pull request #6356 from baude/v2copyendpoints
v2 copy endpoints
2020-05-30 05:06:48 -04:00
dc80267b59 compat handlers: add X-Registry-Auth header support
* Support the `X-Registry-Auth` http-request header.

 * The content of the header is a base64 encoded JSON payload which can
   either be a single auth config or a map of auth configs (user+pw or
   token) with the corresponding registries being the keys.  Vanilla
   Docker, projectatomic Docker and the bindings are transparantly
   supported.

 * Add a hidden `--registries-conf` flag.  Buildah exposes the same
   flag, mostly for testing purposes.

 * Do all credential parsing in the client (i.e., `cmd/podman`) pass
   the username and password in the backend instead of unparsed
   credentials.

 * Add a `pkg/auth` which handles most of the heavy lifting.

 * Go through the authentication-handling code of most commands, bindings
   and endpoints.  Migrate them to the new code and fix issues as seen.
   A final evaluation and more tests is still required *after* this
   change.

 * The manifest-push endpoint is missing certain parameters and should
   use the ABI function instead.  Adding auth-support isn't really
   possible without these parts working.

 * The container commands and endpoints (i.e., create and run) have not
   been changed yet.  The APIs don't yet account for the authfile.

 * Add authentication tests to `pkg/bindings`.

Fixes: #6384
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-05-29 15:39:37 +02:00
c64abd0b03 Merge pull request #6407 from baude/v2eventsstream
Add streaming ability to endpoint
2020-05-27 15:07:32 -04:00
8438fa4fec Add streaming ability to endpoint
Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-05-27 12:16:39 -05:00
d6fd0952f8 v2 libpod push: correct docs
The swagger documentation for the libpod push endpoint were not in sync
with the implementation.  Correct these docs to reflect the parameters
that are actually supported.

Fixes: #6388
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-05-27 15:26:46 +02:00
5dfddf04ee v2 copy endpoints
add copy endpoint inputs and outputs.  these endpoints are not implemented yet, nor are any bindings.  this allows us to update this later without having to change our api version.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-05-26 12:04:20 -05:00
0b7b974868 Merge pull request #6238 from baude/v2compatnet
network compatibility endpoints for API
2020-05-25 04:46:47 -04:00
c3af2faab2 network compatibility endpoints for API
add endpoints for networking compatibility with the API.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-05-22 13:48:52 -05:00
6f5bc712de Add MethodNotAllowedHandler() to add in debugging
Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-05-22 11:48:13 -07:00
a61f9fd547 Removes remote system reset functionality. skip e2e test for remote.
As system reset too dangerous for remote use, deleting the functionality
and the test case.

Signed-off-by: Sujil02 <sushah@redhat.com>
2020-05-22 07:49:55 -04:00
845a795a7a v2 podman-remote build
this is a very basic implementation of build.  some of the more advanced options need to be included still as well.  i think the endpoints for compat and libpod will have to split given buildahs more advanced set of options.  that should probably be done by someone more experienced with build internals.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-05-21 14:22:11 -05:00
8675a09e2e [CI:DOCS] Image tree endpoint should return 404
when trying to get an image tree for a missing image, it should return a 404.  doc fix only.

Fixes: #6289

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-05-20 09:30:20 -05:00
6287a55852 V2 Implement terminal handling in bindings attach
* Add support for /exec/{id}/resize
* Add support for ErrSessionNotFound
* Resize container TTY as stdin changes size
* Refactor all resize functions into one handler

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-05-18 11:21:06 -07:00
fe16f8f67a v2endpoint remove image path correction
the endpoint for single image removal (on the libpod side) should be as follows:

versionedPath/libpod/images/IMAGENAME

The DELETE method then signifies the removal of the image.

Fixes: #6261

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-05-18 09:35:51 -05:00
6d1e5c713a Drop APIv2 resize endpoint
Jhon is working on an alternative version that will combine
container and exec session resize, so we'll wait for that.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-05-15 15:02:41 -04:00
1641f4fc0d Update API documentation for Inspect
Most importantly, note the pruning behavior of compat Inspect.

Less importantly, note that the Tty parameter to Start is only
ignored, as opposed to being not supported.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-05-14 17:00:19 -04:00
cf1f13af98 Add APIv2 handler for resizing exec sessions
Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-05-14 16:56:01 -04:00
ce56b68871 Wire in endpoint for ExecStart
This is still very early not not well tested, and missing resize
capability, but it does provide the first bits of exec.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-05-14 16:56:01 -04:00
cf502b99fe enable podman v2 networking for remote client
Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-05-12 13:23:43 -05:00
03c29c357f add podman remote system df
Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-05-12 08:35:48 -05:00
1c6ae73a89 Adds tunnel routes for system reset.
Adds tunnel routes for system reset.
Makes forces flag local as options are not propogated down the stack.
Adds relevant test cases and swagger docs.

Signed-off-by: Sujil02 <sushah@redhat.com>
2020-05-11 17:03:32 -04:00
931bd5ace6 V2 Impliment tunnelled podman version
Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-05-08 15:57:26 -07:00
f269be3a31 add {generate,play} kube
Add the `podman generate kube` and `podman play kube` command.  The code
has largely been copied from Podman v1 but restructured to not leak the
K8s core API into the (remote) client.

Both commands are added in the same commit to allow for enabling the
tests at the same time.

Move some exports from `cmd/podman/common` to the appropriate places in
the backend to avoid circular dependencies.

Move definitions of label annotations to `libpod/define` and set the
security-opt labels in the frontend to make kube tests pass.

Implement rest endpoints, bindings and the tunnel interface.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-05-06 17:08:22 +02:00
7f97896c59 image removal: refactor part 2
Continue the refactoring of image removal.  I didn't manage to break all
the following changes into smaller and easier to digest commits due to
time constraints:

 * Return an error slice instead of a single error. Use multierror only
   in the client/frontend.  Reflect that in the types.

 * Use the batch image removal in the client while preserving the more
   rest-idiomatic single-image removal endpoint.

 * Add a new handler for the single-image removal endpoint to make it
   share the same code as the batch endpoint.

 * Expose bindings for the single and batch endpoints, so we can
   properly test them.

 * Add several convenience functions for error handling to
   pkg/errorhandling.

 * Set the correct error type in libpod to set the exit code to 2 when
   one or more containers are using an image.

 * Massage the bindings tests a bit and tackle compilation errors.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-05-04 16:01:45 +02:00
4ed125f7b5 Merge pull request #5907 from sujil02/systemprune-v2
Adding system prune for podman v2
2020-04-28 18:11:39 +02:00
7ee0f7e14c implement pod stats
Implement pod stats for the local and remote client. Both code paths end
up in infra/abi to allow for code share.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-04-27 12:00:35 +02:00
5436e31441 Adding system prune for podman v2
Register system prune route, handler to support system prune,
Adds testcase to validate the system prune flow.

Signed-off-by: Sujil02 <sushah@redhat.com>
2020-04-24 15:44:07 -04:00
d7a27b8e84 Instrumentation to answer #5765
* currently wired to localhost:8888 to prevent access from off machine

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-04-22 11:07:28 -07:00
09dc701097 podman rmi: refactor logic
While this commit was initially meant to fix #5847, it has turned into a
bigger refactoring which I did not manage to break into smaller pieces:

 * Fix #5847 by refactoring the image-removal logic.

 * Make the api handler for image-removal use the ABI code. This way,
   both (i.e., ABI and Tunnel) end up using the same code.  Achieving
   this code share required to move some code around to prevent circular
   dependencies.

 * Everything in pkg/api (excluding pkg/api/types) must now only be
   accessed from code using `ABISupport`.

 * Avoid imports from entities on handlers to prevent circular
   dependencies.

 * Move `podman system service` logic into `cmd` to prevent circular
   dependencies - it depends on pkg/api.

 * Also remove the build header from infra/abi files.  It will otherwise
   confuse swagger and other tools; errors we cannot fix as go doesn't
   expose a build-tag env variable.

Fixes: #5847
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-04-21 08:12:25 +02:00
e5e625b2a6 Merge pull request #5872 from jwhonce/wip/options
V2 Fix support for tcp://[::]<port> connections
2020-04-20 10:42:00 -04:00
4e0326241b V2 Fix support for tcp://[::]<port> connections
* Fix support for socket activation, on remote and service

$ systemd-socket-activate -l 8083 --fdname=podman bin/podman system service --log-level=debug --time=30
$ bin/podman-remote --remote=tcp://[::]:8083 image ls

Or, use the podman.{socket,service} unit files

$ bin/podman-remote --remote=unix:///run/podman/podman.sock image ls

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-04-17 16:39:59 -07:00
37f3b191d5 Add pod prune for api v2.
Add the ability to prune pods for api v2,
Includes the addition of force flag, for client side prompt.
Update test suite to support this use case.

Signed-off-by: Sujil02 <sushah@redhat.com>
2020-04-17 17:30:58 -04:00
ba430bfe5e podman v2 remove bloat v2
rid ourseleves of libpod references in v2 client

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-16 12:04:46 -05:00
ba26c763c5 swagger-check: new CI tool to cross-check swagger
New script cross-references r.Handle() and r.HandleFunc()
calls against the preceding '// swagger:operation' comments,
and exits failure (with descriptive error messages) if any
comments do not match the code.

This script should not be necessary: the swagger comments
should be autogenerated from the source code.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-04-14 11:27:44 -06:00
d8853429eb Merge pull request #5755 from mheon/fix_attach
Improve APIv2 support for Attach
2020-04-14 14:53:59 +02:00
85c352d8bc Merge pull request #5709 from vrothberg/v2-search
podmanV2: implement search
2020-04-14 14:51:39 +02:00
d8d1aa49d2 v2podman add container init
add the ability to init a container both local and remote

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-13 19:51:20 -05:00
71f14bd792 Improve APIv2 support for Attach
A few major fixes here:
- Support for attaching to Configured containers, to match Docker
  behavior.
- Support for stream parameter has been improved (we now properly
  handle cases where it is not set).
- Initial support for logs parameter has been added.
- Setting attach streams when the container has a terminal is now
  supported.
- Errors are properly reported once the hijack has begun.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-04-13 14:08:01 -04:00
f8892e7c6b Refactor service idle support
* Move connection tracking into APIServer using ConnState()
* Remove Connection counters from CLI code
* Update events handler to support client not closing connection
* Improve logging messages

Fixes #5599

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-04-13 08:11:36 -07:00
ff52b7524a podmanV2: implement search
Also implement a new libpod endpoint to add more parameters and to
prevent us from converting between slices and maps and make use of
the filter parsing in the image backend.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-04-09 13:05:19 +02:00
e0847f5457 V2 podman system service
* Added support for system service
* Enabled linting on the varlinkapi source, needed to support V2
  service command
* Added support for PODMAN_SOCKET

Skip linting deprecated code

Rather than introduce bugs by correcting deprecated code, linting the
code is being skipped. Code that is being ported into V2 is being
checked.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-04-07 19:22:10 -07:00
8ae28a55ac V2 podman diff(changes) support
* Ported CLI command
* Added API endpoint
* Added bindings
* Updated swagger (TODO: n endpoints, one handler)

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-04-07 09:39:46 -07:00