summaryrefslogtreecommitdiff
path: root/pkg/plugins
Commit message (Collapse)AuthorAgeFilesLines
* Fix panic in loading pluginsBrian Goff2016-03-252-11/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a plugin is first found, it is loaded into the available plugins even though it's not activated yet. If activation fails it is taken out of the list. While it is in the list, other callers may see it and try to check it's manifest. If it is not fully activated yet, the manifest will be nil and cause a panic. This is especially problematic for drivers that are down and have not been activated yet. We could just not load the plugin into the available list until it's fully active, however that will just cause multiple of the same plugin to attemp to be loaded. We could check if the manifest is nil and return early (instead of panicing on a nil manifest), but this will cause a 2nd caller to receive a response while the first caller is still waiting, which can be awkward. This change uses a condition variable to handle activation (instead of sync.Once). If the plugin is not activated, callers will all wait until it is activated and receive a broadcast from the condition variable signaling that it's ok to proceed, in which case we'll check if their was an error in activation and proceed accordingly. Signed-off-by: Brian Goff <cpuguy83@gmail.com> (cherry picked from commit baac2f48674d42863f9fdca5ef3056b4c6ed707e)
* *: fix response body leaksAntonio Murdaca2016-03-161-0/+1
| | | | Signed-off-by: Antonio Murdaca <runcom@redhat.com>
* Call plugins with custom transports.David Calavera2016-03-024-21/+120
| | | | | | | Small refactor to be able to use custom transports to call remote plugins. Signed-off-by: David Calavera <david.calavera@gmail.com>
* Merge pull request #20686 from clintonskitson/bugfix/plugin_desc_leakDavid Calavera2016-02-291-4/+14
|\ | | | | Fix plugin file descriptor leaks
| * Fixes plugin file descriptor leak on plugin discoveryClinton Kitson2016-02-261-4/+14
| | | | | | | | Signed-off-by: Clinton Kitson <clintonskitson@gmail.com>
* | Close resp body on plugin call errorBrian Goff2016-02-241-0/+1
|/ | | | Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Fix some typos in comments and stringsStefan Weil2016-02-221-1/+1
| | | | | | Most of them were found and fixed by codespell. Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Add support for forwarding Docker client through SOCKS proxyAlexander Morozov2016-02-161-1/+3
| | | | Signed-off-by: Alexander Morozov <lk4d4@docker.com>
* fix common misspellVictor Vieux2016-02-111-1/+1
| | | | Signed-off-by: Victor Vieux <vieux@docker.com>
* Windows CI: test-unit on pkg\pluginsJohn Howard2016-02-102-54/+65
| | | | Signed-off-by: John Howard <jhoward@microsoft.com>
* Apply context changes to the client.David Calavera2016-02-041-1/+1
| | | | Signed-off-by: David Calavera <david.calavera@gmail.com>
* Add back compat for volume drivers `Get` and `Ls`Brian Goff2016-01-222-4/+36
| | | | | | | | | | | | Use a back-compat struct to handle listing volumes for volumes we know about (because, presumably, they are being used by a container) for volume drivers which don't yet support `List`. Adds a fall-back for the volume driver `Get` call, which will use `Create` when the driver returns a `404` for `Get`. The old behavior was to always use `Create` to get a volume reference. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Bump plugin API versionBrian Goff2016-01-211-1/+1
| | | | Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Don't error out on plugin err with jsonBrian Goff2016-01-061-5/+4
| | | | | | | We don't want to error out when there is a json unmarshal error since the `old way` will cause this to error. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Move responsibility of ls/inspect to volume driverBrian Goff2016-01-052-5/+78
| | | | | | | | | | | | | | | | | | | | | Makes `docker volume ls` and `docker volume inspect` ask the volume drivers rather than only using what is cached locally. Previously in order to use a volume from an external driver, one would either have to use `docker volume create` or have a container that is already using that volume for it to be visible to the other volume API's. For keeping uniqueness of volume names in the daemon, names are bound to a driver on a first come first serve basis. If two drivers have a volume with the same name, the first one is chosen, and a warning is logged about the second one. Adds 2 new methods to the plugin API, `List` and `Get`. If a plugin does not implement these endpoints, a user will not be able to find the specified volumes as well requests go through the drivers. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Remove usage of pkg sockets and tlsconfig.David Calavera2015-12-293-4/+4
| | | | | | | | | - Use the ones provided by docker/go-connections, they are a drop in replacement. - Remove pkg/sockets from docker. - Keep pkg/tlsconfig because libnetwork still needs it and there is a circular dependency issue. Signed-off-by: David Calavera <david.calavera@gmail.com>
* pkg: authorization: do not register the same pluginAntonio Murdaca2015-12-232-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patches avoids registering (and calling) the same plugin more than once. Using an helper map which indexes by name guarantees this and keeps the order. The behavior of overriding the same name in a flag is consistent with, for instance, the `docker run -v /test -v /test` flag which register the volume just once. Adds integration tests. Without this patch: ``` Dec 20 19:34:52 localhost.localdomain docker[9988]: time="2015-12-20T19:34:52.080901676+01:00" level=debug msg="Calling GET /v1.22/info" Dec 20 19:34:52 localhost.localdomain docker[9988]: time="2015-12-20T19:34:52.081213202+01:00" level=debug msg="AuthZ request using plugin docker-novolume-plugin" Dec 20 19:34:52 localhost.localdomain docker[9988]: time="2015-12-20T19:34:52.081268132+01:00" level=debug msg="docker-novolume-plugin implements: authz" Dec 20 19:34:52 localhost.localdomain docker[9988]: time="2015-12-20T19:34:52.081699788+01:00" level=debug msg="AuthZ request using plugin docker-novolume-plugin" Dec 20 19:34:52 localhost.localdomain docker[9988]: time="2015-12-20T19:34:52.081762507+01:00" level=debug msg="docker-novolume-plugin implements: authz" Dec 20 19:34:52 localhost.localdomain docker[9988]: time="2015-12-20T19:34:52.082092480+01:00" level=debug msg="GET /v1.22/info" Dec 20 19:34:52 localhost.localdomain docker[9988]: time="2015-12-20T19:34:52.628691038+01:00" level=debug msg="AuthZ response using plugin docker-novolume-plugin" Dec 20 19:34:52 localhost.localdomain docker[9988]: time="2015-12-20T19:34:52.629880930+01:00" level=debug msg="AuthZ response using plugin docker-novolume-plugin" ``` With this patch: ``` Dec 20 19:37:32 localhost.localdomain docker[16620]: time="2015-12-20T19:37:32.376523958+01:00" level=debug msg="Calling GET /v1.22/info" Dec 20 19:37:32 localhost.localdomain docker[16620]: time="2015-12-20T19:37:32.376715483+01:00" level=debug msg="AuthZ request using plugin docker-novolume-plugin" Dec 20 19:37:32 localhost.localdomain docker[16620]: time="2015-12-20T19:37:32.376771230+01:00" level=debug msg="docker-novolume-plugin implements: authz" Dec 20 19:37:32 localhost.localdomain docker[16620]: time="2015-12-20T19:37:32.377698897+01:00" level=debug msg="GET /v1.22/info" Dec 20 19:37:32 localhost.localdomain docker[16620]: time="2015-12-20T19:37:32.951016441+01:00" level=debug msg="AuthZ response using plugin docker-novolume-plugin" ``` Also removes a somehow duplicate debug statement (leaving only the second one as it's a loop of plugin's manifest): ``` Dec 20 19:52:30 localhost.localdomain docker[25767]: time="2015-12-20T19:52:30.544090518+01:00" level=debug msg="docker-novolume-plugin's manifest: &{[authz]}" Dec 20 19:52:30 localhost.localdomain docker[25767]: time="2015-12-20T19:52:30.544170677+01:00" level=debug msg="docker-novolume-plugin implements: authz" ``` Signed-off-by: Antonio Murdaca <runcom@redhat.com>
* authZ: more fixesAntonio Murdaca2015-12-181-13/+4
| | | | | | | | | | - fix naming and formatting - provide more context when erroring auth - do not capitalize errors - fix wrong documentation - remove ugly remoteError{} Signed-off-by: Antonio Murdaca <runcom@redhat.com>
* pkg: plugins: remove dead codeAntonio Murdaca2015-12-171-13/+5
| | | | Signed-off-by: Antonio Murdaca <runcom@redhat.com>
* pkg: plugins: fix and better handle errorsAntonio Murdaca2015-12-151-3/+18
| | | | Signed-off-by: Antonio Murdaca <runcom@redhat.com>
* pkg/plugins/client.go: don't try to encode os decode if it's nilLei Jitang2015-12-052-5/+13
| | | | | | | | | When user call the `Call()` method, they don't always want to sent some args or get the return value, so they use `nil` when call `Call()` method and this will casue an error. It's better to not trying to encode or decode if it's nil. Signed-off-by: Lei Jitang <leijitang@huawei.com>
* Add user namespace (mapping) support to the Docker enginePhil Estes2015-10-091-2/+10
| | | | | | | | | | | | Adds support for the daemon to handle user namespace maps as a per-daemon setting. Support for handling uid/gid mapping is added to the builder, archive/unarchive packages and functions, all graphdrivers (except Windows), and the test suite is updated to handle user namespace daemon rootgraph changes. Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
* Merge pull request #13777 from cpuguy83/graphdriver_extpointsJess Frazelle2015-10-082-12/+33
|\ | | | | Create extpoint for graphdrivers
| * Create extpoint for graphdriversBrian Goff2015-09-092-12/+33
| | | | | | | | | | | | | | | | | | | | Allows people to create out-of-process graphdrivers that can be used with Docker. Extensions must be started before Docker otherwise Docker will fail to start. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* | Merge pull request #16494 from calavera/fix_plugin_url_schemeAlexandre Beslic2015-09-232-4/+26
|\ \ | | | | | | Do not hardcode http as plugin URL scheme for secure connections.
| * | Do not hardcode http as plugin URL scheme for secure connections.David Calavera2015-09-222-4/+26
| |/ | | | | | | Signed-off-by: David Calavera <david.calavera@gmail.com>
* | Add README for pluginrpc-genBrian Goff2015-09-221-0/+68
|/ | | | Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Lint package pkg/plugins/pluginrpc-genVincent Demeester2015-09-054-18/+26
| | | | Signed-off-by: Vincent Demeester <vincent@sbr.pm>
* Retry registering a volume driverStephen Rust2015-09-011-15/+34
| | | | Signed-off-by: Stephen Rust <srust@blockbridge.com>
* Add volume API/CLIBrian Goff2015-08-262-5/+13
| | | | Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Don't globally lock on driver initializationDarren Shepherd2015-08-181-13/+28
| | | | | | | This patch makes it such that plugin initialization is synchronized based on the plugin name and not globally Signed-off-by: Darren Shepherd <darren@rancher.com>
* Lint on pkg/* packagesVincent Demeester2015-07-273-6/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - pkg/useragent - pkg/units - pkg/ulimit - pkg/truncindex - pkg/timeoutconn - pkg/term - pkg/tarsum - pkg/tailfile - pkg/systemd - pkg/stringutils - pkg/stringid - pkg/streamformatter - pkg/sockets - pkg/signal - pkg/proxy - pkg/progressreader - pkg/pools - pkg/plugins - pkg/pidfile - pkg/parsers - pkg/parsers/filters - pkg/parsers/kernel - pkg/parsers/operatingsystem Signed-off-by: Vincent Demeester <vincent@sbr.pm>
* Merge pull request #13951 from calavera/plugins_pathSebastiaan van Stijn2015-07-173-82/+94
|\ | | | | Separate plugin sockets and specs.
| * Separate plugin sockets and specs.David Calavera2015-07-163-82/+94
| | | | | | | | | | | | | | | | Check if there is a plugin socket first under `/run/docker/plugins/NAME.sock`. If there is no socket for a plugin, check `/etc/docker/plugins/NAME.spec` and `/usr/lib/docker/plugins/NAME.spec` for spec files. Signed-off-by: David Calavera <david.calavera@gmail.com>
* | time duration should be nano seconds, gccgo treats it as zeroroot2015-07-131-1/+1
| | | | | | | | Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
* | Merge pull request #13835 from cpuguy83/gen-prcMichael Crosby2015-07-075-0/+553
|\ \ | |/ |/| generate plugin clients via template
| * generate plugin clients via templateBrian Goff2015-06-105-0/+553
| | | | | | | | Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* | Plugins JSON spec.David Calavera2015-06-295-43/+128
|/ | | | | | Allow full configuration of external plugins via a JSON document. Signed-off-by: David Calavera <david.calavera@gmail.com>
* Don't forget to clenaup tmpdir in TestFileSpecPlugin()Zefan Li2015-06-041-5/+1
| | | | | | Also remove redundant code. Signed-off-by: Zefan Li <lizefan@huawei.com>
* Merge pull request #13577 from WeiZhang555/httpClosePhil Estes2015-05-291-0/+1
|\ | | | | bug fix: close http response body no longer in use
| * bug fix: close http response body no longer in useZhang Wei2015-05-291-0/+1
| | | | | | | | Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
* | return error when failed to read http response bodyZhang Wei2015-05-291-1/+1
|/ | | | Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
* Volumes refactor and external plugin implementation.David Calavera2015-05-212-5/+59
| | | | | | | | | | | | Signed by all authors: Signed-off-by: Michael Crosby <crosbymichael@gmail.com> Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com> Signed-off-by: David Calavera <david.calavera@gmail.com> Signed-off-by: Jeff Lindsay <progrium@gmail.com> Signed-off-by: Alexander Morozov <lk4d4@docker.com> Signed-off-by: Luke Marsden <luke@clusterhq.com> Signed-off-by: David Calavera <david.calavera@gmail.com>
* Fixing a Typo in plugins mime-typeMadhu Venugopal2015-05-161-1/+1
| | | | Signed-off-by: Madhu Venugopal <madhu@docker.com>
* Allow to call back when a plugin is loaded.Madhu Venugopal2015-05-152-2/+16
| | | | Signed-off-by: Madhu Venugopal <madhu@docker.com>
* Remote plugins plumbing.David Calavera2015-05-155-0/+435
Signed-off-by: David Calavera <david.calavera@gmail.com>