Commit Graph

172 Commits

Author SHA1 Message Date
8508f49b3f LCOW: Pass platform through into layer store
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 42c5c1a9ec14f00d5a5367131493cbd6de7d72b0
Component: engine
2017-06-20 09:21:37 -07:00
26df7d0bfd Merge pull request #33640 from dsheets/pluginv2-static-start-but-disabled-error
plugin/store.Get: return a specific error if plugin is disabled
Upstream-commit: 397a57d3a5f057a3c787afa107964b692ec2ebe1
Component: engine
2017-06-14 15:35:26 +02:00
75f90c1a7c Merge pull request #33655 from dsheets/authz-disable-race
Eliminate authz plugin disable race
Upstream-commit: 11293d91f94418a454006ee93e88aed1861fcf27
Component: engine
2017-06-14 11:07:23 +02:00
8857822260 authz: eliminate race during plugin removal from middleware
Also, this removes the use of a questionable golang range feature which
corrects for mutation of a slice during iteration over that slice. This
makes the filter operation easier to read and reason about.

Signed-off-by: David Sheets <dsheets@docker.com>
Upstream-commit: 7da3986297e04b419ce08b19766633dba36b7d30
Component: engine
2017-06-13 13:51:07 +01:00
234706e29f plugin/store: fix ErrAmbiguous docstring
Signed-off-by: David Sheets <dsheets@docker.com>
Upstream-commit: 2b79dfc240307ab948e0341f7668a3cdfdebf033
Component: engine
2017-06-12 18:07:42 +01:00
cc2f783975 plugin/store.Get: return a specific error if plugin is disabled
Previously, a 'plugin not found' error would be returned if a plugin to be
retrieved was found but disabled. This was misleading and incorrect. Now,
a new error plugin.ErrDisabled is returned in this case. This makes the
error message when trying to statically start plugins (from daemon.json or
dockerd command line) accurate.

Signed-off-by: David Sheets <dsheets@docker.com>
Upstream-commit: e33d598059d8af8c57995a2c52f1f9f5691c09e8
Component: engine
2017-06-12 18:06:00 +01:00
dd21307557 Increase the Coverage of pkg/plugins
Increases the test coverage of pkg/plugins.
Changed signature of function NewClientWithTimeout in pkg/plugin/client, to
take time.Duration instead of integers.

Signed-off-by: Raja Sami <raja.sami@tenpearl.com>
Upstream-commit: 8dd100a2297a34a0aef422383117fb0c3314fba1
Component: engine
2017-06-12 12:23:10 +05:00
779caabedf Partial refactor of UID/GID usage to use a unified struct.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 09cd96c5ad2de369912cdf708c3c50f41e4586ac
Component: engine
2017-06-07 11:44:33 -04:00
dd2f64591e Don't unmount entire plugin manager tree on remove
This was mistakenly unmounting everything under `plugins/*` instead of
just `plugins/<id>/*` anytime a plugin is removed.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: db5f31732a9868c1e9e4f9a49be70b794ff82d4f
Component: engine
2017-05-27 12:30:37 -04:00
14bb0faf0c Use chrootarchive for plugin rootfs
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 6f3f907cdba0ba1aa4eb1320595d155bab3467af
Component: engine
2017-05-18 14:53:46 -07:00
ce61a3d4f2 Update moby to runc and oci 1.0 runtime final rc
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 005506d36c1c9308a05592d7596f3d484359c426
Component: engine
2017-05-05 13:45:45 -07:00
e744d7cc6c Remove unnecessary line
Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
Upstream-commit: 145dfd924c8489cb2099bc1a86a01cd1fff19b70
Component: engine
2017-04-26 01:20:10 -06:00
aeae50e71e Make sure plugin rootfs is unmounted on upgraded
In some cases, if a user specifies `-f` when disabling a plugin mounts
can still exist on the plugin rootfs.
This can cause problems during upgrade where the rootfs is removed and
may cause data loss.

To resolve this, ensure the rootfs is unmounted
before performing an upgrade.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 83f44d232d2c5d7ce7c5e10d2cd0f912d32c2ea5
Component: engine
2017-04-11 21:09:15 -04:00
270cc52d25 Add an initial smaller sleep time before net dialing plugin socket.
Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
Upstream-commit: 891f9acb7b4e868df74c0f674eb84780e4e04149
Component: engine
2017-04-06 11:16:35 -07:00
78741ddf90 fix cleanup logic if restoring plugin fails
The "err" output variable was masked by the "if" statement,
so the error was never updated.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 5d25195f29539b3f12fa8dbc802201f93805c1c4
Component: engine
2017-03-31 16:42:30 +02:00
b690579b15 Merge pull request #32095 from anusha-ragunathan/set-state
Explictly set state of a disabled plugin.
Upstream-commit: cddffe327ebdf88df94618babbb1206b3ac7c629
Component: engine
2017-03-24 14:03:32 -07:00
9e044dac67 Explictly set state of a disabled plugin.
While restoring plugins during daemon restart, some plugins can fail to
respond to net.Dial. These plugins should be explicitly set to disabled,
else they will retain their original state of enabled, which is
incorrect.

Tested with a plugin that fails to restart and observed that the state
was set to disabled.

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
Upstream-commit: bbbf64f7128c3784f500cd15a994f20ab5d80920
Component: engine
2017-03-24 12:07:12 -07:00
30a11974ed Merge pull request #31930 from anusha-ragunathan/authz-disable
When authz plugin is disabled, remove from authz middleware chain.
Upstream-commit: bbce24997c7a31454edd1d3d979823582bcdd95d
Component: engine
2017-03-22 14:17:38 -07:00
2034662b7a When authz plugin is disabled, remove from authz middleware chain.
When the daemon is configured to run with an authorization-plugin and if
the plugin is disabled, the daemon continues to send API requests to the
plugin and expect it to respond. But the plugin has been disabled. As a
result, all API requests are blocked. Fix this behavior by removing the
disabled plugin from the authz middleware chain.

Tested using riyaz/authz-no-volume-plugin and observed that after
disabling the plugin, API request/response is functional.

Fixes #31836

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
Upstream-commit: 38de272bd4dfea945985b7031cd353ac5f6507c5
Component: engine
2017-03-22 12:07:39 -07:00
e82f1456b4 Embed DockerVersion in plugin config.
Embedding DockerVersion in plugin config when the plugin is created,
enables users to do a docker plugin inspect and know which version
the plugin was built on. This is helpful in cases where users are
running a new plugin on older docker releases and confused at
unexpected behavior.

By embedding DockerVersion in the config, we claim that there's no
guarantee that if the plugin config's DockerVersion is greater that
the version of the docker engine the plugin is executed against, the
plugin will work as expected.

For example, lets say:
- in 17.03, a plugin was released as johndoe/foo:v1
- in 17.05, the plugin uses the new ipchost config setting and author
publishes johndoe/foo:v2

In this case, johndoe/foo:v2 was built on 17.05 using ipchost, but is
running on docker-engine version 17.03. Since 17.05 > 17.03, there's
no guarantee that the plugin will work as expected. Ofcourse, if the
plugin did not use newly added config settings (ipchost in this case)
in 17.05, it would work fine in 17.03.

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
Upstream-commit: 342ed107bc6283cfc9b3301142e71f20aae0aaca
Component: engine
2017-03-22 10:26:20 -07:00
559dd7f06c Add pid host support
Tested using global-net-plugin-ipc which sets PidHost in config.json.

Plugins might need access to host pid namespace. Add support for that.
Tested using aragunathan/global-net-plugin-ipc which sets "pidhost" in
config.json. Observed using `readlink /proc/self/ns/pid` that plugin and
host have the same ns.

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
Upstream-commit: 4d1edcb2cce34bd86d2602923872f8b5c80560c8
Component: engine
2017-03-21 13:39:01 -07:00
c15d33bf9c Add support in plugin config for accessing host ipc namespace.
Plugins might need access to host ipc namespace. A good usecase is
a volume plugin running iscsi multipath commands that need access to
host kernel locks.
Tested with a custom plugin (aragunathan/global-net-plugin-full) that's
built with `"ipchost" : true` in config.json. Observed using
`readlink /proc/self/ns/ipc` that plugin and host have the same ns.

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
Upstream-commit: 6d6185c2577c473fa9046d73a850c09a254e9a81
Component: engine
2017-03-21 13:39:01 -07:00
3e18c0a07b fixed:go vetting warning unkeyed fields
Signed-off-by: Aaron.L.Xu <liker.xu@foxmail.com>
Upstream-commit: 2333b39b37cb7db80c66269d48c6f22dabf8973c
Component: engine
2017-03-20 16:30:01 +08:00
48ffb5882e Wait to unmount propagatedmount before marking plugin as disabled.
TestPluginTrustedInstall revealed a race in the plugin shutdown logic,
where the exit channel signal was sent even before the propagated mounts
were unmounted. If the same plugin was enabled, it would try to setup
propagated mounts *before* it was unmounted resulting in errors.

This change fixes the behavior by waiting until the unmount completes on
disable before marking the plugin as disabled.

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
Upstream-commit: 70b76266b586d193c333aa37dcda031f3d89f108
Component: engine
2017-03-16 15:25:41 -07:00
23ca2941d2 Net dial to the plugin socket during enable.
When a plugin fails to start, we still incorrectly mark it as enabled.
This change verifies that we can dial to the plugin socket to confirm that
the plugin is functional and only then mark the plugin as enabled. Also,
dont delete the plugin on install, if only the enable fails.

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
Upstream-commit: 1b41b7a4f4c824bbfdb1acac3e8c8505e0fdb84f
Component: engine
2017-02-27 18:11:28 -08:00
5c62127220 Merge pull request #29742 from miaoyq/rewrite-validate-privileges
Rewrite the function 'validatePrivileges' without checking order
Upstream-commit: 0ac25dfc751fa4304ab45afd5cd8705c2235d101
Component: engine
2017-02-17 10:24:11 +01:00
734f174687 plugin: check errors
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 3716dd227231046d4303f289bd31b9dde8168b26
Component: engine
2017-02-15 09:35:36 +01:00
2260389fe6 Use distribution reference
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)
Upstream-commit: 3a1279393faf78632bf169619d407e584da84b66
Component: engine
2017-02-07 11:08:37 -08:00
9bd3ca6b09 Rewrite the function 'validatePrivileges' without checking order
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
Upstream-commit: dafeeac4fd0ba811a4d88fe9ee335992680c8ad3
Component: engine
2017-02-04 08:47:40 +08:00
a14a8b183d Make propagated mount persist outside rootfs
This persists the "propagated mount" for plugins outside the main
rootfs. This enables `docker plugin upgrade` to not remove potentially
important data during upgrade rather than forcing plugin authors to hard
code a host path to persist data to.

Also migrates old plugins that have a propagated mount which is in the
rootfs on daemon startup.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: e8307b868de9f19bb97f5cafcd727df5c5f501be
Component: engine
2017-02-03 16:22:58 -05:00
28da29ca6e Add docker plugin upgrade
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>
Upstream-commit: 03c694973968f63743ed53cef83d0b7455695081
Component: engine
2017-02-03 16:21:12 -05:00
9655371ac7 Merge pull request #28627 from yongtang/28624-docker-plugin-ls
Add `--filter enabled=true` for `docker plugin ls`
Upstream-commit: 4c1b40b9d4a301edc5874e59edcec0f015490fec
Component: engine
2017-02-01 16:52:00 +01:00
83cd2e6903 plugin: use pkg/errors in more places
Also provide stack trace output in daemon logs.

Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 26d0bac8955903bc3a845358d159b2ec2f7c253f
Component: engine
2017-01-31 16:45:26 -08:00
b7000a9be6 Add capability filter to docker plugin ls
This fix adds `--filter capability=[volumedriver|authz]` to `docker plugin ls`.

The related docs has been updated.

An integration test has been added.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 99d91ada97334116b26b34a0fdcfa83cce73cda3
Component: engine
2017-01-27 07:32:22 -08:00
947241845a Add --filter enabled=true for docker plugin ls
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>
Upstream-commit: a66e0dc349dad2d45685846a95fe1d6da967a46d
Component: engine
2017-01-26 13:16:11 -08:00
027b11b8c3 Remove use of forked reference package for cli
Use resolving to repo info as the split point between the
legitimate reference package and forked reference package.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 0421f5173dbdcb4e4eade5267f274302bb6ab97c
Component: engine
2017-01-19 16:04:50 -08:00
1cb5b7c369 Merge pull request #30014 from tiborvass/plugin-devices-redone-master
Plugins: Rename DeviceCreation to AllowAllDevices
Upstream-commit: 696ef7a19eccd44732e9c50902c8949e574ef097
Component: engine
2017-01-10 17:24:38 -08:00
b998fced62 plugins: rename DeviceCreation to AllowAllDevices
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: f265727bdf637c717cd8bdc8675aff4d1714963e
Component: engine
2017-01-10 13:50:30 -08:00
b3e47ec408 Merge pull request #29564 from aaronlehmann/getter-types
plugingetter: Avoid all caps for constant declarations
Upstream-commit: 9c96768eae4b3a65147b47a55c850c103ab8972d
Component: engine
2017-01-10 09:35:19 +01:00
775c5633ef *: use opencontainers/go-digest package
The `digest` data type, used throughout docker for image verification
and identity, has been broken out into `opencontainers/go-digest`. This
PR updates the dependencies and moves uses over to the new type.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
Upstream-commit: 7a855799175b6b984886ef1cfa337d6df1d4c668
Component: engine
2017-01-06 18:48:41 -08:00
8b3646ee75 plugingetter: Avoid all caps for constant declarations
Go style calls for mixed caps instead of all caps:
https://golang.org/doc/effective_go.html#mixed-caps

Change LOOKUP, ACQUIRE, and RELEASE to Lookup, Acquire, and Release.

This vendors a fork of libnetwork for now, to deal with a cyclic
dependency issue. The change will be upstream to libnetwork once this is
merged.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 428600108cce0a11e65ec4ebd9e439e947b55da7
Component: engine
2017-01-04 10:19:04 -08:00
cb7b1468a9 Merge pull request #29789 from miaoyq/optimization-error-description
Optimization a error description
Upstream-commit: ef9935ce8f4acf5d53db0a2f9621f9135aed442b
Component: engine
2017-01-03 13:01:22 -08:00
cafa442cac fix "retreive" typo in plugin store
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 03bf37884d089b69fd7e05491eff658420f40c5d
Component: engine
2017-01-02 15:01:19 +01:00
aa956c7c5f Optimization a error description
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
Upstream-commit: 6c021893aa12088c0ad5b18111cfa80d6008a78f
Component: engine
2016-12-30 11:58:39 +08:00
75dc0839ff Fix validation of plugins without rootfs in config
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 6c7cb520094866cacbecb96695aed2d67d8a64a0
Component: engine
2016-12-27 15:36:12 -08:00
396314b106 Fix inspect object by invalid reference
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 3cd39aaeab37102e4b12decc0c36042e477e2fa6
Component: engine
2016-12-23 22:57:30 -08:00
478844dff8 Implement content addressability for plugins
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>
Upstream-commit: 3d86b0c79b16334ce5836c0315e4c310b84c2e17
Component: engine
2016-12-23 13:29:58 -08:00
e6fc7a5576 Merge pull request #29599 from anusha-ragunathan/refcount
Enforce zero plugin refcount during disable, not remove.
Upstream-commit: d1dfc1a5ef95dc5621a07915f9786199442043c7
Component: engine
2016-12-22 15:38:54 -08:00
9eac558235 Enforce zero plugin refcount during disable.
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>
Upstream-commit: 8cb2229cd18c53bdbf36301f26db565a50027d6a
Component: engine
2016-12-22 13:26:53 -08:00
efaab09327 Add a GetAll function that returns only managed plugins supported by V2
The current GetAll handles both V2 and legacy plugins. Also due to the
nature of V1 plugins, it also loads them. This causes problems when
loading is not required. Hence adding an independent API that will
return only the plugins that are loaded using v2 mangaed plugins.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
Upstream-commit: 8f1b793528e01004e4a40fe4ef835e235282b2f4
Component: engine
2016-12-22 10:26:04 -08:00