391 Commits

Author SHA1 Message Date
8a8bae8299 Refactor API version values
* API-Version header now Major.Minor to support tools parsing this
   header
 * Libpod Version updated to 2.0.0 to reflect changes in API field
   values
 * API-Version and Libpod-API-Version headers are now included in all
   results

Fixes #7327

 * Header support tested against goland 2020.2 and
    https://www.jetbrains.com/help/idea/docker.html plugin

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-09-15 11:29:45 -07:00
0be5836e49 Merge pull request #7637 from vrothberg/fix-7263
events endpoint: header: do not wait for events
2020-09-15 17:19:45 +02:00
0b7cb2c6b2 events endpoint: header: do not wait for events
Do not wait for events to occur before writing the OK header.
Events can take an unknown amount of time to occur and clients
do not need to wait until then to know if the connection is
good.

Fixes: #7263
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-09-15 14:28:38 +02:00
146c68f3ac Refactor API build endpoint to be more compliant
* Refactor/Rename channel.WriteCloser() to encapsulate the channel
* Refactor build endpoint to "live" stream buildah output channels
  over API rather then buffering output
* Refactor bindings/tunnel build because endpoint changes
  * building tar file now in bindings rather then depending on
    caller
* Cleanup initiating extra image engine
* Remove setting fields to zero values (less noise in code)
* Update tests to support remote builds

Fixes #7136
Fixes #7137

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-09-14 13:46:59 -07:00
526f01cdf5 Fix up errors found by codespell
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-11 06:14:25 -04:00
3d33923374 Merge pull request #7536 from Luap99/api-network-filter
APIv2 Add network list filtering
2020-09-10 10:15:01 -04:00
9c4c883d79 Merge pull request #7572 from vrothberg/fix-7135
remote kill: don't wait for the container to stop
2020-09-09 12:22:08 -04:00
1b2b068ce8 Merge pull request #7569 from zhangguanzhang/fix-apiv2-top-response-two-value
fix APIv2 pods top of non-exist pod gets two response value
2020-09-09 09:12:40 -04:00
0533bc3588 compat kill: only wait for 0 signal and sigkill
Docker does not wait unconditionally.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-09-09 14:55:42 +02:00
fce2eaa6ca remote kill: don't wait for the container to stop
Invert the branch logic to match the comment.  Docker seems to wait for
the container while Podman does not.

Enable the remote-disabled system test as well.

Fixes: #7135
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-09-09 14:38:28 +02:00
a4ffed91da fix APIv2 pods top of non-exist pod gets two response value
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-09-09 18:50:17 +08:00
7fea46752c support multi-image (docker) archives
Support loading and saving tarballs with more than one image.
Add a new `/libpod/images/export` endpoint to the rest API to
allow for exporting/saving multiple images into an archive.

Note that a non-release version of containers/image is vendored.
A release version must be vendored before cutting a new Podman
release.  We force the containers/image version via a replace in
the go.mod file; this way go won't try to match the versions.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-09-08 08:47:19 +02:00
ce7d2bba1f Fix typo in the remove network api doc
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-09-07 15:40:05 +02:00
5b8f3f2f1f APIv2 Add network list filtering
Add the filter option to the libpod endpoint.
Add support for the name filter on the docker endpoint.

Add apiv2 tests for the network list endpoints.
Enable podman network integration tests for remote.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-09-07 15:39:41 +02:00
ebfea2f4f8 APIv2 add generate systemd endpoint
Add support for generating systemd units
via the api and podman-remote.

Change the GenerateSystemdReport type to return the
units as map[string]string with the unit name as key.

Add `--format` flag to `podman generate systemd`
to allow the output to be formatted as json.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-09-02 22:06:19 +02:00
97780a110b Merge pull request #7436 from rhatdan/variant
Add support for image pull overrides
2020-08-28 16:02:56 -04:00
0640cc7921 Merge pull request #7428 from mheon/apiv2_container_pod_errors
Ensure pod REST API endpoints include ctr errors
2020-08-28 09:59:37 -04:00
3c6603a2f8 Add support for variant when pulling images
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-08-28 09:36:11 -04:00
e3edb7ba9d Merge pull request #7416 from Luap99/fix-swagger-doc
[CI:DOCS] fix swagger api docs
2020-08-28 09:28:51 -04:00
580c39fea8 Ensure pod REST API endpoints include ctr errors
The APIv2 pod endpoints that operate on multiple containers, such
as Start, Kill, Pause, Unpause, do not report errors encountered
by individual containers, because they incorrectly assume that
any error is fatal. The documentation for the Libpod API calls
notes, however, that ErrPodPartialFail will *always* be returned
if any container failed; so we need to ignore that error and
continue to collating and returning container errors.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-08-27 15:04:22 -04:00
b13af4537f Merge pull request #7451 from mheon/fix_7195
Send HTTP Hijack headers after successful attach
2020-08-27 12:57:33 -06:00
2ea9dac5e1 Send HTTP Hijack headers after successful attach
Our previous flow was to perform a hijack before passing a
connection into Libpod, and then Libpod would attach to the
container's attach socket and begin forwarding traffic.

A problem emerges: we write the attach header as soon as the
attach complete. As soon as we write the header, the client
assumes that all is ready, and sends a Start request. This Start
may be processed *before* we successfully finish attaching,
causing us to lose output.

The solution is to handle hijacking inside Libpod. Unfortunately,
this requires a downright extensive refactor of the Attach and
HTTP Exec StartAndAttach code. I think the result is an
improvement in some places (a lot more errors will be handled
with a proper HTTP error code, before the hijack occurs) but
other parts, like the relocation of printing container logs, are
just *bad*. Still, we need this fixed now to get CI back into
good shape...

Fixes #7195

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-08-27 12:50:22 -04:00
fa6ba68026 fix apiv2 will create containers with incorrect commands
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-08-24 23:07:30 +08:00
b4adc17614 [CI:DOCS] fix swagger api docs
Separate the volume endpoints into compat and libpod,
as it is done for the other endpoints.

Move the libpod image push endpoint to images.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-08-23 15:10:22 +02:00
fb4977b936 fix /libpod/pods/json returns null when there are no pods
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-08-21 17:48:14 +08:00
8caed30574 Merge pull request #7283 from mheon/pod_infra_has_exit_cmd
Ensure pod infra containers have an exit command
2020-08-17 21:08:32 +02:00
c4b2078508 Clean up pods before returning from Pod Stop API call
This should help alleviate races where the pod is not fully
cleaned up before subsequent API calls happen.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2020-08-17 11:04:26 -04:00
0f4e2be073 podman.service: use sdnotiy
Commit 2b6dd3fb4384 set the killmode of the podman.service to the
systemd default which ultimately lead to the problem that systemd
will kill *all* processes inside the unit's cgroup and hence kill
all containers whenever the service is stopped.

Fix it by setting the type to sdnotify and the killmode to process.
`podman system service` will send the necessary notify messages
when the NOTIFY_SOCKET is set and unset it right after to prevent
the backend and container runtimes from jumping in between and send
messages as well.

Fixes: #7294
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-08-13 17:53:59 +02:00
569854d634 Unconditionally retrieve pod names via API
The ListContainers API previously had a Pod parameter, which
determined if pod name was returned (but, notably, not Pod ID,
which was returned unconditionally). This was fairly confusing,
so we decided to deprecate/remove the parameter and return it
unconditionally.

To do this without serious performance implications, we need to
avoid expensive JSON decodes of pod configuration in the DB. The
way our Bolt tables are structured, retrieving name given ID is
actually quite cheap, but we did not expose this via the Libpod
API. Add a new GetName API to do this.

Fixes #7214

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-08-10 10:15:51 -04:00
3173a18f6f Merge pull request #7215 from vrothberg/flatten-the-curve
images: speed up lists
2020-08-08 07:14:37 -04:00
8827100b98 image list: speed up
Listing images has shown increasing performance penalties with an
increasing number of images.  Unless `--all` is specified, Podman
will filter intermediate images.  Determining intermediate images
has been done by finding (and comparing!) parent images which is
expensive.  We had to query the storage many times which turned it
into a bottleneck.

Instead, create a layer tree and assign one or more images to nodes that
match the images' top layer.  Determining the children of an image is
now exponentially faster as we already know the child images from the
layer graph and the images using the same top layer, which may also be
considered child images based on their history.

On my system with 510 images, a rootful image list drops from 6 secs
down to 0.3 secs.

Also use the tree to compute parent nodes, and to filter intermediate
images for pruning.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-08-07 12:14:11 +02:00
7eca5571dc Merge pull request #7204 from baude/issue7197
Missing return after early exit
2020-08-04 14:16:40 +02:00
246603041c docker-compose uses application/tar
even though the official documentation suggests that application/x-tar should be used for tar files, it seems docker-compose uses application/tar.  we now accept them and issue a warning.

Fixes: #7185

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-08-03 14:19:21 -05:00
ab77487814 Missing return after early exit
the exists code was plagued by a missing return statement meant to trigger an early exit.

Fixes: #7197

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-08-03 13:58:41 -05:00
70c75bc113 Merge pull request #7097 from QiWang19/usagedate
[CI:DOCS] apiv2 fix volumes not included field
2020-08-03 10:05:07 -04:00
96ece0ca56 Merge pull request #7188 from zhangguanzhang/network-404
API returns 500 in case network is not found instead of 404
2020-08-03 09:13:40 -04:00
41358f5ea0 Merge pull request #7158 from rhatdan/commit
Handle single character images
2020-08-03 09:08:02 -04:00
bfd34542f4 Merge pull request #7141 from rhafer/image_descr_test
Add test case for description being present in search result
2020-08-03 03:06:24 -04:00
45b100d21c API returns 500 in case network is not found instead of 404
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-08-02 22:21:28 +08:00
cff727d488 Add versioned _ping endpoint
Fixes #7008

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-07-31 10:19:23 -07:00
54256fbe78 Make search --no-trunc work for podman remote
The HTTP API for image search was still lacking support of the NoTrunc
parameter.

Signed-off-by: Ralf Haferkamp <rhafer@suse.com>
2020-07-31 15:39:57 +02:00
bcbb5f9963 API: Fix 'podman image search` missing description
`podman image search` returned wrong results for the image "Description" as
it was mapped to the wrong field ("ID") in the search results.
Basically cherry-picked into the api from
commit cf5c63b5c492e41d72b6e3b6d75b5f39b0a957fd.

Signed-off-by: Ralf Haferkamp <rhafer@suse.com>
2020-07-31 15:39:57 +02:00
0785d6af15 Handle single character images
Currently you can only specify multiple character for image names
when executing podman-remote commit

podman-remote commit a b
Will complete, but will save the image without a name.

podman-remote commit a bb
Works.

This PR fixes and now returns an error if the user doees not specify an
image name to commit to.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-30 17:42:15 -04:00
23294c9cf6 Return NamesHistory when returning remote images
We are returning bogus data in podman-remote images --format json.
This change will match the same data returned my podman images --format json.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-29 14:17:56 -04:00
4dbfac6cde [CI:DOCS] apiv2 fix volumes not inculded field
Do not use volume from docker since UsageData field is not need. It's nullable in docker API and expensive to add.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2020-07-29 12:08:51 -04:00
288ebec6e7 Merge pull request #6909 from rhatdan/podman
Switch all references to github.com/containers/libpod -> podman
2020-07-28 10:12:55 -04:00
a5e37ad280 Switch all references to github.com/containers/libpod -> podman
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-28 08:23:45 -04:00
f657e5551e compat/info.go: TrimPrefix(CGroupsVersion, "v")
For compatibility with Docker: 846b7e24ba/api/swagger.yaml (L4528-L4534)

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-07-28 18:17:13 +09:00
5ee35ca783 API events: fix parsing error
Fix an error where an absent "filters" parameter led to JSON parsing
errors.

Fixes: #7078
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-27 10:02:55 +02:00
ba6a182155 Remove 'experimental' from API doc
The v2.0 reference [page](http://docs.podman.io/en/latest/Reference.html)
lists the API as experimental.  Removed that word and reworked the first
paragraph a bit based on verbiage that @mheon put together for the
API intro blog.

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2020-07-25 13:57:40 -04:00