summaryrefslogtreecommitdiff
path: root/pkg/plugins
Commit message (Collapse)AuthorAgeFilesLines
* plugins: Move GlobalSpecPaths into LocalRegistryJan Garcia2023-01-107-45/+39
| | | | Signed-off-by: Jan Garcia <github-public@n-garcia.com>
* rootless: move ./rootless to ./pkg/rootlessJan Garcia2023-01-091-1/+1
| | | | Signed-off-by: Jan Garcia <github-public@n-garcia.com>
* Use user paths for plugin discovery in rootless modeJan Garcia2023-01-094-5/+54
| | | | Signed-off-by: Jan Garcia <github-public@n-garcia.com>
* pkg/*: fix "empty-lines" (revive)Sebastiaan van Stijn2022-09-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pkg/directory/directory.go:9:49: empty-lines: extra empty line at the start of a block (revive) pkg/pubsub/publisher.go:8:48: empty-lines: extra empty line at the start of a block (revive) pkg/loopback/attach_loopback.go:96:69: empty-lines: extra empty line at the start of a block (revive) pkg/devicemapper/devmapper_wrapper.go:136:48: empty-lines: extra empty line at the start of a block (revive) pkg/devicemapper/devmapper.go:391:35: empty-lines: extra empty line at the end of a block (revive) pkg/devicemapper/devmapper.go:676:35: empty-lines: extra empty line at the end of a block (revive) pkg/archive/changes_posix_test.go:15:38: empty-lines: extra empty line at the end of a block (revive) pkg/devicemapper/devmapper.go:241:51: empty-lines: extra empty line at the start of a block (revive) pkg/fileutils/fileutils_test.go:17:47: empty-lines: extra empty line at the end of a block (revive) pkg/fileutils/fileutils_test.go:34:48: empty-lines: extra empty line at the end of a block (revive) pkg/fileutils/fileutils_test.go:318:32: empty-lines: extra empty line at the end of a block (revive) pkg/tailfile/tailfile.go:171:6: empty-lines: extra empty line at the end of a block (revive) pkg/tarsum/fileinfosums_test.go:16:41: empty-lines: extra empty line at the end of a block (revive) pkg/tarsum/tarsum_test.go:198:42: empty-lines: extra empty line at the start of a block (revive) pkg/tarsum/tarsum_test.go:294:25: empty-lines: extra empty line at the start of a block (revive) pkg/tarsum/tarsum_test.go:407:34: empty-lines: extra empty line at the end of a block (revive) pkg/ioutils/fswriters_test.go:52:45: empty-lines: extra empty line at the end of a block (revive) pkg/ioutils/writers_test.go:24:39: empty-lines: extra empty line at the end of a block (revive) pkg/ioutils/bytespipe_test.go:78:26: empty-lines: extra empty line at the end of a block (revive) pkg/sysinfo/sysinfo_linux_test.go:13:37: empty-lines: extra empty line at the end of a block (revive) pkg/archive/archive_linux_test.go:57:64: empty-lines: extra empty line at the end of a block (revive) pkg/archive/changes.go:248:72: empty-lines: extra empty line at the start of a block (revive) pkg/archive/changes_posix_test.go:15:38: empty-lines: extra empty line at the end of a block (revive) pkg/archive/copy.go:248:124: empty-lines: extra empty line at the end of a block (revive) pkg/archive/diff_test.go:198:44: empty-lines: extra empty line at the end of a block (revive) pkg/archive/archive.go:304:12: empty-lines: extra empty line at the end of a block (revive) pkg/archive/archive.go:749:37: empty-lines: extra empty line at the end of a block (revive) pkg/archive/archive.go:812:81: empty-lines: extra empty line at the start of a block (revive) pkg/archive/copy_unix_test.go:347:34: empty-lines: extra empty line at the end of a block (revive) pkg/system/path.go:11:39: empty-lines: extra empty line at the end of a block (revive) pkg/system/meminfo_linux.go:29:21: empty-lines: extra empty line at the end of a block (revive) pkg/plugins/plugins.go:135:32: empty-lines: extra empty line at the end of a block (revive) pkg/authorization/response.go:71:48: empty-lines: extra empty line at the start of a block (revive) pkg/authorization/api_test.go:18:51: empty-lines: extra empty line at the end of a block (revive) pkg/authorization/middleware_test.go:23:44: empty-lines: extra empty line at the end of a block (revive) pkg/authorization/middleware_unix_test.go:17:46: empty-lines: extra empty line at the end of a block (revive) pkg/authorization/api_test.go:57:45: empty-lines: extra empty line at the end of a block (revive) pkg/authorization/response.go:83:50: empty-lines: extra empty line at the start of a block (revive) pkg/authorization/api_test.go:66:47: empty-lines: extra empty line at the end of a block (revive) pkg/authorization/middleware_unix_test.go:45:48: empty-lines: extra empty line at the end of a block (revive) pkg/authorization/response.go:145:75: empty-lines: extra empty line at the start of a block (revive) pkg/authorization/middleware_unix_test.go:56:51: empty-lines: extra empty line at the end of a block (revive) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* chore: update supported go version to 1.18+Bjorn Neergaard2022-09-153-56/+2
| | | | | | | | | The 1.16 `io/fs` compatibility code was being built on 1.18 and 1.19. Drop it completely as 1.16 is long EOL, and additionally drop 1.17 as it has been EOL for a month and 1.18 is both the minimum Go supported by the 20.10 branch, as well as a very easy jump from 1.17. Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
* gofmt GoDoc comments with go1.19Sebastiaan van Stijn2022-07-081-1/+1
| | | | | | | | Older versions of Go don't format comments, so committing this as a separate commit, so that we can already make these changes before we upgrade to Go 1.19. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* staticcheck: ignore "SA1019: strings.Title is deprecated"Sebastiaan van Stijn2022-03-161-1/+1
| | | | | | | | | | | | | | | | | | This function is marked deprecated in Go 1.18; however, the suggested replacement brings in a large amount of new code, and most strings we generate will be ASCII, so this would only be in case it's used for some user-provided string. We also don't have a language to use, so would be using the "default". Adding a `//nolint` comment to suppress the linting failure instead. daemon/logger/templates/templates.go:23:14: SA1019: strings.Title is deprecated: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead. (staticcheck) "title": strings.Title, ^ pkg/plugins/pluginrpc-gen/template.go:67:9: SA1019: strings.Title is deprecated: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead. (staticcheck) return strings.Title(s) ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Merge pull request #41215 from cpuguy83/better_plugin_errorsAkihiro Suda2021-10-241-1/+2
|\ | | | | Add more error details on plugin get
| * Add more error details on plugin getBrian Goff2020-07-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Seeing this `ErrNotImplements` in some of our logs and it's not very helpful because we don't know what plugin is causing it or even what the requested interface is. ``` {"message":"legacy plugin: Plugin does not implement the requested driver"} ``` Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* | pkg/plugins: fix compatibility with go1.16Sebastiaan van Stijn2021-08-313-2/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit c55a4ac7795c7606b548b38e24673733481e2167 changed the ioutil utilities to use the new os variants, per recommendation from the go 1.16 release notes: https://golang.org/doc/go1.16#ioutil > we encourage new code to use the new definitions in the io and os packages. > Here is a list of the new locations of the names exported by io/ioutil: However, the devil is in the detail, and io.ReadDir() is not a direct replacement for ioutil.ReadDir(); > ReadDir => os.ReadDir (note: returns a slice of os.DirEntry rather than a slice of fs.FileInfo) go1.16 added a io.FileInfoToDirEntry() utility to concert a DirEntry to a FileInfo, but it's not available in go1.16 This patch copies the FileInfoToDirEntry code, and uses it for go1.16. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | refactor: move from io/ioutil to io and os packageEng Zer Jun2021-08-276-23/+21
| | | | | | | | | | | | | | | | The io/ioutil package has been deprecated in Go 1.16. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* | Update to Go 1.17.0, and gofmt with Go 1.17Sebastiaan van Stijn2021-08-243-0/+3
| | | | | | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | Reduce TestClientWithRequestTimeout flakinessSebastiaan van Stijn2021-06-291-1/+1
|/ | | | | | | | | | | | | The test sometimes failed because no error was returned: === Failed === FAIL: pkg/plugins TestClientWithRequestTimeout (0.00s) client_test.go:254: assertion failed: expected an error, got nil: expected error Possibly caused by a race condition, as the sleep was just 1 ms longer than the timeout; this patch is increasing the sleep in the response to try to reduce flakiness. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Replace errors.Cause() with errors.Is() / errors.As()Sebastiaan van Stijn2020-04-292-5/+5
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* bump gotest.tools v3.0.1 for compatibility with Go 1.14Sebastiaan van Stijn2020-02-114-6/+6
| | | | | | full diff: https://github.com/gotestyourself/gotest.tools/compare/v2.3.0...v3.0.1 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* pkg/plugins: use constants for http methodsSebastiaan van Stijn2019-10-134-7/+7
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Merge pull request #39422 from lemrouch/35876-workaroundBrian Goff2019-07-221-0/+3
|\ | | | | Don't try to load plugin without name
| * Don't try to load plugin without namePavel Matěja2019-07-081-0/+3
| | | | | | | | | | | | | | | | This can happen when you have --config-only network Such attempt will fail anyway and it will create 15s delay in container startup Signed-off-by: Pavel Matěja <pavel@verotel.cz>
* | Harden TestClientWithRequestTimeoutSebastiaan van Stijn2019-07-121-7/+6
|/ | | | | | | | | | | | | | | | | | | | DeadlineExceeded now implements a TimeOut() function, since https://github.com/golang/go/commit/dc4427f3727804ded270bc6a7a8066ccb3c151d0 Check for this interface, to prevent possibly incorrect failures; ``` 00:16:41 --- FAIL: TestClientWithRequestTimeout (0.00s) 00:16:41 client_test.go:259: assertion failed: 00:16:41 --- context.DeadlineExceeded 00:16:41 +++ err 00:16:41 : 00:16:41 -: context.deadlineExceededError{} 00:16:41 +: &net.OpError{Op: "dial", Net: "tcp", Addr: s"127.0.0.1:49294", Err: &poll.TimeoutError{}} 00:16:41 ``` Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Remove duplicated words in pkg filesmooncake2018-10-051-1/+1
| | | | Signed-off-by: mooncake <xcoder@tenxcloud.com>
* Update tests to use gotest.tools 👼Vincent Demeester2018-06-134-6/+6
| | | | Signed-off-by: Vincent Demeester <vincent@sbr.pm>
* Move plugin client creation to the extension pointBrian Goff2018-05-251-0/+8
| | | | Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Post migration assertion fixesDaniel Nephin2018-03-161-5/+2
| | | | Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Automated migration usingDaniel Nephin2018-03-164-14/+16
| | | | | | gty-migrate-from-testify --ignore-build-tags Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Adds a unit test for plugin request timeoutBrian Goff2018-03-051-0/+43
| | | | Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Merge pull request #35829 from cpuguy83/no_private_mount_for_pluginsSebastiaan van Stijn2018-02-212-9/+8
|\ | | | | Perform plugin mounts in the runtime
| * Ensure plugin returns correctly scoped pathsBrian Goff2018-02-072-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, volume management was relying on the fact that everything the plugin mounts is visible on the host within the plugin's rootfs. In practice this caused some issues with mount leaks, so we changed the behavior such that mounts are not visible on the plugin's rootfs, but available outside of it, which breaks volume management. To fix the issue, allow the plugin to scope the path correctly rather than assuming that everything is visible in `p.Rootfs`. In practice this is just scoping the `PropagatedMount` paths to the correct host path. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* | Add canonical import commentDaniel Nephin2018-02-0517-17/+17
|/ | | | Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Fix issue with plugin scanner going to deepBrian Goff2018-02-023-22/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The plugin spec says that plugins can live in one of: - /var/run/docker/plugins/<name>.sock - /var/run/docker/plugins/<name>/<name>.sock - /etc/docker/plugins/<name>.[json,spec] - /etc/docker/plugins/<name>/<name>.<json,spec> - /usr/lib/docker/plugins/<name>.<json,spec> - /usr/lib/docker/plugins/<name>/<name>.<json,spec> However, the plugin scanner which is used by the volume list API was doing `filepath.Walk`, which will walk the entire tree for each of the supported paths. This means that even v2 plugins in `/var/run/docker/plugins/<id>/<name>.sock` were being detected as a v1 plugin. When the v1 plugin loader tried to load such a plugin it would log an error that it couldn't find it because it doesn't match one of the supported patterns... e.g. when in a subdir, the subdir name must match the plugin name for the socket. There is no behavior change as the error is only on the `Scan()` call, which is passing names to the plugin registry when someone calls the volume list API. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Add timeouts for volume plugin opsBrian Goff2018-01-161-4/+41
| | | | | | | This protects the daemon from volume plugins that are slow or deadlocked. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Add ineffassign linterDaniel Nephin2017-09-081-0/+3
| | | | | | Also enable GC in linting to reduce memory usage. Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Add deadcode linterDaniel Nephin2017-08-211-6/+0
| | | | Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Update logrus to v1.0.1Derek McGowan2017-07-312-2/+2
| | | | | | Fixes case sensitivity issue Signed-off-by: Derek McGowan <derek@mcgstyle.net>
* Spelling fixesJosh Soref2017-07-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Increase the Coverage of pkg/pluginsRaja Sami2017-06-125-8/+258
| | | | | | | | 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>
* Do not reuse a http.Request after a failure in callWithRetryFelix Abecassis2017-05-262-5/+26
| | | | | | Closes: #33412 Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
* Merge pull request #32222 from unclejack/small_cleanupSebastiaan van Stijn2017-03-302-2/+2
|\ | | | | Small cleanup
| * pkg/*: clean up a few issuesunclejack2017-03-302-2/+2
| | | | | | | | Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
* | plugins: Rename plugins_linux.go to plugins_unix.go and use build tagsAaron Lehmann2017-03-291-0/+2
|/ | | | | | This allows pkg/authorization to build on OS X. Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
* Fix deadlock on v1 plugin with activate errorBrian Goff2017-01-242-1/+8
| | | | | | | | When a plugin has an activation error, it was not being checked in the `waitActive` loop. This means it will just wait forever for a manifest to be populated even though it may never come. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Fix pluginv1 Windows volumesAnusha Ragunathan2017-01-133-6/+15
| | | | | | | | | | | | c54b717 caused a regression for pluginv1 on Windows, where extraneous backslashes were added to BasePath of the plugin. For pluginv1 on windows, BasePath() should return an empty string, since the plugin is fully aware of the mount path. Also, unlike Linux where all paths are relative to "/", Windows paths are dependent on system drives and mapped drives. Fixes #30148 Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
* Fix race accessing plugin storage mapBrian Goff2017-01-051-1/+8
| | | | | | | | | | | | | | | | `plugins.GetAll()` was not locking the plugin map when checking if a plugin exists, this can cause a race and potentially a panic if another goroutine is trying to load a plugin into the map at the same time. Also fixes a race during activation where a plugin inserts itself into the plugin map but does not check if something else is already there. This is already checked before trying to activate the plugin, however the map lock is not held for this entire period, so other plugins may be loaded during this time. To fix, before inserting the plugin into the map, check if one with the same name already exists and use that instead. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Merge pull request #29733 from cpuguy83/fix_v1plugin_deadlockTibor Vass2017-01-032-23/+88
|\ | | | | Fix race/deadlock in v1 plugin handlers
| * Fix race/deadlock in v1 plugin handlersBrian Goff2016-12-272-23/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a plugin is activated, and then `plugins.Handle` is called to register a new handler for a given plugin type, a deadlock occurs when for anything which calls `waitActive`, including `Get`, and `GetAll`. This happens because `Handle()` is setting `activated` to `false` to ensure that plugin handlers are run on next activation. Maybe these handlers should be called immediately for any plugins which are already registered... but to preserve the existing behavior while fixing the deadlock, track if handlers have been run on plugins and reset when a new handler is registered. The simplest way to reproduce the deadlock with Docker is to add a `-v /foo` to the test container created for the external graphdriver tests. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* | duplicated theJie Luo2016-12-211-1/+1
|/ | | | | | | | | | | | Signed-off-by: Jie Luo <luo612@zju.edu.cn> typo Signed-off-by: Jie Luo <luo612@zju.edu.cn> fix some typos Signed-off-by: Jie Luo <luo612@zju.edu.cn>
* plugins: container-rootfs-relative pathsTibor Vass2016-12-091-0/+6
| | | | | | | | | | | | | | | 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>
* Add HTTP client timeout.Anusha Ragunathan2016-11-211-6/+23
| | | | Signed-off-by: Anusha Ragunathan <anusha@docker.com>
* prevent data race in pkg/pluginsVictor Vieux2016-10-211-8/+17
| | | | Signed-off-by: Victor Vieux <vieux@docker.com>
* Allow plugins to have multiple handlersMadhu Venugopal2016-10-171-4/+15
| | | | | | | | Currently the plugins pkg allows a single handler. This assumption breaks down if there are mutiple listeners to a plugin of a certain Manifest such as NetworkDriver or IpamDriver when swarm-mode is enabled. Signed-off-by: Madhu Venugopal <madhu@docker.com>
* Make graphdrivers work with pluginv2.Anusha Ragunathan2016-09-201-2/+2
| | | | | | | | | | | | | | | As part of making graphdrivers support pluginv2, a PluginGetter interface was necessary for cleaner separation and avoiding import cycles. This commit creates a PluginGetter interface and makes pluginStore implement it. Then the pluginStore object is created in the daemon (rather than by the plugin manager) and passed to plugin init as well as to the different subsystems (eg. graphdrivers, volumedrivers). A side effect of this change was that some code was moved out of experimental. This is good, since plugin support will be stable soon. Signed-off-by: Anusha Ragunathan <anusha@docker.com>