Skip to content

Commit b857fe9

Browse files
committed
Add plugin dependency between shim and shim services
Signed-off-by: Maksym Pavlenko <[email protected]>
1 parent 07193fd commit b857fe9

6 files changed

Lines changed: 11 additions & 3 deletions

File tree

plugin/plugin.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ const (
5959
RuntimePlugin Type = "io.containerd.runtime.v1"
6060
// RuntimePluginV2 implements a runtime v2
6161
RuntimePluginV2 Type = "io.containerd.runtime.v2"
62+
// RuntimePluginV2Service is a shim provided service implemented on top of runtime v2 plugins.
63+
RuntimePluginV2Service Type = "io.containerd.runtime.v2.service"
6264
// ServicePlugin implements a internal service
6365
ServicePlugin Type = "io.containerd.service.v1"
6466
// GRPCPlugin implements a grpc service

runtime/v2/manager.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,11 @@ func init() {
8585
})
8686

8787
plugin.Register(&plugin.Registration{
88-
Type: plugin.RuntimePluginV2,
88+
Type: plugin.RuntimePluginV2Service,
8989
ID: "task",
90+
Requires: []plugin.Type{
91+
plugin.RuntimePluginV2,
92+
},
9093
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
9194
shimInstance, err := ic.GetByID(plugin.RuntimePluginV2, "shim")
9295
if err != nil {
@@ -382,7 +385,7 @@ func NewTaskManager(shims *ShimManager) *TaskManager {
382385

383386
// ID of the task manager
384387
func (m *TaskManager) ID() string {
385-
return fmt.Sprintf("%s.%s", plugin.RuntimePluginV2, "task")
388+
return fmt.Sprintf("%s.%s", plugin.RuntimePluginV2Service, "task")
386389
}
387390

388391
// Create launches new shim instance and creates new task

services/tasks/local.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func initFunc(ic *plugin.InitContext) (interface{}, error) {
8282
return nil, err
8383
}
8484

85-
v2r, err := ic.GetByID(plugin.RuntimePluginV2, "task")
85+
v2r, err := ic.GetByID(plugin.RuntimePluginV2Service, "task")
8686
if err != nil {
8787
return nil, err
8888
}

services/tasks/local_freebsd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
var tasksServiceRequires = []plugin.Type{
2525
plugin.EventPlugin,
2626
plugin.RuntimePluginV2,
27+
plugin.RuntimePluginV2Service,
2728
plugin.MetadataPlugin,
2829
plugin.TaskMonitorPlugin,
2930
}

services/tasks/local_unix.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var tasksServiceRequires = []plugin.Type{
3030
plugin.EventPlugin,
3131
plugin.RuntimePlugin,
3232
plugin.RuntimePluginV2,
33+
plugin.RuntimePluginV2Service,
3334
plugin.MetadataPlugin,
3435
plugin.TaskMonitorPlugin,
3536
}

services/tasks/local_windows.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
var tasksServiceRequires = []plugin.Type{
2525
plugin.EventPlugin,
2626
plugin.RuntimePluginV2,
27+
plugin.RuntimePluginV2Service,
2728
plugin.MetadataPlugin,
2829
plugin.TaskMonitorPlugin,
2930
}

0 commit comments

Comments
 (0)