Commit Graph

195 Commits

Author SHA1 Message Date
044d7f995b Update libcontainerd to use containerd 1.0
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: ddae20c032058a0fd42c34c2e9750ee8f6296ac8
Component: engine
2017-10-20 07:11:37 -07:00
3547a4b45b Refactor plugin store to reduce nested if's in Get
This patch removes the nested if's  in the Get function
and makes the code more readable.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: 36ebf9489c3c6c8422d8ff9bb6e2cb65a9a66698
Component: engine
2017-10-09 22:21:27 +03:00
35db73fa01 LCOW: API: Add platform to /images/create and /build
Signed-off-by: John Howard <jhoward@microsoft.com>

This PR has the API changes described in https://github.com/moby/moby/issues/34617.
Specifically, it adds an HTTP header "X-Requested-Platform" which is a JSON-encoded
OCI Image-spec `Platform` structure.

In addition, it renames (almost all) uses of a string variable platform (and associated)
methods/functions to os. This makes it much clearer to disambiguate with the swarm
"platform" which is really os/arch. This is a stepping stone to getting the daemon towards
fully multi-platform/arch-aware, and makes it clear when "operating system" is being
referred to rather than "platform" which is misleadingly used - sometimes in the swarm
meaning, but more often as just the operating system.
Upstream-commit: 0380fbff37922cadf294851b1546f4c212c7f364
Component: engine
2017-10-06 11:44:18 -07:00
c4c68bf819 Replace uses of filters.Include() with filters.Contains()
The `filters.Include()` method was deprecated in favor of `filters.Contains()`
in 065118390a3ecaf0dbd2fa752d54d43f8f1e8ec6, but still used in various
locations.

This patch replaces uses of `filters.Include()` with `filters.Contains()`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 97c5ae25c4d857563acd1f3467afc760145b1d55
Component: engine
2017-09-26 13:39:56 +02:00
cb0c1a12c4 Decouple plugin manager from libcontainerd package
libcontainerd has a bunch of platform dependent code and huge interfaces
that are a pain implement.
To make the plugin manager a bit easier to work with, extract the plugin
executor into an interface and move the containerd implementation to a
separate package.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: c85e8622a4813d7b72d74517faa03ab5de4c4550
Component: engine
2017-09-19 12:17:55 -04:00
cddfe04f6a LCOW: Implemented support for docker cp + build
This enables docker cp and ADD/COPY docker build support for LCOW.
Originally, the graphdriver.Get() interface returned a local path
to the container root filesystem. This does not work for LCOW, so
the Get() method now returns an interface that LCOW implements to
support copying to and from the container.

Signed-off-by: Akash Gupta <akagup@microsoft.com>
Upstream-commit: 7a7357dae1bcccb17e9b2d4c7c8f5c025fce56ca
Component: engine
2017-09-14 12:07:52 -07:00
8ef302a435 Merge pull request #34625 from dnephin/more-linters
Add interfacer and unconvert linters
Upstream-commit: cb952bf00695b3429476f59c5534a9c604c6f010
Component: engine
2017-09-01 08:46:08 -07:00
2ca5291236 Merge pull request #34356 from mlaventure/update-containerd
Update containerd to 06b9cb35161009dcb7123345749fef02f7cea8e0
Upstream-commit: 285bc997311b75263bfac9e8ff7c4d60cdeca0bc
Component: engine
2017-08-24 14:25:44 -07:00
01392057b0 Add unconvert linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 2f5f0af3fdb7e9ee607a0e178dbe2af6e10cccf4
Component: engine
2017-08-24 15:08:31 -04:00
94c685a721 Add deadcode linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 62c1f0ef41e6cd88a8846da1c11976a320ca8b41
Component: engine
2017-08-21 18:18:50 -04:00
5305a1cd9e Update containerd to 06b9cb35161009dcb7123345749fef02f7cea8e0
This also update:
 - runc to 3f2f8b84a77f73d38244dd690525642a72156c64
 - runtime-specs to v1.0.0

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 45d85c99139bbd16004bbedb7d5bac6a60264538
Component: engine
2017-08-21 12:04:07 -07:00
30f1b651e2 Remove string checking in API error handling
Use strongly typed errors to set HTTP status codes.
Error interfaces are defined in the api/errors package and errors
returned from controllers are checked against these interfaces.

Errors can be wraeped in a pkg/errors.Causer, as long as somewhere in the
line of causes one of the interfaces is implemented. The special error
interfaces take precedence over Causer, meaning if both Causer and one
of the new error interfaces are implemented, the Causer is not
traversed.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: ebcb7d6b406fe50ea9a237c73004d75884184c33
Component: engine
2017-08-15 16:01:11 -04:00
60257585de Make plugins dir private.
This prevents mounts in the plugins dir from leaking into other
namespaces which can prevent removal (`device or resource busy`),
particularly on older kernels.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 0c2821d6f2de692d105e50a399daa65169697cca
Component: engine
2017-08-02 16:58:07 -04:00
d659edcaf5 Update logrus to v1.0.1
Fixes case sensitivity issue

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Upstream-commit: 1009e6a40b295187e038b67e184e9c0384d95538
Component: engine
2017-07-31 13:16:46 -07:00
e95f4619cd [project] change syscall to /x/sys/unix|windows
Changes most references of syscall to golang.org/x/sys/
Ones aren't changes include, Errno, Signal and SysProcAttr
as they haven't been implemented in /x/sys/.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>

[s390x] switch utsname from unsigned to signed

per 33267e036f
char in s390x in the /x/sys/unix package is now signed, so
change the buildtags

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
Upstream-commit: 069fdc8a083cb1663e4f86fe3fd9b9a1aebc3e54
Component: engine
2017-07-11 08:00:32 -04:00
c782cb6c44 Make plugin emit strongly typed, consumable events
Enables other subsystems to watch actions for a plugin(s).

This will be used specifically for implementing plugins on swarm where a
swarm controller needs to watch the state of a plugin.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 72c3bcf2a533a827402945e3a55872e2db4fb024
Component: engine
2017-07-06 14:26:06 -04:00
08a00684a2 Merge pull request #33944 from cpuguy83/fix_wrong_dirname
Fix plugin remove dir name after rename.
Upstream-commit: 82c2a08b6018586f3c8f35405c3bd6fce3c78ccd
Component: engine
2017-07-04 16:12:39 +02:00
ec1ee882b3 Merge pull request #33322 from jsoref/spelling
Spelling
Upstream-commit: ff4f700f74450018f36d014f3cde0ff1b9c17fb3
Component: engine
2017-07-04 15:46:34 +02:00
b4c3d928eb Fix plugin remove dir name after rename.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 4bf263c19873718394f8161dbc020bf4be30f9d6
Component: engine
2017-07-04 07:37:26 -04:00
643654c2f0 Spelling fixes
* additional
* ambiguous
* anonymous
* anything
* application
* because
* before
* building
* capabilities
* circumstances
* commit
* committer
* compresses
* concatenated
* config
* container
* container's
* current
* definition
* delimiter
* disassociates
* discovery
* distributed
* doesnotexist
* downloads
* duplicates
* either
* enhancing
* enumerate
* escapable
* exactly
* expect
* expectations
* expected
* explicitly
* false
* filesystem
* following
* forbidden
* git with
* healthcheck
* ignore
* independent
* inheritance
* investigating
* irrelevant
* it
* logging
* looking
* membership
* mimic
* minimum
* modify
* mountpoint
* multiline
* notifier
* outputting
* outside
* overridden
* override
* parsable
* plugins
* precedence
* propagation
* provided
* provides
* registries
* repositories
* returning
* settings
* should
* signals
* someone
* something
* specifically
* successfully
* synchronize
* they've
* thinking
* uninitialized
* unintentionally
* unmarshaling
* unnamed
* unreferenced
* verify

Signed-off-by: Josh Soref <jsoref@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 39bcaee47b8a284a46b761afe218ba7deda0d482
Component: engine
2017-07-03 13:13:09 -07:00
7e46ec7067 Make plugin removes more resilient to failure
Before this patch, if the plugin's `config.json` is successfully removed
but the main plugin state dir could not be removed for some reason (e.g.
leaked mount), it will prevent the daemon from being able to be
restarted.

This patches changes this to atomically remove the plugin such that on
daemon restart we can detect that there was an error and re-try. It also
changes the logic so that it only logs errors on restore rather than
erroring out the daemon.

This also removes some code which is now duplicated elsewhere.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 11cf394e5ea964636294a219872b188fe5bdf4dd
Component: engine
2017-06-30 09:58:19 -04:00
9a5747b3f9 LCOW: Fix nits from 33241
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 4ec9766a27ffb964cec6b8b2745725965b2644aa
Component: engine
2017-06-27 11:59:49 -07:00
94ce604e3d LCOW: OCI Spec and Environment for container start
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: f1545882264e743fa6d6859ee8687407e28fc35c
Component: engine
2017-06-20 19:50:11 -07:00
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