summaryrefslogtreecommitdiff
path: root/api/server/router/plugin
Commit message (Collapse)AuthorAgeFilesLines
* api: add registry.DecodeAuthConfig, registry.DecodeAuthConfigBodySebastiaan van Stijn2022-07-291-13/+2
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* plugin: use types/registry.AuthConfigSebastiaan van Stijn2022-07-291-0/+1
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* api/server/router: use types/registry.AuthConfigSebastiaan van Stijn2022-07-292-14/+15
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* api: add const for 'X-Registry-Auth'Sebastiaan van Stijn2022-07-291-1/+1
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* api/server/httputils: add ReadJSON() utilitySebastiaan van Stijn2022-04-111-19/+6
| | | | | | | | | | | | | | | | | | | | | Implement a ReadJSON() utility to help reduce some code-duplication, and to make sure we handle JSON requests consistently (e.g. always check for the content-type). Differences compared to current handling: - prevent possible panic if request.Body is nil ("should never happen") - always require Content-Type to be "application/json" - be stricter about additional content after JSON (previously ignored) - but, allow the body to be empty (an empty body is not invalid); update TestContainerInvalidJSON accordingly, which was testing the wrong expectation. - close body after reading (some code did this) We should consider to add a "max body size" on this function, similar to https://github.com/moby/moby/blob/7b9275c0da707b030e62c96b679a976f31f929d3/api/server/middleware/debug.go#L27-L40 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* api: normalize comment formattingSebastiaan van Stijn2019-11-271-1/+1
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* api/server: explicitly ignore unhandled errors (errcheck)Sebastiaan van Stijn2019-09-181-3/+3
| | | | | | | | | | | | | | | | | | | ``` api/server/router/build/build_routes.go:309:41: Error return value of `(*encoding/json.Decoder).Decode` is not checked (errcheck) api/server/router/build/build_routes.go:431:11: Error return value of `io.Copy` is not checked (errcheck) api/server/router/container/container_routes.go:582:13: Error return value of `conn.Write` is not checked (errcheck) api/server/router/grpc/grpc_routes.go:38:12: Error return value of `conn.Write` is not checked (errcheck) api/server/router/grpc/grpc_routes.go:39:12: Error return value of `resp.Write` is not checked (errcheck) api/server/router/image/image_routes.go:94:15: Error return value of `output.Write` is not checked (errcheck) api/server/router/image/image_routes.go:139:15: Error return value of `output.Write` is not checked (errcheck) api/server/router/image/image_routes.go:164:15: Error return value of `output.Write` is not checked (errcheck) api/server/router/image/image_routes.go:180:15: Error return value of `output.Write` is not checked (errcheck) api/server/router/plugin/plugin_routes.go:126:15: Error return value of `output.Write` is not checked (errcheck) api/server/router/plugin/plugin_routes.go:165:15: Error return value of `output.Write` is not checked (errcheck) api/server/router/plugin/plugin_routes.go:273:15: Error return value of `output.Write` is not checked (errcheck) ``` Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Rely on request.Context() cancellationBrian Goff2018-11-271-4/+4
| | | | | | | | The cancellable handler is no longer needed as the context that is passed with the http request will be cancelled just like the close notifier was doing. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* API: properly handle invalid JSON to return a 400 statusSebastiaan van Stijn2018-11-061-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The API did not treat invalid JSON payloads as a 400 error, as a result returning a 500 error; Before this change, an invalid JSON body would return a 500 error; ```bash curl -v \ --unix-socket /var/run/docker.sock \ -X POST \ "http://localhost/v1.30/networks/create" \ -H "Content-Type: application/json" \ -d '{invalid json' ``` ``` > POST /v1.30/networks/create HTTP/1.1 > Host: localhost > User-Agent: curl/7.52.1 > Accept: */* > Content-Type: application/json > Content-Length: 13 > * upload completely sent off: 13 out of 13 bytes < HTTP/1.1 500 Internal Server Error < Api-Version: 1.40 < Content-Type: application/json < Docker-Experimental: false < Ostype: linux < Server: Docker/dev (linux) < Date: Mon, 05 Nov 2018 11:55:20 GMT < Content-Length: 79 < {"message":"invalid character 'i' looking for beginning of object key string"} ``` Empty request: ```bash curl -v \ --unix-socket /var/run/docker.sock \ -X POST \ "http://localhost/v1.30/networks/create" \ -H "Content-Type: application/json" ``` ``` > POST /v1.30/networks/create HTTP/1.1 > Host: localhost > User-Agent: curl/7.54.0 > Accept: */* > Content-Type: application/json > < HTTP/1.1 500 Internal Server Error < Api-Version: 1.38 < Content-Length: 18 < Content-Type: application/json < Date: Mon, 05 Nov 2018 12:00:18 GMT < Docker-Experimental: true < Ostype: linux < Server: Docker/18.06.1-ce (linux) < {"message":"EOF"} ``` After this change, a 400 is returned; ```bash curl -v \ --unix-socket /var/run/docker.sock \ -X POST \ "http://localhost/v1.30/networks/create" \ -H "Content-Type: application/json" \ -d '{invalid json' ``` ``` > POST /v1.30/networks/create HTTP/1.1 > Host: localhost > User-Agent: curl/7.52.1 > Accept: */* > Content-Type: application/json > Content-Length: 13 > * upload completely sent off: 13 out of 13 bytes < HTTP/1.1 400 Bad Request < Api-Version: 1.40 < Content-Type: application/json < Docker-Experimental: false < Ostype: linux < Server: Docker/dev (linux) < Date: Mon, 05 Nov 2018 11:57:15 GMT < Content-Length: 79 < {"message":"invalid character 'i' looking for beginning of object key string"} ``` Empty request: ```bash curl -v \ --unix-socket /var/run/docker.sock \ -X POST \ "http://localhost/v1.30/networks/create" \ -H "Content-Type: application/json" ``` ``` > POST /v1.30/networks/create HTTP/1.1 > Host: localhost > User-Agent: curl/7.52.1 > Accept: */* > Content-Type: application/json > < HTTP/1.1 400 Bad Request < Api-Version: 1.40 < Content-Type: application/json < Docker-Experimental: false < Ostype: linux < Server: Docker/dev (linux) < Date: Mon, 05 Nov 2018 11:59:22 GMT < Content-Length: 49 < {"message":"got EOF while reading request body"} ``` Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Switch from x/net/context -> contextKir Kolyshkin2018-04-232-2/+2
| | | | | | | | | | | Since Go 1.7, context is a standard package. Since Go 1.9, everything that is provided by "x/net/context" is a couple of type aliases to types in "context". Many vendored packages still use x/net/context, so vendor entry remains for now. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
* Add canonical import commentDaniel Nephin2018-02-053-3/+3
| | | | Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Replace uses of filters.ToParam(), FromParam() with filters.ToJSON(), FromJSON()Sebastiaan van Stijn2017-09-261-1/+1
| | | | | | | | | | | `filters.ToParam()` and `filters.FromParam()` were deprecated in favor of `filters.ToJSON()` and `filters.FromJSON()` in 065118390a3ecaf0dbd2fa752d54d43f8f1e8ec6, but still used in various locations. This patch replaces uses of `filters.ToParam()` and `filters.FromParam()` with `filters.ToJSON()` and `filters.FromJSON()`. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Make plugin emit strongly typed, consumable eventsBrian Goff2017-07-061-1/+2
| | | | | | | | | Enables other subsystems to watch actions for a plugin(s). This will be used specifically for implementing plugins on swarm where a swarm controller needs to watch the state of a plugin. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Refacator pkg/streamformatterDaniel Nephin2017-05-021-3/+3
| | | | | | | StreamFormatter suffered was two distinct structs mixed into a single struct without any overlap. Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Use function arguments for route setup.Brian Goff2017-04-121-3/+3
| | | | Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Use distribution referenceDerek McGowan2017-02-072-31/+18
| | | | | | | | | | | | Remove forked reference package. Use normalized named values everywhere and familiar functions to convert back to familiar strings for UX and storage compatibility. Enforce that the source repository in the distribution metadata is always a normalized string, ignore invalid values which are not. Update distribution tests to use normalized values. Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
* Add docker plugin upgradeBrian Goff2017-02-033-18/+65
| | | | | | | | | | | | | | | | This allows a plugin to be upgraded without requiring to uninstall/reinstall a plugin. Since plugin resources (e.g. volumes) are tied to a plugin ID, this is important to ensure resources aren't lost. The plugin must be disabled while upgrading (errors out if enabled). This does not add any convenience flags for automatically disabling/re-enabling the plugin during before/after upgrade. Since an upgrade may change requested permissions, the user is required to accept permissions just like `docker plugin install`. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Add `--filter enabled=true` for `docker plugin ls`Yong Tang2017-01-262-2/+12
| | | | | | | | | | | | | This fix adds `--filter enabled=true` to `docker plugin ls`, as was specified in 28624. The related API and docs has been updated. An integration test has been added. This fix fixes 28624. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
* Implement content addressability for pluginsTonis Tiigi2016-12-233-15/+123
| | | | | | | | | | | | | | | | | | | | | | | Move plugins to shared distribution stack with images. Create immutable plugin config that matches schema2 requirements. Ensure data being pushed is same as pulled/created. Store distribution artifacts in a blobstore. Run init layer setup for every plugin start. Fix breakouts from unsafe file accesses. Add support for `docker plugin install --alias` Uses normalized references for default names to avoid collisions when using default hosts/tags. Some refactoring of the plugin manager to support the change, like removing the singleton manager and adding manager config struct. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> Signed-off-by: Derek McGowan <derek@mcgstyle.net>
* Enforce zero plugin refcount during disable.Anusha Ragunathan2016-12-222-2/+11
| | | | | | | | | | | When plugins have a positive refcount, they were not allowed to be removed. However, plugins could still be disabled when volumes referenced it and containers using them were running. This change fixes that by enforcing plugin refcount during disable. A "force" disable option is also added to ignore reference refcounting. Signed-off-by: Anusha Ragunathan <anusha@docker.com>
* refactor plugin installVictor Vieux2016-12-023-24/+39
| | | | Signed-off-by: Victor Vieux <victorvieux@gmail.com>
* Add HTTP client timeout.Anusha Ragunathan2016-11-212-2/+14
| | | | Signed-off-by: Anusha Ragunathan <anusha@docker.com>
* Add plugin create functionality.Anusha Ragunathan2016-11-093-0/+19
| | | | Signed-off-by: Anusha Ragunathan <anusha@docker.com>
* support env for docker plugin setVictor Vieux2016-11-071-1/+5
| | | | Signed-off-by: Victor Vieux <vieux@docker.com>
* Make experimental a runtime flagKenfe-Mickael Laventure2016-10-245-33/+13
| | | | Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
* Move engine-api client packageMichael Crosby2016-09-072-2/+2
| | | | | | This moves the engine-api client package to `/docker/docker/client`. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
* Add --force to docker plugin removeVictor Vieux2016-08-042-2/+10
| | | | Signed-off-by: Victor Vieux <vieux@docker.com>
* plugins: experimental support for new plugin managementTibor Vass2016-06-145-0/+176
This patch introduces a new experimental engine-level plugin management with a new API and command line. Plugins can be distributed via a Docker registry, and their lifecycle is managed by the engine. This makes plugins a first-class construct. For more background, have a look at issue #20363. Documentation is in a separate commit. If you want to understand how the new plugin system works, you can start by reading the documentation. Note: backwards compatibility with existing plugins is maintained, albeit they won't benefit from the advantages of the new system. Signed-off-by: Tibor Vass <tibor@docker.com> Signed-off-by: Anusha Ragunathan <anusha@docker.com>