Commit Graph

39 Commits

Author SHA1 Message Date
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
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
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
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
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
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
2aa298ba4e Fix issues with plugin and --live-restore
Fixes an issue when starting the daemon with live-restore
where previously it was not set, plugins are not running.

Fixes an issue when starting the daemon with live-restore, the plugin
client (for interacting with the plugins HTTP interface) is not set,
causing a panic when the plugin is called.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: cb6633175c0de0a7ae155c4d378cd2379681554b
Component: engine
2016-12-13 16:11:59 -05:00
5710a52064 When plugin enable fails, unmount PropagatedMount.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: cef443bddf2a185b3afa2f5c7333fd461c87ae74
Component: engine
2016-12-12 13:25:06 -08:00
656f60dc73 plugins: container-rootfs-relative paths
Legacy plugins expect host-relative paths (such as for Volume.Mount).
However, a containerized plugin cannot respond with a host-relative
path. Therefore, this commit modifies new volume plugins' paths in Mount
and List to prepend the container's rootfs path.

This introduces a new PropagatedMount field in the Plugin Config.
When it is set for volume plugins, RootfsPropagation is set to rshared
and the path specified by PropagatedMount is bind-mounted with rshared
prior to launching the container. This is so that the daemon code can
access the paths returned by the plugin from the host mount namespace.

Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: c54b717caf1a55e525ce180bfcb42addd59c6633
Component: engine
2016-12-09 10:16:24 -08:00
3889503c60 Make v2/Plugin accesses safe.
v2/Plugin struct had fields that were
- purely used by the manager.
- unsafely exposed without proper locking.
This change fixes this, by moving relevant fields to the manager as well
as making remaining fields as private and providing proper accessors for
them.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: b35490a8ba2ad70a585c1ba8109b6d87aece8daa
Component: engine
2016-12-06 13:23:41 -08:00
c7fce8b04c Fix issue with plugin exit.
A plugin has an `ExitChan` channel which is used to signal the exit of
the plugin process. In a recent change, the initialization was
incorrectly moved to the daemon Shutdown path.

Fix this by initializing the channel during plugin enable.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 890a98ceed982454515f5b089d9772fc1e4eb6e0
Component: engine
2016-11-28 12:48:56 -08:00
c21adc5da9 Add HTTP client timeout.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 83ca993c154d56e03d6f95a3f8351c48b3ed3e29
Component: engine
2016-11-21 13:11:40 -08:00
6f5b54ba77 Cleanup after plugin install.
During error cases, we dont cleanup correctly. This commit takes care
of removing the plugin, if there are errors after the pull passed. It
also shuts down the plugin, if there are errors after the plugin in the
enable path.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 1144f8f1d4b1fd2bbf1f41bf5dad8d929d0dc06e
Component: engine
2016-11-16 14:45:51 -08:00
195add3182 Perform graceful shutdown during plugin disable.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 766cc9b46753106c6880ccdea0a4dcb2bc734c2a
Component: engine
2016-11-14 15:09:48 -08:00
e24e6d4206 Merge pull request #27467 from tonistiigi/attach-cb
Move stdio attach from libcontainerd backend to callback
Upstream-commit: 8ed31089c03c36954e95c2066b1f3724e2d5c849
Component: engine
2016-10-25 16:23:07 +02:00
9a299b360f Make experimental a runtime flag
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 7781a1bf0fef748877326632b88e92fbf3c90daa
Component: engine
2016-10-24 15:20:01 -07:00
1883869e16 Move stdio attach from libcontainerd backend to callback
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 37a3be2449d2a314305615ffcc287a598a829dba
Component: engine
2016-10-24 00:20:36 -07:00
6363780a38 Remove restartmanager from plugins
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: a452d1fccb6d515545dacd4bebfa36cbf70a6535
Component: engine
2016-10-07 12:10:13 -07:00
434bea436a Remove hacked Windows OCI spec, compile fixups
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 02309170a5fb97d40260d0ee9e24b44be8c780b2
Component: engine
2016-09-27 12:07:35 -07:00
7bef93723c Initial implementation of containerd Checkpoint API.
Signed-off-by: boucher <rboucher@gmail.com>
Upstream-commit: d8fef66b03c1ea8715470690efbd950033f7f628
Component: engine
2016-09-08 21:31:52 -04:00
45ddc4bfcb Add engine-api types to docker
This moves the types for the `engine-api` repo to the existing types
package.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 91e197d614547f0202e6ae9b8a24d88ee131d950
Component: engine
2016-09-07 11:05:58 -07:00
2f08c46e47 Adding pluginv2 support for libnetwork (part 1)
Legacy plugins (aka pluginv1) calls in libnetwork are replaced with
calls using the new plugin model (aka pluginv2). pkg/plugins is still
used for managing the http client connections to the plugin.

This commit makes the necessary changes in docker/docker. Part 2 will
will take care of the libnetwork changes.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 17b8aba1d924e505563af400d758b89c8406961d
Component: engine
2016-09-06 14:30:55 -07:00
ec70ce176c Reorganize plugin package into sub packages.
Split plugin package into `store` and `v2/plugin`. Now the functionality
is clearly delineated:
- Manager: Manages the global state of the plugin sub-system.
- PluginStore: Manages a collection of plugins (in memory and on-disk)
- Plugin: Manages the single plugin unit.

This also facilitates splitting the global PluginManager lock into:
- PluginManager lock to protect global states.
- PluginStore lock to protect store states.
- Plugin lock to protect individual plugin states.

Importing "github.com/docker/docker/plugin/store" will provide access
to plugins and has lesser dependencies when compared to importing the
original monolithic `plugin package`.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 27a55fba28ff9c085385254cb69ecc8ea6891aa9
Component: engine
2016-08-27 11:08:08 -07:00
e44f33953e replace active by enabled for consistency in plugins
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: cf4e268115911e9e4a4da94dc00b2dc370f86a47
Component: engine
2016-08-25 20:42:49 -07:00
6c683fac48 Replace old oci specs import with runtime-specs
Fixes #25804

The upstream repo changed the import paths.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 041e5a21dc0a8856448e3a9ad91e8535b8a7d00d
Component: engine
2016-08-17 09:38:34 -07:00
5c4fc1cbb0 Merge pull request #25638 from anusha-ragunathan/fix-plugin-tests
Debugging issue #25511
Upstream-commit: 6e70a976ba98c24ed4027f2b8e5890718be57344
Component: engine
2016-08-16 15:13:31 -07:00
be73319004 When handling plugin exit, lookup plugins only during daemon shutdown.
The main intent of handling plugin exit is for graceful shutdown
of plugins during daemon shutdown. So avoid plugin lookup during
plugin exits caused by other reasons (eg. force remove)

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 57499fa62e697ea244455c5abda7ed8bc022f44c
Component: engine
2016-08-15 14:46:02 -07:00
cdfc3ebd94 Fix deadlock on plugin shutdown.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 4d009084de8cad94a180130eb57efa2a98df6d98
Component: engine
2016-08-11 19:36:32 -07:00
3c5296fd50 Debugging issue #25511
Volumes and other content created under a bind mount should be
recursively propagated using rshared, not shared. This could be
the reason for EBUSY during removal. Override options with rbind,
rshared and see if CI errors are fixed.

May fix #25511

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: e58028d078077dc566639ff52ece09ad6c481e44
Component: engine
2016-08-11 15:27:06 -07:00
2921fa6d1b fix plugin restart on docker restart
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: ab12ed4a5642edb4d96b54b6152f12260093f3ea
Component: engine
2016-08-09 11:49:28 -07:00
062b507351 Make daemon events listen for plugin lifecycle events.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 42abccb841b5bc0d420044e69165852b0054c38f
Component: engine
2016-07-26 10:51:47 -07:00
37c9afdc01 Check for plugin state before enable and disable.
This prevents unnecessary API call to containerd.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: b867f6c6e18f9d999ddec911a241941428777569
Component: engine
2016-07-25 19:24:28 -07:00
ed21a7262c Handle plugin shutdown when liveRestore is set.
When daemon has liveRestore set, daemon shutdown should not shutdown
plugins. Fixes #24759

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 4a44cf1d4c8e540b67aaa3834291a964c6ab7524
Component: engine
2016-07-22 15:26:43 -07:00
0633dc391e Remove use of exec-root in plugins due to socket pathname limits.
Unix sockets are limited to 108 bytes. As a result, we need to be
careful in not using exec-root as the parent directory for pluginID
(which is already 64 bytes), since it can result in socket path names
longer than 108 bytes. Use /tmp instead. Before this change, setting:
- dockerd --exec-root=/go/src/github.com/do passes
- dockerd --exec-root=/go/src/github.com/doc fails
After this change, there's no failure.

Also, write a volume plugins test to verify that the plugins socket
responds.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 21ecd5a93db34288c0c579d5738030716d7bef2d
Component: engine
2016-07-15 09:17:29 -07:00
495149133d Shutdown plugins during daemon shutdown.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 863ab9ab134d0baef3c7e5d745eded891e87e734
Component: engine
2016-07-11 14:21:27 -07:00
bc663a35ec plugins: remove automatic mounting of a state dir
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 15ff9de65801178a522c445ff9fb8964e21d12a0
Component: engine
2016-06-17 10:03:30 -07:00
f06eb442e7 Implement plugin restore after daemon restart
This ensures that:

- The in-memory plugin store is populated with all the plugins
- Plugins which were active before daemon restart are active after.
  This utilizes the liverestore feature when available, otherwise it
  manually starts the plugin.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: dfd91873056c172ffc061d882da0cd18204b521a
Component: engine
2016-06-15 13:39:33 -04: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