Add plugin dependency between shim and shim services

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko 2021-08-30 12:59:38 -07:00
parent fb5f6ce3c9
commit 33786ee4d2
6 changed files with 11 additions and 3 deletions

View File

@ -57,6 +57,8 @@ const (
RuntimePlugin Type = "io.containerd.runtime.v1"
// RuntimePluginV2 implements a runtime v2
RuntimePluginV2 Type = "io.containerd.runtime.v2"
// RuntimePluginV2Service is a shim provided service implemented on top of runtime v2 plugins.
RuntimePluginV2Service Type = "io.containerd.runtime.v2.service"
// ServicePlugin implements a internal service
ServicePlugin Type = "io.containerd.service.v1"
// GRPCPlugin implements a grpc service

View File

@ -95,8 +95,11 @@ func init() {
})
plugin.Register(&plugin.Registration{
Type: plugin.RuntimePluginV2,
Type: plugin.RuntimePluginV2Service,
ID: "task",
Requires: []plugin.Type{
plugin.RuntimePluginV2,
},
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
shimInstance, err := ic.GetByID(plugin.RuntimePluginV2, "shim")
if err != nil {
@ -417,7 +420,7 @@ func NewTaskManager(shims *ShimManager) *TaskManager {
// ID of the task manager
func (m *TaskManager) ID() string {
return fmt.Sprintf("%s.%s", plugin.RuntimePluginV2, "task")
return fmt.Sprintf("%s.%s", plugin.RuntimePluginV2Service, "task")
}
// Create launches new shim instance and creates new task

View File

@ -81,7 +81,7 @@ func initFunc(ic *plugin.InitContext) (interface{}, error) {
return nil, err
}
v2r, err := ic.GetByID(plugin.RuntimePluginV2, "task")
v2r, err := ic.GetByID(plugin.RuntimePluginV2Service, "task")
if err != nil {
return nil, err
}

View File

@ -24,6 +24,7 @@ import (
var tasksServiceRequires = []plugin.Type{
plugin.EventPlugin,
plugin.RuntimePluginV2,
plugin.RuntimePluginV2Service,
plugin.MetadataPlugin,
plugin.TaskMonitorPlugin,
}

View File

@ -30,6 +30,7 @@ var tasksServiceRequires = []plugin.Type{
plugin.EventPlugin,
plugin.RuntimePlugin,
plugin.RuntimePluginV2,
plugin.RuntimePluginV2Service,
plugin.MetadataPlugin,
plugin.TaskMonitorPlugin,
}

View File

@ -24,6 +24,7 @@ import (
var tasksServiceRequires = []plugin.Type{
plugin.EventPlugin,
plugin.RuntimePluginV2,
plugin.RuntimePluginV2Service,
plugin.MetadataPlugin,
plugin.TaskMonitorPlugin,
}