Merge pull request #3155 from crosbymichael/plugins
Add configurable plugin path
This commit is contained in:
		| @@ -28,6 +28,8 @@ type Config struct { | |||||||
| 	Root string `toml:"root"` | 	Root string `toml:"root"` | ||||||
| 	// State is the path to a directory where containerd will store transient data | 	// State is the path to a directory where containerd will store transient data | ||||||
| 	State string `toml:"state"` | 	State string `toml:"state"` | ||||||
|  | 	// PluginDir is the directory for dynamic plugins to be stored | ||||||
|  | 	PluginDir string `toml:"plugin_dir"` | ||||||
| 	// GRPC configuration settings | 	// GRPC configuration settings | ||||||
| 	GRPC GRPCConfig `toml:"grpc"` | 	GRPC GRPCConfig `toml:"grpc"` | ||||||
| 	// Debug and profiling settings | 	// Debug and profiling settings | ||||||
|   | |||||||
| @@ -220,7 +220,11 @@ func (s *Server) Stop() { | |||||||
| // of all plugins. | // of all plugins. | ||||||
| func LoadPlugins(ctx context.Context, config *srvconfig.Config) ([]*plugin.Registration, error) { | func LoadPlugins(ctx context.Context, config *srvconfig.Config) ([]*plugin.Registration, error) { | ||||||
| 	// load all plugins into containerd | 	// 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 | 		return nil, err | ||||||
| 	} | 	} | ||||||
| 	// load additional plugins that don't automatically register themselves | 	// load additional plugins that don't automatically register themselves | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Derek McGowan
					Derek McGowan