Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins: experimental support for new plugin management #23446

Merged
merged 3 commits into from
Jun 15, 2016

Conversation

tiborvass
Copy link
Contributor

@tiborvass tiborvass commented Jun 10, 2016

Fixes #20363

NOTE: this PR modifies vendor and the vendor check is expected to fail. Once we agree on design we'll do the proper vendoring.

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.

@subfuzion
Copy link

This sounds great. This seems like the general solution to the kind of thing I was hoping for when I wrote my thoughts on a generic logging driver that would let you specify the image to use for custom logging. My particular use case was to add Kafka logging support without having to wait for an official driver. Is that the right kind of use case this PR can help with? That would be awesome.

@thaJeztah
Copy link
Member

@subfuzion I don't think this adds support for new type of plugins (yet), so no logging-driver plugins yet

@thaJeztah
Copy link
Member

When denying the initial install, subsequent installs fail;

$ docker plugin install aragunathan/no-remove
Plugin "aragunathan/no-remove:latest" requested the following privileges:
 - Networking: host
 - Mounting host path: /data
Do you grant the above permissions? [y/N]  (pressed ENTER here, as it's the default)
Permission denied while installing plugin aragunathan/no-remove:latest

$ docker plugin install aragunathan/no-remove
Error response from daemon: aragunathan/no-remove:latest exists

Logs are below; note that my "deny permissions" does not show up in the logs,
perhaps we should add a log-entry for that, so that it can be found back:

DEBU[0031] Calling POST /v1.24/plugins/aragunathan/no-remove:latest/pull
DEBU[0032] Trying to pull aragunathan/no-remove from https://registry-1.docker.io v2
DEBU[0033] Increasing token expiration to: 60 seconds
DEBU[0033] manifest: {
   "schemaVersion": 2,
   "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
   "config": {
      "mediaType": "application/vnd.docker.plugin.v0+json",
      "size": 872,
      "digest": "sha256:073da4dede0a523c610c892bdfe1bc7dc4d7d0cf38b946be7155db197b2f2274"
   },
   "layers": [
      {
         "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
         "size": 5112374,
         "digest": "sha256:1c482de4cb9f561bc67ae257fc6462c77f66aa733d9d2d7e64432403af316f24"
      }
   ]
}
DEBU[0035] types.Plugin{Manifest:types.PluginManifest{ManifestVersion:"", Description:"", Documentation:"", Entrypoint:[]string(nil), Interface:types.PluginInterface{Types:[]types.InterfaceType(nil), Socket:""}, Network:types.PluginNetwork{Type:""}, Capabilities:[]string(nil), Mounts:[]struct { types.PluginSetting; types.PluginMount }(nil), Devices:[]struct { types.PluginSetting; types.PluginDevice }(nil), Env:[]struct { types.PluginSetting; types.PluginEnv }(nil), Args:[]struct { types.PluginSetting; types.PluginArg }(nil)}, Config:types.PluginConfig{Mounts:[]types.PluginMount(nil), Env:[]string(nil), Args:[]string(nil), Devices:[]types.PluginDevice(nil)}, Active:false, Name:"no-remove:latest", Tag:"", ID:""}
DEBU[0045] Calling GET /v1.24/info
DEBU[0045] Calling POST /v1.24/plugins/aragunathan/no-remove:latest/pull
DEBU[0045] plugin already exists
ERRO[0045] Handler for POST /v1.24/plugins/aragunathan/no-remove:latest/pull returned error: aragunathan/no-remove:latest exists

Doing remove, followed by install does not resolve this;

$ docker plugin rm aragunathan/no-remove:latest
aragunathan/no-remove:latest

$ docker plugin install aragunathan/no-remove
Error response from daemon: aragunathan/no-remove:latest exists

It looks like removing the plugin doesn't work in that case:

$ docker plugin rm aragunathan/no-remove:latest
aragunathan/no-remove:latest

$ docker plugin ls
NAME                    TAG                 ACTIVE
aragunathan/no-remove   latest              false

@thaJeztah
Copy link
Member

Looks like CI is failing;

https://jenkins.dockerproject.org/job/Docker-PRs-experimental/19809/console

22:59:48 + go test -check.v -check.timeout=5m -test.timeout=360m github.com/docker/docker/integration-cli
23:00:17 # github.com/docker/docker/integration-cli
23:00:17 ./docker_cli_external_graphdriver_unix_test.go:80: unknown plugins.Plugin field 'Name' in struct literal

https://jenkins.dockerproject.org/job/Docker-PRs/28607/console

23:57:19 # github.com/docker/docker/plugin
23:57:19 plugin/manager.go:285: cannot convert spec (type specs.Spec) to type libcontainerd.Spec
23:57:19 plugin/manager.go:354: cannot use specs.Root literal (type specs.Root) as type windowsoci.Root in assignment
23:57:19 plugin/manager.go:379: cannot use s (type windowsoci.WindowsSpec) as type specs.Spec in return argument
23:57:19 plugin/manager.go:383: cannot use s (type windowsoci.WindowsSpec) as type specs.Spec in return argument
23:57:19 plugin/manager.go:387: cannot use m (type specs.Mount) as type windowsoci.Mount in append
23:57:19 plugin/manager.go:400: cannot use specs.Process literal (type specs.Process) as type windowsoci.Process in assignment
23:57:19 plugin/manager.go:402: cannot use s (type windowsoci.WindowsSpec) as type specs.Spec in return argument
23:58:05 Build step 'Execute shell' marked build as failure

@thaJeztah thaJeztah added the status/failing-ci Indicates that the PR in its current state fails the test suite label Jun 11, 2016
"Type": "host"
},
"Capabilities": null,
"Mounts": [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should reconcile this with moby/swarmkit#918 and #22373

@anusha-ragunathan
Copy link
Contributor

cc @anusha-ragunathan

@icecrime icecrime added this to the 1.12.0 milestone Jun 13, 2016
@tiborvass tiborvass force-pushed the plugins-experimental branch 3 times, most recently from 384441c to bab6240 Compare June 14, 2016 00:04
@tiborvass tiborvass force-pushed the plugins-experimental branch 7 times, most recently from 1d854ed to 8e7bc6d Compare June 14, 2016 11:01
@tiborvass tiborvass force-pushed the plugins-experimental branch 2 times, most recently from 1401282 to 2cc6c47 Compare June 14, 2016 16:06
@mlaventure
Copy link
Contributor

Super long read! But couldn't find anything that poped out, since this is going into experimental, LGTM (IANAM).

@cpuguy83
Copy link
Member

LGTM

@icecrime
Copy link
Contributor

We need to remove those docs, as the feature is experimental.

@tiborvass Can we please gather them in a single document under the experimental/ docs tree?

@tiborvass tiborvass force-pushed the plugins-experimental branch 2 times, most recently from e866f44 to f371170 Compare June 14, 2016 21:20
Tibor Vass added 2 commits June 14, 2016 14:20
Signed-off-by: Tibor Vass <tibor@docker.com>
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 moby#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>
@thaJeztah
Copy link
Member

thaJeztah commented Jun 14, 2016

@tiborvass @icecrime you can also add an

advisory="experimental"

meta header; we added an option to the template to show a "this is an experimental feature" warning

@icecrime
Copy link
Contributor

I think it's better to do as usual and have it in a single page under experimental/, but as you wish.

@anusha-ragunathan
Copy link
Contributor

@thaJeztah : experimental advisory can be added to plugin docs. but the "support for advisory" PR is in docker/docs-base-1.12-integration. Do you know when it'll be merged to docker/docker?

@thaJeztah
Copy link
Member

@anusha-ragunathan is see there was a PR to do that but closed, https://github.com/docker/docs-base/pull/263, perhaps the 1.12-docs-base is going to be used, let me check

@tiborvass tiborvass force-pushed the plugins-experimental branch from 8dd36f4 to e85ed69 Compare June 14, 2016 22:24
@thaJeztah
Copy link
Member

docs LGTM (for the RC)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
type Errors []error

func (errs Errors) Error() string {
if len(errs) < 1 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: strings.Join() for this so you are not going from string to byte to string,etc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will fix in followup

@cpuguy83 cpuguy83 merged commit 6ed921d into moby:master Jun 15, 2016
@HackToday
Copy link
Contributor

hi @thaJeztah and @tiborvass where can I found the documentation about this ?

@albers
Copy link
Member

albers commented Jul 3, 2016

@thaJeztah I'm not sure how I should handle experimental features in bash completion.
There is no notion of an "experimental completion", so I fear that pulling support for experimental features into the completion might cause problems in release management.

If I do a default build from the sources, I will get no experimental features. Having them supported in the completion would mean an inconsistency.

My current policy is to ignore experimental features in bash completion. WDYT?

@thaJeztah
Copy link
Member

@albers yes, I think we should indeed ignore the completion for now

@albers
Copy link
Member

albers commented Jul 4, 2016

@thaJeztah yeah, I think maintaining two variants would not be adequate. Thanks for confirming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.