summaryrefslogtreecommitdiff
path: root/pkg/api
Commit message (Collapse)AuthorAge
* Set syslog for exit commands on log-level=debugMatthew Heon2020-06-24
| | | | | | | | | | | | | | | | We have a flag, --syslog, for telling logrus to log to syslog as well as to the terminal. Previously, this flag also set the exit command for containers to use `--syslog` (otherwise all output from exit commands is lost). I attempted to replicate this with Podman v2.0, but quickly ran into circular import hell (the flag is defined in cmd/podman, I needed it in cmd/podman/containers, cmd/podman imports cmd/podman/containers already, etc). Instead, let's just set the syslog flag automatically on `--log-level=debug` so we log exit commands automatically when debug-level logs are requested. This is consistent with Conmon and seems to make sense. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
* Merge pull request #6741 from maybe-sybr/maybe/apiv2/fix-volume-create-codeOpenShift Merge Robot2020-06-24
|\ | | | | APIv2: Return `StatusCreated` from volume creation
| * APIv2: Return `StatusCreated` from volume creationmaybe-sybr2020-06-24
| | | | | | | | | | | | | | | | The swagdoc in `register_volumes.go` already correctly notes that a 201 should be returned upon success, so we only need to change the handler to match the spec. Signed-off-by: Matt Brindley <58414429+maybe-sybr@users.noreply.github.com>
* | Merge pull request #6738 from maybe-sybr/maybe/apiv2/fix-network-compat-urlsOpenShift Merge Robot2020-06-24
|\ \ | | | | | | APIv2:fix: Remove `/json` from compat network EPs
| * | APIv2:fix: Remove `/json` from compat network EPsmaybe-sybr2020-06-24
| |/ | | | | | | Signed-off-by: Matt Brindley <58414429+maybe-sybr@users.noreply.github.com>
* / APIv2:doc: Fix swagger doc to refer to volumesmaybe-sybr2020-06-24
|/ | | | Signed-off-by: Matt Brindley <58414429+maybe-sybr@users.noreply.github.com>
* libpod/containers/json: alias last -> limitValentin Rothberg2020-06-22
| | | | | | | | | | | Support both `last` and `limit` for in the containers listing endpoint. We intended to use `limit` which is also mentioned in the docs, but the implementation ended up using `last` as the http parameter; likely being caused by the CLI using `--last`. To avoid any regression, we decided for supporting both and aliasing `last`. Fixes: #6413 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* Allow recursive dependency start with Init()Matthew Heon2020-06-18
| | | | | | | | | | | | | | | | | | | | As part of APIv2 Attach, we need to be able to attach to freshly created containers (in ContainerStateConfigured). This isn't something Libpod is interested in supporting, so we use Init() to get the container into ContainerStateCreated, in which attach is possible. Problem: Init() will fail if dependencies are not started, so a fresh container in a fresh pod will fail. The simplest solution is to extend the existing recursive start code from Start() to Init(), allowing dependency containers to be started when we initialize the container (optionally, controlled via bool). Also, update some comments in container_api.go to make it more clear how some of our major API calls work. Fixes #6646 Signed-off-by: Matthew Heon <mheon@redhat.com>
* Merge pull request #6620 from jgallucci32/api-logs-separateOpenShift Merge Robot2020-06-17
|\ | | | | Move logs functionality to separate file for APIv2
| * Move logs functionality to separate file for APIv2jgallucci322020-06-17
| | | | | | | | | | | | | | | | This simply moves the function for the log handler for APIv2 to a separate file to be consistent with other parts of the code base. Signed-off-by: jgallucci32 <john.gallucci.iv@gmail.com>
* | Merge pull request #6634 from baude/v2buildfixesOpenShift Merge Robot2020-06-17
|\ \ | |/ |/| fix misc remote build issues
| * fix misc remote build issuesBrent Baude2020-06-17
| | | | | | | | | | | | | | | | | | 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>
* | Merge pull request #6636 from mheon/add_warningsOpenShift Merge Robot2020-06-17
|\ \ | |/ |/| Re-add resource limit warnings to Specgen
| * Re-add resource limit warnings to SpecgenMatthew Heon2020-06-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These were part of Podman v1.9, but were lost in the transition to using Specgen to create containers. Most resource limits are checked via the sysinfo package to ensure they are safe to use (the cgroup is mounted, kernel support is present, etc) and removed if not safe. Further, bounds checks are performed to ensure that values are valid. Ensure these warnings are printed client-side when they occur. This part is a little bit gross, as it happens in pkg/infra and not cmd/podman, which is largely down to how we implemented `podman run` - all the work is done in pkg/infra and it returns only once the container has exited, and we need warnings to print *before* the container runs. The solution here, while inelegant, avoid the need to extensively refactor our handling of run. Should fix blkio-limit warnings that were identified by the FCOS test suite. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
* | Merge pull request #6638 from jwhonce/issues/6548OpenShift Merge Robot2020-06-17
|\ \ | |/ |/| [CI:DOCS] Fixes #6548
| * [CI:DOCS] Fixes #6548Jhon Honce2020-06-16
| | | | | | | | | | | | * Update swagger documentation Signed-off-by: Jhon Honce <jhonce@redhat.com>
* | handlers/compat: fix lint errorValentin Rothberg2020-06-16
| | | | | | | | | | | | | | Fix a lint error of an used parameter. The error must have sneaked in with a PR that was merged after the recent linter enablement. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* | Merge pull request #6590 from zhangguanzhang/masterOpenShift Merge Robot2020-06-15
|\ \ | | | | | | Add the missing return in the API handlers' image_build method
| * | Add the missing returnzhangguanzhang2020-06-12
| | | | | | | | | | | | Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
* | | Merge pull request #6597 from rhatdan/imageOpenShift Merge Robot2020-06-15
|\ \ \ | | | | | | | | Add some additional fields to imageinspect
| * | | Add some additional fields to imageinspectDaniel J Walsh2020-06-13
| |/ / | | | | | | | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | | Merge pull request #6557 from rhatdan/lintOpenShift Merge Robot2020-06-15
|\ \ \ | | | | | | | | Turn on More linters
| * | | Turn on More lintersDaniel J Walsh2020-06-15
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | - misspell - prealloc - unparam - nakedret Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* / / Reassemble filters on the server sideDaniel J Walsh2020-06-12
|/ / | | | | | | | | | | | | | | | | --filter label=foo=bar, was been translated on the server side to --filter label=foo --filter=bar This PR fixes this back to what the user specified. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* | [CI:DOCS] Fix carriage returns in API v2 headerTomSweeneyRedHat2020-06-11
| | | | | | | | | | | | | | | | 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>
* | Merge pull request #6564 from TomSweeneyRedHat/dev/tsweeney/apidocstartOpenShift Merge Robot2020-06-11
|\ \ | | | | | | [CI:DOCS] Add quick start directions to APIv2 Dock
| * | [CI:DOCS] Add quick start directions to APIv2 DockTomSweeneyRedHat2020-06-11
| |/ | | | | | | | | | | | | | | | | | | 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>
* | Merge pull request #6516 from zhangguanzhang/masterOpenShift Merge Robot2020-06-11
|\ \ | |/ |/| fix api fails with 'strconv.ParseUint: parsing "tcp": invalid syntax'
| * fix api fails with 'strconv.ParseUint: parsing "tcp": invalid syntax'zhangguanzhang2020-06-10
| | | | | | | | Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
* | Merge pull request #6546 from rhatdan/lintOpenShift Merge Robot2020-06-10
|\ \ | | | | | | Turn on golint
| * | Fix Id->ID where possible for lintDaniel J Walsh2020-06-10
| | | | | | | | | | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
| * | Fixup issues found by golintDaniel J Walsh2020-06-10
| |/ | | | | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* / Ensure signal validation happens first in pod killMatthew Heon2020-06-09
|/ | | | | | | | | | | | | This fixes an error in the system tests, which expect that when you try and kill a nonexistent pod with an incorrect signal, you receive an error about the signal, not the pod. At the same time, fix a missing return statement in the bindings, which could also have caused us grief. Fixes #6540 Signed-off-by: Matthew Heon <matthew.heon@pm.me>
* /images/.../json: fix port parsingValentin Rothberg2020-06-04
| | | | | | | | | | Fix a bug when parsing the `ExposedPorts` of the image that lead to panics when the field was set. The OCI image spec allows three valid formats: `tcp/port`, `udp/port` and `port` Fixes: #6490 Reported-by: @jgallucci32 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* Enable detached exec for remoteMatthew Heon2020-06-02
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Add bindings for exec and enable attached remoteMatthew Heon2020-06-01
| | | | | | | | | | | 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>
* Add support for format {{.Label}}Brent Baude2020-06-01
| | | | | | | | the pod ps man page says .Label is valid go template format. i dont think the function was actually ever implemented. Fixes #6448 Signed-off-by: Brent Baude <bbaude@redhat.com>
* Fix leak of empty tarballBrent Baude2020-06-01
| | | | | | | | In cases of trying to export an image, if the image was not found, we leaked an empty tarball or directory depending on the format. Fixes: #6409 Signed-off-by: Brent Baude <bbaude@redhat.com>
* Merge pull request #6356 from baude/v2copyendpointsOpenShift Merge Robot2020-05-30
|\ | | | | v2 copy endpoints
| * v2 copy endpointsBrent Baude2020-05-26
| | | | | | | | | | | | 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>
* | compat handlers: add X-Registry-Auth header supportValentin Rothberg2020-05-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* | V2 verify JSON output is consistent and doesn't driftJhon Honce2020-05-28
| | | | | | | | | | | | | | $ cd test/apiv2 $ python -m unittest -v test_rest_v1_0_0.TestApi Signed-off-by: Jhon Honce <jhonce@redhat.com>
* | Merge pull request #6407 from baude/v2eventsstreamOpenShift Merge Robot2020-05-27
|\ \ | | | | | | Add streaming ability to endpoint
| * | Add streaming ability to endpointBrent Baude2020-05-27
| |/ | | | | | | Signed-off-by: Brent Baude <bbaude@redhat.com>
* | Merge pull request #6398 from rhatdan/32bitOpenShift Merge Robot2020-05-27
|\ \ | | | | | | Fix builds on 32 Arches.
| * | Fix builds on 32 bit archesDaniel J Walsh2020-05-27
| |/ | | | | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* / v2 libpod push: correct docsValentin Rothberg2020-05-27
|/ | | | | | | | | 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>
* Merge pull request #6238 from baude/v2compatnetOpenShift Merge Robot2020-05-25
|\ | | | | network compatibility endpoints for API
| * network compatibility endpoints for APIBrent Baude2020-05-22
| | | | | | | | | | | | add endpoints for networking compatibility with the API. Signed-off-by: Brent Baude <bbaude@redhat.com>
* | Add MethodNotAllowedHandler() to add in debuggingJhon Honce2020-05-22
|/ | | | Signed-off-by: Jhon Honce <jhonce@redhat.com>