Commit Graph

55 Commits

Author SHA1 Message Date
ac18bf29a1 Fix pkg/plugins TLSConfig panic
Fix #25046

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Upstream-commit: b1e71bdd1d624e297509a62b072082524dc841fc
Component: engine
2016-07-26 08:53:54 +00:00
0228458e3c Add only legacy plugins to the legacy lookup map.
Legacy plugin model maintained a map of plugins. This is
not used by the new model. Using this map in the new model
causes incorrect lookup of plugins. This change uses adds
a plugin to the map only if its legacy.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 8fd779dc28a11d8727d76e9553379b0c854f7c4c
Component: engine
2016-07-18 15:43:44 -07:00
848e510213 plugins: experimental support for new plugin management
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>
Upstream-commit: f37117045c5398fd3dca8016ea8ca0cb47e7312b
Component: engine
2016-06-14 14:20:27 -07:00
87c4c2885f authz: cleanups
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: d1b7e8373bde77819a25fce94bdfa9725608215e
Component: engine
2016-06-12 17:23:19 +02:00
da4d783e80 Add support for volume scopes
This is similar to network scopes where a volume can either be `local`
or `global`. A `global` volume is one that exists across the entire
cluster where as a `local` volume exists on a single engine.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 2f40b1b281a3be8f34d82a5170988ee46ea1f442
Component: engine
2016-06-05 15:37:15 -04:00
6e1304c58a Enhance pluginrpc-gen parser
Now handles `package.Type` and `*package.Type`
Fixes parsing issues with slice and map types.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 79ff6eaf21dfebad0f8131a1ede235249cd6638f
Component: engine
2016-06-05 15:37:15 -04:00
de046a0cf3 When calling volume driver Mount, send opaque ID
This generates an ID string for calls to Mount/Unmount, allowing drivers
to differentiate between two callers of `Mount` and `Unmount`.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 2b6bc294fc7f9e08a9091833b021b7d2a01ad2a6
Component: engine
2016-04-29 09:37:02 -04:00
ee5a4917fb Initialize activateWait for plugins activated by json spec
Signed-off-by: Madhu Venugopal <madhu@docker.com>
Upstream-commit: de806a672b0810e48facc74e198e6728c1fe2c6d
Component: engine
2016-04-20 05:59:19 -07:00
1946302b86 fix typo in comment
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 76122f95e9173c1182b8dd44e1aa236a045d4e6a
Component: engine
2016-04-08 00:05:31 -07:00
3420db4b5e Fix panic in loading plugins
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>
Upstream-commit: baac2f48674d42863f9fdca5ef3056b4c6ed707e
Component: engine
2016-03-23 15:34:15 -04:00
195d725261 *: fix response body leaks
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: f0d83c4cdb49adb53fdaf4216a4395c23d5cc8e9
Component: engine
2016-03-16 17:15:42 +01:00
4a285f2027 Call plugins with custom transports.
Small refactor to be able to use custom transports
to call remote plugins.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 1a630234508bdb12d55425ceebdb0b6523a38578
Component: engine
2016-03-02 12:54:53 -05:00
569a4e8006 Merge pull request #20686 from clintonskitson/bugfix/plugin_desc_leak
Fix plugin file descriptor leaks
Upstream-commit: 29b2b0c22ba4a9c81002cd70e464ef0cfc577413
Component: engine
2016-02-29 10:44:36 -08:00
fac52dba98 Fixes plugin file descriptor leak on plugin discovery
Signed-off-by: Clinton Kitson <clintonskitson@gmail.com>
Upstream-commit: 799ae78b7efa9ffb8e142a0a211325cca59987be
Component: engine
2016-02-26 19:43:50 -08:00
1ca6d4e7c1 Close resp body on plugin call error
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 93ad9c31fce375b29606ea347df28c1205e7cb41
Component: engine
2016-02-24 20:09:51 -05:00
f62b97e499 Fix some typos in comments and strings
Most of them were found and fixed by codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Upstream-commit: 2eee613326fb59fd168849618d14a9054a40f9f5
Component: engine
2016-02-22 20:27:15 +01:00
4f226110ac Add support for forwarding Docker client through SOCKS proxy
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 05002c2501ac549b3cf677ab04d0f571cc456360
Component: engine
2016-02-16 11:09:28 -08:00
697a990701 fix common misspell
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 99a396902f0ea9d81ef87a683489b2435408f415
Component: engine
2016-02-11 15:49:36 -08:00
31b16ed933 Windows CI: test-unit on pkg\plugins
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 4b3001e85aff2c51a69eec205023e32384bebbdf
Component: engine
2016-02-10 19:28:30 -08:00
32fac24f32 Apply context changes to the client.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: fe53be4e1785ab4d8cadf246e5f2de419f337adc
Component: engine
2016-02-04 13:59:57 -05:00
f0e82098a7 Add back compat for volume drivers Get and Ls
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>
Upstream-commit: f6c20d9b22ec9913f67b6c2ebdb5ef07c87b8cd7
Component: engine
2016-01-22 22:48:17 -05:00
7e789b4066 Bump plugin API version
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 54587d861d6664d6d32bc62a46c0c7ea0c7853e6
Component: engine
2016-01-21 11:41:32 -05:00
6262193ba3 Don't error out on plugin err with json
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>
Upstream-commit: 279dd092b6e9d5f6bb405440fa8d407349f5ad84
Component: engine
2016-01-06 11:34:14 -05:00
db1910a30c Move responsibility of ls/inspect to volume driver
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>
Upstream-commit: d3eca4451d264aac564594fe46b8c097bd85a5cc
Component: engine
2016-01-05 16:28:38 -05:00
51b37769f0 Remove usage of pkg sockets and tlsconfig.
- 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>
Upstream-commit: 8e034802b7ad92a29f08785e553415adcd1348a3
Component: engine
2015-12-29 19:27:12 -05:00
547bf07eca pkg: authorization: do not register the same plugin
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>
Upstream-commit: c28fc06e002e06deed3437da76bc213b7bd752ba
Component: engine
2015-12-23 21:08:40 +01:00
d63981ab4d authZ: more fixes
- 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>
Upstream-commit: 5a64c8027ecd2bebe773c9abd2e73c2fd7d23de1
Component: engine
2015-12-18 16:29:01 +01:00
6862b2ec45 pkg: plugins: remove dead code
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 1d2b62ceae17238f842bb2a7febf1bead8a982d5
Component: engine
2015-12-17 11:05:50 +01:00
dcc0a93ee4 pkg: plugins: fix and better handle errors
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 4133dc22122c6a032276adb073d651bc6aca181b
Component: engine
2015-12-15 17:51:48 +01:00
54d257ee92 pkg/plugins/client.go: don't try to encode os decode if it's nil
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>
Upstream-commit: a2d348968fe754df41d0a1b56c7ba29ebbaa6849
Component: engine
2015-12-05 02:55:50 -05:00
93c2a19d83 Add user namespace (mapping) support to the Docker engine
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)
Upstream-commit: 442b45628ee12ebd8e8bd08497896d5fa8eec4bd
Component: engine
2015-10-09 17:47:37 -04:00
57e2d9f131 Merge pull request #13777 from cpuguy83/graphdriver_extpoints
Create extpoint for graphdrivers
Upstream-commit: 4c55464dd3fbbecb0e67f9b33c54f62f3982b500
Component: engine
2015-10-08 13:46:42 -07:00
a59918e10b Merge pull request #16494 from calavera/fix_plugin_url_scheme
Do not hardcode http as plugin URL scheme for secure connections.
Upstream-commit: a1573dffee45b8205ee589cbb0ed01e476eed529
Component: engine
2015-09-23 16:18:00 -07:00
b761cfeb67 Add README for pluginrpc-gen
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 7acd3ca79d2b13500ca3f53a567cb87fddd4a543
Component: engine
2015-09-22 19:34:44 -04:00
030ce4b62a Do not hardcode http as plugin URL scheme for secure connections.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: dc1761329768d337d7930059b334d45d016ebfd2
Component: engine
2015-09-22 15:54:29 -04:00
b24dbb9a0e Create extpoint for graphdrivers
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>
Upstream-commit: b78e4216a2a97704b664da34d526da1f7e080849
Component: engine
2015-09-09 20:24:35 -04:00
954de3578f Lint package pkg/plugins/pluginrpc-gen
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 915d6ec76d159a49082157be63d365f9b238d130
Component: engine
2015-09-05 23:15:13 +02:00
3ce116129d Retry registering a volume driver
Signed-off-by: Stephen Rust <srust@blockbridge.com>
Upstream-commit: 45fdce8a0d36d9b0825a6dfb6634a81f9af258af
Component: engine
2015-09-01 14:56:29 -04:00
bfe1bbc7d2 Add volume API/CLI
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: b3b7eb2723461b1eb4be692f4bced0ae8ea9cb58
Component: engine
2015-08-26 13:37:52 -04:00
3ee024f425 Don't globally lock on driver initialization
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>
Upstream-commit: 164208fde5f1d4bcc4d75333e3309b678edac985
Component: engine
2015-08-18 22:25:30 -07:00
2db54e3ac2 Lint on pkg/* packages
- 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>
Upstream-commit: 18c7c67308bd4a24a41028e63c2603bb74eac85e
Component: engine
2015-07-27 21:26:21 +02:00
4daf251bed Merge pull request #13951 from calavera/plugins_path
Separate plugin sockets and specs.
Upstream-commit: a763637eae7dcf5d870e9d035be5baf94d72e2c5
Component: engine
2015-07-17 21:11:31 +02:00
12460b884d Separate plugin sockets and specs.
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>
Upstream-commit: 6c0795747b00589641eb34eb7adce05a56d8840f
Component: engine
2015-07-16 14:20:07 -07:00
6ee4a354ae time duration should be nano seconds, gccgo treats it as zero
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
Upstream-commit: 6c4e14b3e233ba7359dfa51045937d761e28268e
Component: engine
2015-07-13 18:01:43 +00:00
33df474b64 Merge pull request #13835 from cpuguy83/gen-prc
generate plugin clients via template
Upstream-commit: 806b3fa14529a97dfad8fad8ed2a21b26de94492
Component: engine
2015-07-07 17:17:39 -07:00
7b3bea6e05 Plugins JSON spec.
Allow full configuration of external plugins via a JSON document.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 333ac3a3eb09c29c42fe2cea1680621700b67b2f
Component: engine
2015-06-29 10:32:18 -07:00
14ac6cb710 generate plugin clients via template
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 4c81c9dddc5e3996bf5a4fc7017b9d4a81e6fd46
Component: engine
2015-06-10 11:41:40 -04:00
10ccc11e11 Don't forget to clenaup tmpdir in TestFileSpecPlugin()
Also remove redundant code.

Signed-off-by: Zefan Li <lizefan@huawei.com>
Upstream-commit: d31224743b31b3e29ed7df0835193ff1ac4e723c
Component: engine
2015-06-04 21:26:15 +08:00
1efd411c44 Merge pull request #13577 from WeiZhang555/httpClose
bug fix: close http response body no longer in use
Upstream-commit: 1680c78e630611a968b24a7064b1a1cd80614d75
Component: engine
2015-05-29 16:59:17 -04:00
49406310ca return error when failed to read http response body
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: de225b5d130f40189297e12ceb1593949ca24219
Component: engine
2015-05-29 12:52:51 +08:00