349 Commits

Author SHA1 Message Date
e133a06d2f images --size
Add a --size option to podman images to allow for disabling computing
the size of listed images.  If listing images is critical to
performance, user may chose to turn off size computation to speed things
up.

Context: #13755
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-04-08 10:09:38 +02:00
41a6dd36f6 Update swagger to improve compatibility
[NO NEW TESTS NEEDED]

Improve swagger and handler code compatibility.

Fixes #12804

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-03-22 15:20:30 -07:00
95dad4d8a4 podman rmi --ignore
Add an `--ignore` flag to `podman image rm` to instruct ignoring image
if a specified image does not exist and to not throw an error.  Other
commands (e.g., `podman container rm`) already support this flag.

Such an `--ignore` flag can come in handy in clean-up scripcts such as
the teardown phases in the Podman tests.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-03-19 10:05:43 +01:00
fbbcb957c7 container-commit: support --squash to squash layers into one
Allow users to commit containers into a single layer.

Usage
```bash
podman container commit --squash <name>
```

Signed-off-by: Aditya R <arajan@redhat.com>
2022-02-23 17:38:28 +05:30
3f28d697ee Add 409 response to swagger godoc
When attempting to create a network with a name that already exists,
a 409 status code will be returned

[NO NEW TESTS NEEDED]

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-02-10 13:47:24 -07:00
e405fefb31 [NO NEW TEST NEEDED] Add schema for ImageCreate 200 response.
Signed-off-by: Tom Deseyn <tom.deseyn@gmail.com>
2022-02-09 10:12:47 +01:00
44a87229b6 Update godoc, swagger using wrong struct
Documentation for API volume list, pointed to a different struct
than the code.

[NO NEW TESTS NEEDED]

Fixes #12987

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-01-25 10:05:51 -07:00
7938f32c53 Remove unused param and clean API handlers
This commit removes error message string from utils.Error in pkg/api.
Param was not used inside a function for quite a long time
[NO NEW TESTS NEEDED]

Signed-off-by: Jakub Guzik <jguzik@redhat.com>
2022-01-22 00:31:18 +01:00
b9a2d8698a Handlers for generate systemd with custom dependencies
This commit includes:
* Handlers for generate systemd unit
  with manually defined dependencies such as:
  Wants=, After= and Requires=

* The new unit and e2e tests for checking generated systemd units
  for container and pod with custom dependencies

* Documented descriptions for custom dependencies options

Signed-off-by: Eugene (Evgenii) Shubin <esendjer@gmail.com>
2022-01-19 21:46:16 +05:00
bd09b7aa79 bump go module to version 4
Automated for .go files via gomove [1]:
`gomove github.com/containers/podman/v3 github.com/containers/podman/v4`

Remaining files via vgrep [2]:
`vgrep github.com/containers/podman/v3`

[1] https://github.com/KSubedi/gomove
[2] https://github.com/vrothberg/vgrep

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-18 12:47:07 +01:00
3c9e41bb53 Merge pull request #12572 from rhatdan/image
Remove two GetImages functions from API
2022-01-15 20:39:16 +01:00
8a7e70919f Refactor manifest list operations
* Update method/function signatures use the manifest list name and
  images associated with the operation explicitly, in general

  func f(ctx context.Context, manifestListName string,
         ImageNames []string, options *fOptions)

* Leverage gorilla/mux Subrouters to support API v3.x and v4.x for
  manifests
* Make manifest API endpoints more RESTful
* Add PUT /manifest/{id} to update existing manifests
* Add manifests.Annotate to go bindings, uncommented unit test
* Add DELETE /manifest/{Id} to remove existing manifest list, use
  PUT /manifest/{id} to remove images from a list
* Deprecated POST /manifest/{id}/add and /manifest/{id}/remove, use
  PUT /manifest/{id} instead
* Corrected swagger godoc and updated to cover API changes
* Update podman manifest commands to use registry.Context()
* Expose utils.GetVar() to obtain query parameters by name
* Unexpose server.registerSwaggerHandlers, not sure why this was ever
  exposed.
* Refactored code to use http.Header instead of map[string]string when
  operating on HTTP headers.
* Add API-Version header support in bindings to allow calling explicate
  versions of the API. Header is _NOT_ forwarded to the API service.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2022-01-14 16:13:35 -07:00
14940a067d Remove two GetImages functions from API
[NO NEW TESTS NEEDED] This is just code cleanup.

The remote API has three different GetImages functions, which I believe
can be handled by just one function.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-14 07:37:55 -05:00
92e7875210 podman build enable --all-platforms and --unsetenv
Make sure we add support for allplatforms and unsetenv to both local and
remote podman.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-01-13 15:01:28 +01:00
8f2358eeaa Add podman rm --depend
This option causes Podman to not only remove the specified containers
but all of the containers that depend on the specified
containers.
Fixes: https://github.com/containers/podman/issues/10360

Also ran codespell on the code

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-01-11 14:33:54 -05:00
6809237436 correct typo words in docs
"for creating a container" appears for networks and volumes

Signed-off-by: David Marshall <dmarshall@gmail.com>
2022-01-05 15:23:07 -08:00
1e3434d114 Update swagger documentation
[NO NEW TESTS NEEDED]

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-31 08:43:56 -05:00
3e9af2029f play kube add support for multiple networks
Allow the same --network options for play kube as for podman run/create.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:40 +01:00
46938bbf88 fix incorrect swagger doc for network dis/connect
The swagger api docs used the extra Body struct as part of the request
which is wrong. We just want the plain type.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:39 +01:00
c9ad1da51c Add restart-sec option to systemd generate
Signed-off-by: Ondra Machacek <omachace@redhat.com>
2021-12-03 12:11:28 +01:00
566b78dd02 generate systemd: add --start-timeout flag
Add a new flag to set the start timeout for a generated systemd unit.
To make naming consistent, add a new --stop-timeout flag as well and let
the previous --time map to it.

Fixes: #11618
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-11-23 09:38:51 +01:00
13ee1788f9 swagger: add layers to build api docs
Add missing `layer` entry to swagger docs for `/build`.

Signed-off-by: Aditya Rajan <arajan@redhat.com>
2021-11-22 21:14:16 +05:30
80e56fa12b Added optional container restore statistics
This adds the parameter '--print-stats' to 'podman container restore'.
With '--print-stats' Podman will measure how long Podman itself, the OCI
runtime and CRIU requires to restore a checkpoint and print out these
information. CRIU already creates process restore statistics which are
just read in addition to the added measurements. In contrast to just
printing out the ID of the restored container, Podman will now print
out JSON:

 # podman container restore --latest --print-stats
 {
     "podman_restore_duration": 305871,
     "container_statistics": [
         {
             "Id": "47b02e1d474b5d5fe917825e91ac653efa757c91e5a81a368d771a78f6b5ed20",
             "runtime_restore_duration": 140614,
             "criu_statistics": {
                 "forking_time": 5,
                 "restore_time": 67672,
                 "pages_restored": 14
             }
         }
     ]
 }

The output contains 'podman_restore_duration' which contains the
number of microseconds Podman required to restore the checkpoint. The
output also includes 'runtime_restore_duration' which is the time
the runtime needed to restore that specific container. Each container
also includes 'criu_statistics' which displays the timing information
collected by CRIU.

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-11-15 11:50:25 +00:00
6202e8102b Added optional container checkpointing statistics
This adds the parameter '--print-stats' to 'podman container checkpoint'.
With '--print-stats' Podman will measure how long Podman itself, the OCI
runtime and CRIU requires to create a checkpoint and print out these
information. CRIU already creates checkpointing statistics which are
just read in addition to the added measurements. In contrast to just
printing out the ID of the checkpointed container, Podman will now print
out JSON:

 # podman container checkpoint --latest --print-stats
 {
     "podman_checkpoint_duration": 360749,
     "container_statistics": [
         {
             "Id": "25244244bf2efbef30fb6857ddea8cb2e5489f07eb6659e20dda117f0c466808",
             "runtime_checkpoint_duration": 177222,
             "criu_statistics": {
                 "freezing_time": 100657,
                 "frozen_time": 60700,
                 "memdump_time": 8162,
                 "memwrite_time": 4224,
                 "pages_scanned": 20561,
                 "pages_written": 2129
             }
         }
     ]
 }

The output contains 'podman_checkpoint_duration' which contains the
number of microseconds Podman required to create the checkpoint. The
output also includes 'runtime_checkpoint_duration' which is the time
the runtime needed to checkpoint that specific container. Each container
also includes 'criu_statistics' which displays the timing information
collected by CRIU.

Signed-off-by: Adrian Reber <areber@redhat.com>
2021-11-15 11:50:24 +00:00
5c0351cc6f Log Apache access_log-like entries at Info level [NO NEW TESTS NEEDED]
Only log API access entries when --log-level set to Info or below.

Fixes #12181

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-11-05 10:34:02 -07:00
33643f4b09 Merge pull request #12159 from jwhonce/issues/12115
Implement top streaming for containers and pods
2021-11-02 22:28:54 +01:00
e63e90999c Merge pull request #12156 from matejvasek/docker-api-zero-value-fixes
Fix libpod API conformance to swagger
2021-11-02 18:19:24 +01:00
449cc7a5c2 Implement top streaming for containers and pods
* Implement API query parameter stream and delay for containers and
  pods top endpoints
* Update swagger with breaking changes
* Add python API tests for endpoints

Fixes #12115

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-11-02 08:11:14 -07:00
48d0d2b4a3 Fix swagger definitions
[NO TESTS NEEDED]

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-11-01 22:37:35 +01:00
120ad2d3ca Use correct swagger type in doc-comment
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-11-01 17:09:35 +01:00
218d91d76d Fix libpod API conformance to swagger
* Return empty array when nothing has been pruned.
* Use correct return type swagger doc-comment.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-11-01 16:53:49 +01:00
72e87c0ca8 Merge pull request #11924 from jwhonce/issues/11894
Refactor podman search to be more code friendly
2021-10-12 22:17:09 +02:00
0459484bdf Fix CI flake on time of shutdown for API service
* Increase timeout for tests to 10s
* To aid in debugging add PID to shutdown package logging
* Added new message for forced service shutdown
* Always wait for HTTP server to shutdown, duration of 0 not friendly
  to clients

Note: The log event

"IdleTracker: StateClosed transition by connection marked un-managed"

denotes a TCP connection has been initiated but no HTTP request was sent.
And is expected during these tests.

Fixes #11921

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-10-12 09:53:19 -07:00
b28a8bc198 Refactor podman search to be more code friendly
* JSON and API description fields are no longer truncated. Formatting
  moved to client, better support of MVP.
* --no-trunc now defaults to true
* Updated tests for changes

Closes #11894

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-10-12 09:30:40 -07:00
8d3aec9d08 Enable /debug/pprof API service endpoints
* Refactor sidecar HTTP service for /debug/pprof endpoints to use a TCP
  address given via new podman system service --pprof-address flag

* Allow same URL parsing in "system service" as bindings/connection.go

* Refactor NewServerWithSettings() to use entities.ServiceOptions
  in place of deleted server.Options

* Updated godoc for impacted functions and types

* Fixed API service Shutdown() to do an orderly shutdown when
  terminated and running with --time=0

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-10-08 13:57:20 -07:00
4ea5d69719 Add note about empty fields and null values for API responses
Add a note the global swagger docs about some fields not showing
up in responses as they are set to omitempty. Also add a note about
null values for complicated field types that swagger-go has a hard time
with.

[NO TESTS NEEDED]

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
2021-10-01 13:18:52 -04:00
a9a54eefab image prune: support removing external containers
Support removing external containers (e.g., build containers) during
image prune.

Fixes: #11472
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-09-28 10:24:16 +02:00
3d8dec982f Document missing /images/search query parameters
Include the tlsVerify, listTags query parameters for the compat and
libpod endpoint and document the default value for the amount of results
which are returned.

Signed-off-by: Jelle van der Waa <jvanderwaa@redhat.com>
2021-09-24 12:27:55 +02:00
1c4e6d8624 standardize logrus messages to upper case
Remove ERROR: Error stutter from logrus messages also.

[ NO TESTS NEEDED] This is just code cleanup.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-09-22 15:29:34 -04:00
49c5688a30 podman save: add --uncompressed
Add an option to `podman save` to allow uncompressed layers when
copying OCI images.  Do the neccessary plumbing for the remote client,
add tests and vendor in the latest commit from c/common to fetch
the neccessary changes in libimage.

Closes: #11613
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-09-22 12:38:07 +02:00
85e8fbf7f3 Wire network interface into libpod
Make use of the new network interface in libpod.

This commit contains several breaking changes:
- podman network create only outputs the new network name and not file
  path.
- podman network ls shows the network driver instead of the cni version
  and plugins.
- podman network inspect outputs the new network struct and not the cni
  conflist.
- The bindings and libpod api endpoints have been changed to use the new
  network structure.

The container network status is stored in a new field in the state. The
status should be received with the new `c.getNetworkStatus`. This will
migrate the old status to the new format. Therefore old containers should
contine to work correctly in all cases even when network connect/
disconnect is used.

New features:
- podman network reload keeps the ip and mac for more than one network.
- podman container restore keeps the ip and mac for more than one
  network.
- The network create compat endpoint can now use more than one ipam
  config.

The man pages and the swagger doc are updated to reflect the latest
changes.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-09-15 20:00:20 +02:00
64de4f612e Document all query parameter for /libpod/images/prune
Signed-off-by: Jelle van der Waa <jvanderwaa@redhat.com>
2021-09-14 21:54:06 +02:00
deaf969243 Refacter API server emphasis on logging
* To aid in debugging log API request and response bodies at trace
  level. Events can be correlated using the X-Reference-Id.
* Server now echos X-Reference-Id from client if set, otherwise
  generates an unique id.
* Move logic for X-Reference-Id into middleware
* Change uses of Header.Add() to Set() when setting Content-Type
* Log API operations in Apache format using gorilla middleware
* Port server code to use BaseContext and ConnContext

Fixes #10053

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-09-10 15:07:25 -07:00
f87f27ddc8 Add /containers/stats response to API docs
Include the response schema for a succesful request in the
/containers/stats API documentation

Additionally remove http 409 from /libpod/containers/stats docs, the
documentation was copied from the deprecated stats endpoint, when a
container is unavailabe the endpoint returns an empty list and no 409.

Signed-off-by: Jelle van der Waa <jvanderwaa@redhat.com>
2021-09-10 15:15:35 +02:00
536f23c0b7 Merge pull request #11431 from jmguzik/secrets-ls-filters
Add filtering functionality to http api secrets list
2021-09-07 19:24:20 +02:00
1150d1b0b8 Document default timeout for libpod API Container Restart
Signed-off-by: Jelle van der Waa <jvanderwaa@redhat.com>
2021-09-07 14:46:00 +02:00
d346e6e734 Add filtering functionality to http api secrets list
Filtering is missing in both compat API and libpod API, while docker
has filtering functinality. This commit enables filtering option using
name and id in both libpod and http API.

Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-09-03 10:29:31 +02:00
1e176923b1 teardown play kube
add the ability for play kube to tear down based on the yaml used to
play it.  it is indicated by --down in the play kube command.  volumes
are NOT deleted during the teardown.  pods and their containers are
stopped and removed.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2021-08-24 14:26:14 -05:00
a3f4fbd176 Merge pull request #11271 from jwhonce/issues/8577
Clean up swagger
2021-08-19 14:49:22 -04:00
0897946f60 [NO TESTS NEEDED] Clean up swagger
* Removed defined by unused responses
* Added missing body definitions
* Updated header input definitions

Outstanding issues:
* Supporting body ContainerConfig for /commit endpoint

Fixes #8577

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-08-19 07:57:54 -07:00