summaryrefslogtreecommitdiff
path: root/pkg/bindings/pods
Commit message (Collapse)AuthorAge
* bindings: reuse context for API requestsMoritz "WanzenBug" Wanzenböck2021-11-15
| | | | | | | | | | | | | | | | | | One of the main uses of context.Context is to provide cancellation for go-routines, including API requests. While all user-facing bindings already used a context parameter, it was only used to pass the client information around. This commit changes the internal DoRequest wrapper to take an additional context argument, and pass that to the http request. Previously, the context was derived from context.Background(), which made it impossible to cancel once started. All the convenience wrappers already supported the context parameter, so the only user facing change is that cancelling those context now works as one would expect. Signed-off-by: Moritz "WanzenBug" Wanzenböck <moritz@wanzenbug.xyz>
* Handle HTTP 409 error messages properly for Pod actionsOndra Machacek2021-11-02
| | | | | | | This PR fixes the case when the API return HTTP 409 response. Where the API return the body format different then for other HTTP error codes. Signed-off-by: Ondra Machacek <omachace@redhat.com>
* Add --time out for podman * rm -f commandsDaniel J Walsh2021-10-04
| | | | | | | | | Add --time flag to podman container rm Add --time flag to podman pod rm Add --time flag to podman volume rm Add --time flag to podman network rm Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* Enhance bindings for IDE hintsJhon Honce2021-09-14
| | | | | | | | | | | * Follow https://pkg.go.dev/cmd/go#hdr-Generate_Go_files_by_processing_source for leading comment * Add godoc strings for all exposed methods for IDE support * Copy field godoc strings into generated code as function godoc string * Remove unused/unnecessary fields from generator.go structures * Cleanup code regarding template usage Signed-off-by: Jhon Honce <jhonce@redhat.com>
* InfraContainer Reworkcdoern2021-08-26
| | | | | | | | | | InfraContainer should go through the same creation process as regular containers. This change was from the cmd level down, involving new container CLI opts and specgen creating functions. What now happens is that both container and pod cli options are populated in cmd and used to create a podSpecgen and a containerSpecgen. The process then goes as follows FillOutSpecGen (infra) -> MapSpec (podOpts -> infraOpts) -> PodCreate -> MakePod -> createPodOptions -> NewPod -> CompleteSpec (infra) -> MakeContainer -> NewContainer -> newContainer -> AddInfra (to pod state) Signed-off-by: cdoern <cdoern@redhat.com>
* Fix file descriptor leaks and add testJhon Honce2021-08-24
| | | | | | | | | | * Add response.Body.Close() where needed to release HTTP connections to API server. * Add tests to ensure no general leaks occur. 100% coverage would be required to ensure no leaks on any call. * Update code comments to be godoc correct Signed-off-by: Jhon Honce <jhonce@redhat.com>
* [NO TESTS NEEDED] Make binding util internalMatej Vasek2021-02-22
| | | | | | The functions are supposed to be called only from generated code Signed-off-by: Matej Vasek <mvasek@redhat.com>
* bump go module to v3Valentin Rothberg2021-02-22
| | | | | | | | | We missed bumping the go module, so let's do it now :) * Automated go code with github.com/sirkon/go-imports-rename * Manually via `vgrep podman/v2` the rest Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* [NO TESTS NEEDED] Refactor generated codeMatej Vasek2021-02-14
| | | | | | Extracted common functionality to util function. Signed-off-by: Matej Vasek <mvasek@redhat.com>
* Enable whitespace linterPaul Holzinger2021-02-11
| | | | | | | | Use the whitespace linter and fix the reported problems. [NO TESTS NEEDED] Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
* [NO TESTS NEEDED] fixup: remove debug codeMatej Vasek2021-02-02
| | | | Signed-off-by: Matej Vasek <mvasek@redhat.com>
* [NO TESTS NEEDED] Generated filesMatej Vasek2021-02-02
| | | | Signed-off-by: Matej Vasek <mvasek@redhat.com>
* Add binding options for container|pod existsbaude2021-01-18
| | | | | | | | It turns out an options was added to container exists so it makes sense to have pods and container exists calls have an optional structure for options. Signed-off-by: baude <bbaude@redhat.com>
* Makefile: add target to generate bindingsValentin Rothberg2021-01-14
| | | | | | | | | | | Add a `.generate-bindings` make target that only runs in the absence of the `.generate-bindings` file or when a `types.go` file below `pkg/bindings` has changed. This will regenerate the go bindings and make sure the code is up2date. Signed-off-by: Valentin Rothberg <rothberg@redhat.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* podman v3 container bindingsbaude2020-12-21
| | | | | | | convert the golang container bindings to all use options so that changes in the future are more managable. Signed-off-by: baude <bbaude@redhat.com>
* podman v3 pod bindingsbaude2020-12-17
| | | | | | add options to each pod binding for future wiggle room Signed-off-by: baude <bbaude@redhat.com>
* Switch all references to github.com/containers/libpod -> podmanDaniel J Walsh2020-07-28
| | | | Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
* move go module to v2Valentin Rothberg2020-07-06
| | | | | | | | | | | | | | | With the advent of Podman 2.0.0 we crossed the magical barrier of go modules. While we were able to continue importing all packages inside of the project, the project could not be vendored anymore from the outside. Move the go module to new major version and change all imports to `github.com/containers/libpod/v2`. The renaming of the imports was done via `gomove` [1]. [1] https://github.com/KSubedi/gomove Signed-off-by: Valentin Rothberg <rothberg@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>
* implement pod statsValentin Rothberg2020-04-27
| | | | | | | Implement pod stats for the local and remote client. Both code paths end up in infra/abi to allow for code share. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* Add pod prune for api v2.Sujil022020-04-17
| | | | | | | | Add the ability to prune pods for api v2, Includes the addition of force flag, for client side prompt. Update test suite to support this use case. Signed-off-by: Sujil02 <sushah@redhat.com>
* podmanv2 pod inspectSujil022020-04-01
| | | | | | Add the ability to inspect pod in podmanv2 Signed-off-by: Sujil02 <sushah@redhat.com>
* podmanv2: implement pod topValentin Rothberg2020-03-28
| | | | | | Implement `podman pod top` for podmanV2. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
* podmanv2 pod create using podspecgenBrent Baude2020-03-27
| | | | | | | | using the factory approach similar to container, we now create pods based on a pod spec generator. wired up the podmanv2 pod create command, podcreatewithspec binding, simple binding test, and apiv2 endpoint. also included some code refactoring as it introduced as easy circular import. Signed-off-by: Brent Baude <bbaude@redhat.com>
* podmanv2 pod subcommandsBrent Baude2020-03-26
| | | | | | add pod kill, pause, restart, rm, start, stop, and unpause Signed-off-by: Brent Baude <bbaude@redhat.com>
* add more image tests for go bindingsBrent Baude2020-02-21
| | | | | | 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>
* Add support for ssh:// and unix:// podman clientsJhon Honce2020-02-20
| | | | | | | | | | * Make context keys package safe * Add support for PODMAN_HOST and PODMAN_SSHKEY * Add slight increasing delay when client connections fail * Remove usages of path.Join(), added JoinURL(). '/' is not OS dependent. Signed-off-by: Jhon Honce <jhonce@redhat.com>
* Add test to validate the pod bindings apiSujil022020-02-19
| | | | | | | | 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>
* Fix container filtersBrent Baude2020-02-11
| | | | | | container filters were being double encoded (maybe triple) which resulted in the wrong encoding representation of filters being sent by the go-bindings. Also, on the server side, Filter needed to be changed to Filter to decode properly. Finally, due to the changed return type of List Containers, the go bindings return values needed to be changed. Signed-off-by: Brent Baude <bbaude@redhat.com>
* [CI:DOCS]Binding overhaulsBrent Baude2020-01-28
Add binding for networks and begin documentation for binding methods for godoc. Also, add major functions to their own subpackages so reduce the amount of of method confusion. So instead of: bindings.ListImages(), we now do a [bindings].images.List(). Also, the connection is passed to each binding method via a context to allow for future growth. Lastly, add first set of tests. There are a couple of things to work out for rootless tests yet. Signed-off-by: Brent Baude <bbaude@redhat.com>