[sandbox] Register shim plugin after #6301

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko 2021-12-02 11:50:38 -08:00
parent 17a2aaded3
commit 35195737e7
2 changed files with 20 additions and 2 deletions

View File

@ -96,6 +96,24 @@ func init() {
return NewTaskManager(shimManager), nil return NewTaskManager(shimManager), nil
}, },
}) })
// Task manager uses shim manager as a dependency to manage shim instances.
// However, due to time limits and to avoid migration steps in 1.6 release,
// use the following workaround.
// This expected to be removed in 1.7.
plugin.Register(&plugin.Registration{
Type: plugin.RuntimePluginV2,
ID: "shim",
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
taskManagerI, err := ic.GetByID(plugin.RuntimePluginV2, "task")
if err != nil {
return nil, err
}
taskManager := taskManagerI.(*TaskManager)
return taskManager.manager, nil
},
})
} }
type ManagerConfig struct { type ManagerConfig struct {

View File

@ -41,12 +41,12 @@ func init() {
Type: plugin.ServicePlugin, Type: plugin.ServicePlugin,
ID: services.SandboxControllerService, ID: services.SandboxControllerService,
Requires: []plugin.Type{ Requires: []plugin.Type{
plugin.RuntimeShimPlugin, plugin.RuntimePluginV2,
plugin.MetadataPlugin, plugin.MetadataPlugin,
plugin.EventPlugin, plugin.EventPlugin,
}, },
InitFn: func(ic *plugin.InitContext) (interface{}, error) { InitFn: func(ic *plugin.InitContext) (interface{}, error) {
shimPlugin, err := ic.Get(plugin.RuntimeShimPlugin) shimPlugin, err := ic.GetByID(plugin.RuntimePluginV2, "shim")
if err != nil { if err != nil {
return nil, err return nil, err
} }