102 Commits

Author SHA1 Message Date
d1c26af144 apiv2 add bindings for logs|events
add go-bindings for logs and events. tests were also added.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-19 09:38:00 -05:00
52c8350530 serve swagger when present
register the swagger endpoint and add some error handling for when the swagger file does not exist

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-18 14:34:14 -05:00
9ef5d28759 Merge pull request #5449 from baude/manifests
apiv2 addition of manifests
2020-03-17 16:00:05 +01:00
abbbeacd68 apiv2 addition of manifests
add endpoints for create, add, remove, inspect, and push.  this allows manifests to be managed through the restful interfaces.

also added go-bindings and tests

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-16 10:03:55 -05:00
2099643aa2 add apiv2 healthcheck code
reworking binding and endpoint to actually work.  added documentation in swagger for and various return code possibilities.  add a good start on tests though we need some other container functions not yet implemented for that.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-13 07:43:12 -05:00
846ed00684 Update start stop api to use pod status function.
Update the strat and stop api to validate pod status based on status functions
rather than iterating over all the containers in the pod. (Addressing the TO-DO)

Signed-off-by: Sujil02 <sushah@redhat.com>
2020-03-10 14:37:47 -04:00
31112e4b08 Refactor handler packages
To help with packaging, the handlers in pkg/api/handlers are now found
in pkg/api/handler/compat.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-03-10 08:03:41 -07:00
ac354ac94a Fix spelling mistakes in code found by codespell
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-07 10:30:44 -05:00
c8de26fb08 Merge pull request #5374 from baude/create
add default network for apiv2 create
2020-03-07 14:16:43 +01:00
8b5e2a6297 add default network for apiv2 create
during container creation, if no network is provided, we need to add a default value so the container can be later started.

use apiv2 container creation for RunTopContainer instead of an exec to the system podman. RunTopContainer now also returns the container id and an error.

added a libpod commit endpoint.

also, changed the use of the connections and bindings slightly to make it more convenient to write tests.

Fixes: 5366
Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-03-06 14:31:45 -06:00
c3177b781b Merge pull request #5410 from st1971/api-fixes
APIv2: compatible api fixes
2020-03-06 21:19:55 +01:00
06f5664e9d Removed extraneous comments and defaults plus amended variable declaration
Signed-off-by: Steve Taylor <steven@taylormuff.co.uk>
2020-03-06 13:19:21 +00:00
920d09c174 Removed the unnecessary code
removed defaulting of  query.Size
amended types.LibpodToContainer, removed hard coded true from inspect call

Signed-off-by: Steve Taylor <steven@taylormuff.co.uk>
2020-03-06 13:17:56 +00:00
83e52cf787 Implemented size parameter on GetContainer
Signed-off-by: Steve Taylor <steven@taylormuff.co.uk>
2020-03-05 23:02:45 +00:00
da15f2f881 Implement size parameter on ListContainers
Signed-off-by: Steve Taylor <steven@taylormuff.co.uk>
2020-03-05 22:53:50 +00:00
1ef96364fe Map configured status to created to match docker API states
Signed-off-by: Steve Taylor <steven@taylormuff.co.uk>
2020-03-05 22:47:11 +00:00
9088a8a387 Fix to remove null entry from end of images json
Signed-off-by: Steve Taylor <steven@taylormuff.co.uk>
2020-03-05 22:37:31 +00:00
593eb7625a golangci: enable goimports
Enable the goimports linter and fix reports.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-03-05 20:03:44 +01:00
0904873100 rework apiv2 wait endpoint|binding
added the ability to wait on a condition (stopped, running, paused...) for a container.  if a condition is not provided, wait will default to the stopped condition which uses the original wait code paths.  if the condition is stopped, the container exit code will be returned.

also, correct a mux issue we discovered.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-28 09:36:53 -06:00
306b44380f binding tests for volumes
add binding tests for volumes: inspect(get), create, remove, prune, and list

implement filters ability for volumes

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-27 13:11:42 -06:00
d92b9b8859 more image binding tests
add two additional bindings tests for image usage.

add ability to use search filter on the endpoint.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-23 11:01:21 -06:00
f0df07b593 add more image tests for go bindings
adding more image tests for go bindings.  one big change is that the params were converted from map[string]string to url.values to account for the ability to send []string as query params

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-21 16:11:39 -06:00
ea153c8e2e search endpoint failure correction
when returning an invalid search, a return was omitted triggering a null on the consumer end.

Fixes: #5228

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-21 12:53:39 -06:00
585649df46 Merge pull request #5178 from marusak/expose_cpu
stats: Expose CPU usage in API
2020-02-21 11:04:16 -05:00
aae8874204 Merge pull request #5262 from schubter/signal-decode
APIv2: Fixed syscall.Signal not convertable by decoder
2020-02-21 07:33:22 -05:00
3e5699224b Merge pull request #5251 from sujil02/pod-test
Add test to validate the pod bindings api
2020-02-20 17:06:36 +01:00
d65ff6b3ec apiv2 container create using specgen
this uses the specgen structure to create containers rather than the outdated createconfig.  right now, only the apiv2 create is wired up.  eventually the cli will also have to be done.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-19 15:20:15 -06:00
3db43dcce3 Add test to validate the pod bindings api
Include test to validate pod create, start, stop, restart,
pause, unpause, list, and inspect api bindings.
Also includes bug fixes that resulted in invalid api responses.

Signed-off-by: Sujil02 <sushah@redhat.com>
2020-02-19 16:05:27 -05:00
aa1bb0b579 Merge pull request #5259 from schubter/apiv2-create-image
APIv2: Fixed CreateImageFromImage not respecting supplied Tag parameter
2020-02-19 17:30:37 +01:00
3aa32dff1d Fixed syscall.Signal not convertable by decoder
Signed-off-by: Andreas Schubert <schubter@gmail.com>
2020-02-19 15:04:24 +01:00
1e4129a19d Fixed typo in KillContainer
Signed-off-by: Andreas Schubert <schubter@gmail.com>
2020-02-19 13:48:10 +01:00
6e5cf818e9 Fixed CreateImageFromImage not respecting supplied Tag parameter
Signed-off-by: Andreas Schubert <schubter@gmail.com>
2020-02-19 10:36:44 +01:00
1bed53b02c Merge pull request #5247 from schubter/5242
APIv2: fixes decoder issue
2020-02-19 03:45:02 +01:00
4b96c3b2c8 adds missing query struct tags and exports the fields
Signed-off-by: Andreas Schubert <schubter@gmail.com>
2020-02-18 21:10:55 +01:00
024ddda123 Update mux rules to allow slashes in image names
%2F escaping is also supported.
Return better response on bad search terms

Fixes #5229

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-02-18 09:38:37 -07:00
98774e1476 stats: Expose CPU usage in API
`stats.CPU` is a number representing CPU usage in percents. It is possible
to calculate it from other exposed fields (once they are implemented
correctly) but why to do it, when this is already calculated.

This does not break API, it just adds another field.

Signed-off-by: Matej Marusak <mmarusak@redhat.com>
2020-02-17 20:05:14 +01:00
c0c44ae8a3 Fix handler and systemd activation errors
On panic from handler: log warning and stack trace, report
InternalServerError to client

When using `podman system service` make determining the listening endpoint deterministic.

  // When determining _*THE*_ listening endpoint --
  // 1) User input wins always
  // 2) systemd socket activation
  // 3) rootless honors XDG_RUNTIME_DIR
  // 4) if varlink -- adapter.DefaultVarlinkAddress
  // 5) lastly adapter.DefaultAPIAddress

Fixes #5150
Fixes #5151

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2020-02-17 10:29:32 -07:00
93358ef915 Refactor image tree for API usage
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-02-17 11:12:35 +01:00
92dbcb8841 Merge pull request #5217 from mheon/rework_label_parsing
Rework label parsing
2020-02-15 12:50:48 +01:00
36a0ed9702 Rework label parsing
We attempted to share all logic for parsing labels and
environment variables, which on the surface makes lots of sense
(both are formatted key=value so parsing logic should be
identical) but has begun to fall apart now that we have added
additional logic to environment variable handling. Environment
variables that are unset, for example, are looked up against
environment variables set for the process. We don't want this for
labels, so we have to split parsing logic.

Fixes #3854

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-02-14 16:06:20 -05:00
9e9b157aa9 Merge pull request #5214 from baude/apiv2loglibpod
apiv2 libpod container logs
2020-02-14 21:21:35 +01:00
ca303586b3 Merge pull request #5216 from baude/bindingstestcache
add caching for binding tests
2020-02-14 20:49:54 +01:00
08bb9317cb add caching for binding tests
add the ability to cache images instead of pull them.  makes tests faster and less network use when we flip on CI.

Also added list images with filter test

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-14 12:11:23 -06:00
b1034eabe3 apiv2 libpod container logs
wire up containers logs for libpod side of the house, same as compat.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-14 10:18:17 -06:00
85b7374491 add pkg/signal
Add pkg/signal to deal with parts of signal processing and translating
signals from string to numeric representations.  The code has been
copied from docker/docker (and attributed with the copyright) but been
reduced to only what libpod needs (on Linux).

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-14 15:04:14 +01:00
0c060dace1 Merge pull request #5190 from baude/apiv2cockpit3
filtering behavior correction
2020-02-14 00:32:33 +01:00
cd9e6b4143 Merge pull request #5172 from giuseppe/api-fix-cpu-stats
api: fix the CPU stats reported
2020-02-13 15:42:53 +01:00
ce7c9c998c filtering behavior correction
when filtering containers, if a status= is provided as an input filter, then we should override the all to always be true.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-12 16:08:07 -06:00
2281cbdd6d Merge pull request #5171 from baude/apiv2cockpit2
Fix container filters
2020-02-12 22:43:59 +01:00
9fbacd8305 api: pull: fix reference parsing
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-12 15:25:25 +01:00