763 Commits

Author SHA1 Message Date
24b364a230 Merge pull request #10486 from vrothberg/tag-digest-support
support tag@digest notation
2021-06-01 22:38:03 +02:00
ce2b331fef Merge pull request #10519 from matejvasek/use-req-ctx
Use request context instead of background
2021-06-01 22:37:02 +02:00
7a52440a6d Merge pull request #10508 from matejvasek/fix-from-img
Better error handing for images/create compat api
2021-06-01 19:10:47 +02:00
ad182976b6 Use request context instead of background
This prevents goroutine leak:
If background context were used then push operation would continue even
if client aborted request by closing connection.

[NO TESTS NEEDED]

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-06-01 15:25:20 +02:00
ef8ba99ff6 Use request context instead of background context
This fixes a goroutine leak. Previously if request was cancelled the
image pulling goroutine kept running regardless.

[NO TESTS NEEDED]

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-06-01 11:54:31 +02:00
3330f98762 Better error handing for images/create compat api
If server cannot resolve short name due to enforcing policy send
non-2xx status code.

[NO TESTS NEEDED]

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-05-31 15:30:56 +02:00
fb4a0c572e support tag@digest notation
Vendor in the latest HEAd of containers/common to implicitly support the
tag@digest notation for images.  To remain compatible with Docker, the
tag will be stripped off the image reference and is entirely ignored.

Fixes: #6721
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-05-31 14:38:43 +02:00
533d88b656 Add the option of Rootless CNI networking by default
When the containers.conf field "NetNS" is set to "Bridge" and the
"RootlessNetworking" field is set to "cni", Podman will now
handle rootless in the same way it does root - all containers
will be joined to a default CNI network, instead of exclusively
using slirp4netns.

If no CNI default network config is present for the user, one
will be auto-generated (this also works for root, but it won't be
nearly as common there since the package should already ship a
config).

I eventually hope to remove the "NetNS=Bridge" bit from
containers.conf, but let's get something in for Brent to work
with.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-05-26 15:03:30 -04:00
8bf852d5f0 Match swagger to "as built" output
* Remove all Types no longer referenced, they were never used

A future API breaking version of Podman API, may restore these Types
and push formatting into presentation layer vs. server.

Fixes #9578

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-05-21 09:50:58 -07:00
7bcfae44b9 Downgrade API service routing table logging
[NO TESTS NEEDED]

* Log the routing table output at Trace vs. Debug level. Reduce noise
  in debugging output.
* Tweak SDNotify message to report Warn when it fails. Previously
  failures were silent.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-05-20 09:10:45 -07:00
18efc5a3a7 Merge pull request #10371 from matejvasek/fix-wait-compat
fix: response of containers wait endpoint
2021-05-19 07:52:58 -04:00
92e858914d fix: response body of containers wait endpoint
The `Error` part of response must be nil (or omitted) if no error occurred.
Before this commit a zero value for the struct was returned.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-05-18 20:52:09 +02:00
bab7caafeb Fix formatting and indentation in network http api docs
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-05-17 22:38:20 +02:00
57b642525b Merge pull request #10271 from matejvasek/fix-wait-next-exit
fix: improved "containers/{name}/wait" endpoint
2021-05-10 14:31:40 -04:00
290a58286f Add client disconnect to build handler loop
[NO TESTS NEEDED]
In process of debugging added request channel check and logging message
to build loop. Unable to recreate build drop issue after this. 68k build
iterations without fail.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-05-10 09:46:40 -07:00
66e38ca55d fix: improved "containers/{name}/wait" endpoint
Using event API to detect changes to container instead of polling.
Polling was unreliable, sometime change of a state might have been
missed.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-05-10 13:40:06 +02:00
dd98e70302 fix: use UTC Time Stamps in response JSON
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-05-10 11:21:14 +02:00
54bed1025d Merge pull request #10265 from matejvasek/fix-get-multiple-imgs-compat
fix: compat API "images/get" for multiple images
2021-05-08 06:20:19 -04:00
141d3f1ac3 Merge pull request #10259 from rhatdan/pull
Report Download complete in Compatibility mode
2021-05-07 15:06:51 -04:00
c8deab8296 fix: compat API "images/get" for multiple images
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-05-07 20:35:03 +02:00
3757d8820d Report Download complete in Compatibility mode
Fixes: https://github.com/containers/podman/issues/10258

[NO TESTS NEEDED] Difficult to create tests for this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-05-07 11:53:19 -04:00
9da542a78b fix pre review request
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-05-06 19:36:36 +02:00
c58feddb7b fix: docker APIv2 images/get
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-05-05 22:03:11 +02:00
120e1b78ef Merge pull request #10208 from Luap99/play-kube-mac
add --mac-address to podman play kube
2021-05-05 10:10:16 -04:00
0f7d54b026 migrate Podman to containers/common/libimage
Migrate the Podman code base over to `common/libimage` which replaces
`libpod/image` and a lot of glue code entirely.

Note that I tried to leave bread crumbs for changed tests.

Miscellaneous changes:

 * Some errors yield different messages which required to alter some
   tests.

 * I fixed some pre-existing issues in the code.  Others were marked as
   `//TODO`s to prevent the PR from exploding.

 * The `NamesHistory` of an image is returned as is from the storage.
   Previously, we did some filtering which I think is undesirable.
   Instead we should return the data as stored in the storage.

 * Touched handlers use the ABI interfaces where possible.

 * Local image resolution: previously Podman would match "foo" on
   "myfoo".  This behaviour has been changed and Podman will now
   only match on repository boundaries such that "foo" would match
   "my/foo" but not "myfoo".  I consider the old behaviour to be a
   bug, at the very least an exotic corner case.

 * Futhermore, "foo:none" does *not* resolve to a local image "foo"
   without tag anymore.  It's a hill I am (almost) willing to die on.

 * `image prune` prints the IDs of pruned images.  Previously, in some
   cases, the names were printed instead.  The API clearly states ID,
   so we should stick to it.

 * Compat endpoint image removal with _force_ deletes the entire not
   only the specified tag.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-05-05 11:30:12 +02:00
fb7d16c7a8 add --mac-address to podman play kube
Add a new --mac-address flag to podman play kube. This is used to specify
a static MAC address which should be used for the pod. This option can be
specified several times because play kube can create more than one pod.

Fixes #9731

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-05-04 20:14:13 +02:00
f185666da8 compat api: Networks must be empty instead of null
The compat endpoint for container inspect must return {} instead of null
for NetworkSettings.Networks.

Fixes #9837

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-05-04 11:25:12 +02:00
92371d6382 Docker returns 'die' status rather then 'died' status
In order to be more compatible with Docker, we should return a
container die status rather then a "container died", Too late to
change this for Podman.

Partially fixes: https://github.com/containers/podman/issues/10168

[NO TESTS NEEDED] No easy way to test this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-28 15:56:19 -04:00
825c84efe1 Allow docker volume create API to pass without name
The Docker API does not require Volume name to be specified when
creating a volume.

Fixes: https://github.com/containers/podman/issues/9803

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-27 10:32:06 -04:00
2df5c6383f Fix removal race condition in ListContainers
It is possible that a container is removed between fetching the
initial list of containers and the second access during conversion.

Closes #10120

[NO TESTS NEEDED]

Signed-off-by: Jakob Ahrer <jakob@ahrer.dev>
2021-04-23 10:14:19 +02:00
9c8277247d Fixes from make codespell
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-21 13:16:33 -04:00
659dc7843c podman-remote should show podman.sock info
Currently podman-remote info does not show socket information.

Fixes: https://github.com/containers/podman/issues/10077

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-20 15:56:45 -04:00
a917bae67d Merge pull request #10025 from zhangguanzhang/remote-save-dir
Fixes podman-remote save to directories does not work
2021-04-19 10:22:52 -04:00
d7292dbf27 add --ip to podman play kube
Add a new --ip flag to podman play kube. This is used to specify a
static IP address which should be used for the pod. This option can be
specified several times because play kube can create more than one pod.

Fixes #8442

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-04-16 09:55:03 +02:00
21827f6a0c Fixes podman-remote save to directories does not work
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2021-04-15 19:24:46 +08:00
855a5a89dd Fix flake on failed podman-remote build : try 2
This time we are checking if the function actually succeeded,
otherwise we will report an error.

Also if we did not get the id, report unexpected failure.

[NO TESTS NEEDED] Still no good way to test this, but manually.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-14 16:51:13 -04:00
4347a62e08 Fix flake on failed podman-remote build
We have a race condition where podman build can fail
but still return an exit code of 0.  This PR ensures
that as soon as the build fails, the failed flag is set
eliminating the race.

Fixes: https://github.com/containers/podman/issues/10029

[NO TESTS NEEDED] Tests of failed builds are already in place, and
the elimination of the race should be enough.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-14 12:05:59 -04:00
9d74825c7e Reflect current state of prune implementation in docs
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-04-13 09:16:25 +02:00
59283322e7 [CI:DOCS] Correct status code for /pods/create
Swagger documentation reported that the API endpoint /pods/create
returned 200 while the as-built code returned 201. 201 is more
correct so documentation updated.

Tests already checked for 201 so no updated needed.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-04-12 09:33:51 -07:00
d41c33eb91 Update manifest API endpoints
* Add validation for manifest name
* Always return an array for manifests even if empty
* Add missing return in df handler when returning error. Caused an
  additional null to be written to client crashing python decoder.

When c/image is refactored to include manifests, manifest endpoints should
be revisited.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-04-09 11:00:06 -07:00
002180f02a Merge pull request #9971 from jwhonce/wip/df
Add missing return
2021-04-08 17:15:22 -04:00
3a03c2ec71 Merge pull request #9121 from tmds/swagger_remove_name_wildcards
[NO TESTS NEEDED] swagger: remove name wildcards
2021-04-08 13:04:23 -04:00
6cc0dc44ec Add missing return
libpod df handler missing a return after writing error to client. This
caused a null to be appended to JSON and crashed python decoder.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-04-08 08:59:37 -07:00
99e3111814 Merge pull request #9968 from pablofsf/fix-libpod-container-wait-docs
[CI:DOCS] Adjust libpod API Container Wait documentation to the code
2021-04-08 11:39:09 -04:00
9ba2e78cdc Merge pull request #9958 from jmguzik/limit-prune-filters-for-volumes
Volumes prune endpoint should use only prune filters
2021-04-07 18:55:23 -04:00
84907324fa Volumes prune endpoint should use only prune filters
Volumes endpoints for HTTP compat and libpod APIs allowed
usage of list HTTP endpoint filter funcs. Documentation in
case of compat API does not allow that. This commit aligns
code with the documentation and also ligns libpod with compat API.

Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-04-07 22:37:49 +02:00
5994377bd0 Merge pull request #9966 from jwhonce/wip/operation_id
[CI:DOCS] Update swagger definition of inspect manifest
2021-04-07 13:39:14 -04:00
6f6dad4048 Adjust libpod API Container Wait documentation to the code
Closes #9960

Signed-off-by: Pablo Correa Gómez <ablocorrea@hotmail.com>
2021-04-07 19:01:10 +02:00
9b35262ca2 [CI:DOCS] Update swagger definition of inspect manifest
* Changed reference in swagger to correct struture that was being
  returned.
* Added summary to ManifestAddLibpod to clean up generated web site
* Added serve target to Makefile, to aid in debugging generated
  web site

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-04-07 09:18:23 -07:00
71322d6c1f swagger: remove name wildcards
Signed-off-by: Tom Deseyn <tom.deseyn@gmail.com>
2021-04-07 15:21:44 +02:00