Add configurable plugin path

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2019-04-01 16:54:27 -04:00
parent 341b99d6e2
commit 559dfa59a1
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