Merge pull request #3155 from crosbymichael/plugins

Add configurable plugin path
This commit is contained in:
Derek McGowan 2019-04-01 15:22:51 -07:00 committed by GitHub
commit bc8a1895e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -28,6 +28,8 @@ type Config struct {
Root string `toml:"root"`
// State is the path to a directory where containerd will store transient data
State string `toml:"state"`
// PluginDir is the directory for dynamic plugins to be stored
PluginDir string `toml:"plugin_dir"`
// GRPC configuration settings
GRPC GRPCConfig `toml:"grpc"`
// Debug and profiling settings

View File

@ -220,7 +220,11 @@ func (s *Server) Stop() {
// of all plugins.
func LoadPlugins(ctx context.Context, config *srvconfig.Config) ([]*plugin.Registration, error) {
// load all plugins into containerd
if err := plugin.Load(filepath.Join(config.Root, "plugins")); err != nil {
path := config.PluginDir
if path == "" {
path = filepath.Join(config.Root, "plugins")
}
if err := plugin.Load(path); err != nil {
return nil, err
}
// load additional plugins that don't automatically register themselves