Commit Graph

30 Commits

Author SHA1 Message Date
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
731e6df224 bug fix: close http response body no longer in use
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: 6c49576a860433d89b3c2d651bdca386353128cc
Component: engine
2015-05-29 12:03:40 +08:00
89782c55eb Volumes refactor and external plugin implementation.
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>
Upstream-commit: 81fa9feb0cdc0773eff99d7393c16271e84aac08
Component: engine
2015-05-21 20:34:17 -07:00
c1aed4887a Fixing a Typo in plugins mime-type
Signed-off-by: Madhu Venugopal <madhu@docker.com>
Upstream-commit: 215a5ebdb6c36f63ff4d6294f2d1b29f87b6af40
Component: engine
2015-05-16 08:49:23 -07:00
377836e4b2 Allow to call back when a plugin is loaded.
Signed-off-by: Madhu Venugopal <madhu@docker.com>
Upstream-commit: ba3bcf053749543a1643421d7fa5f680a49ee1a8
Component: engine
2015-05-15 13:50:44 -07:00
dbb89bcdab Remote plugins plumbing.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 839d64ffb157ba170fb644a42f5096f334b7cc48
Component: engine
2015-05-15 11:04:58 -07:00