From 559dfa59a194e398f2328b3c773750bec1b935c0 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 1 Apr 2019 16:54:27 -0400 Subject: [PATCH] Add configurable plugin path Signed-off-by: Michael Crosby --- services/server/config/config.go | 2 ++ services/server/server.go | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/services/server/config/config.go b/services/server/config/config.go index 27cebf579..25edf19a1 100644 --- a/services/server/config/config.go +++ b/services/server/config/config.go @@ -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 diff --git a/services/server/server.go b/services/server/server.go index b1b267042..140f54f6e 100644 --- a/services/server/server.go +++ b/services/server/server.go @@ -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