Add plugin dependency between shim and shim services
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
parent
fb5f6ce3c9
commit
33786ee4d2
@ -57,6 +57,8 @@ const (
|
|||||||
RuntimePlugin Type = "io.containerd.runtime.v1"
|
RuntimePlugin Type = "io.containerd.runtime.v1"
|
||||||
// RuntimePluginV2 implements a runtime v2
|
// RuntimePluginV2 implements a runtime v2
|
||||||
RuntimePluginV2 Type = "io.containerd.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 implements a internal service
|
||||||
ServicePlugin Type = "io.containerd.service.v1"
|
ServicePlugin Type = "io.containerd.service.v1"
|
||||||
// GRPCPlugin implements a grpc service
|
// GRPCPlugin implements a grpc service
|
||||||
|
@ -95,8 +95,11 @@ func init() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.RuntimePluginV2,
|
Type: plugin.RuntimePluginV2Service,
|
||||||
ID: "task",
|
ID: "task",
|
||||||
|
Requires: []plugin.Type{
|
||||||
|
plugin.RuntimePluginV2,
|
||||||
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
shimInstance, err := ic.GetByID(plugin.RuntimePluginV2, "shim")
|
shimInstance, err := ic.GetByID(plugin.RuntimePluginV2, "shim")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -417,7 +420,7 @@ func NewTaskManager(shims *ShimManager) *TaskManager {
|
|||||||
|
|
||||||
// ID of the task manager
|
// ID of the task manager
|
||||||
func (m *TaskManager) ID() string {
|
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
|
// Create launches new shim instance and creates new task
|
||||||
|
@ -81,7 +81,7 @@ func initFunc(ic *plugin.InitContext) (interface{}, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
v2r, err := ic.GetByID(plugin.RuntimePluginV2, "task")
|
v2r, err := ic.GetByID(plugin.RuntimePluginV2Service, "task")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
var tasksServiceRequires = []plugin.Type{
|
var tasksServiceRequires = []plugin.Type{
|
||||||
plugin.EventPlugin,
|
plugin.EventPlugin,
|
||||||
plugin.RuntimePluginV2,
|
plugin.RuntimePluginV2,
|
||||||
|
plugin.RuntimePluginV2Service,
|
||||||
plugin.MetadataPlugin,
|
plugin.MetadataPlugin,
|
||||||
plugin.TaskMonitorPlugin,
|
plugin.TaskMonitorPlugin,
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ var tasksServiceRequires = []plugin.Type{
|
|||||||
plugin.EventPlugin,
|
plugin.EventPlugin,
|
||||||
plugin.RuntimePlugin,
|
plugin.RuntimePlugin,
|
||||||
plugin.RuntimePluginV2,
|
plugin.RuntimePluginV2,
|
||||||
|
plugin.RuntimePluginV2Service,
|
||||||
plugin.MetadataPlugin,
|
plugin.MetadataPlugin,
|
||||||
plugin.TaskMonitorPlugin,
|
plugin.TaskMonitorPlugin,
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
var tasksServiceRequires = []plugin.Type{
|
var tasksServiceRequires = []plugin.Type{
|
||||||
plugin.EventPlugin,
|
plugin.EventPlugin,
|
||||||
plugin.RuntimePluginV2,
|
plugin.RuntimePluginV2,
|
||||||
|
plugin.RuntimePluginV2Service,
|
||||||
plugin.MetadataPlugin,
|
plugin.MetadataPlugin,
|
||||||
plugin.TaskMonitorPlugin,
|
plugin.TaskMonitorPlugin,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user