Skip to content

Commit

Permalink
Add plugin dependency between shim and shim services
Browse files Browse the repository at this point in the history
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
  • Loading branch information
mxpv committed Nov 1, 2021
1 parent fb5f6ce commit 33786ee
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions runtime/v2/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion services/tasks/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions services/tasks/local_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
var tasksServiceRequires = []plugin.Type{
plugin.EventPlugin,
plugin.RuntimePluginV2,
plugin.RuntimePluginV2Service,
plugin.MetadataPlugin,
plugin.TaskMonitorPlugin,
}
Expand Down
1 change: 1 addition & 0 deletions services/tasks/local_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var tasksServiceRequires = []plugin.Type{
plugin.EventPlugin,
plugin.RuntimePlugin,
plugin.RuntimePluginV2,
plugin.RuntimePluginV2Service,
plugin.MetadataPlugin,
plugin.TaskMonitorPlugin,
}
Expand Down
1 change: 1 addition & 0 deletions services/tasks/local_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
var tasksServiceRequires = []plugin.Type{
plugin.EventPlugin,
plugin.RuntimePluginV2,
plugin.RuntimePluginV2Service,
plugin.MetadataPlugin,
plugin.TaskMonitorPlugin,
}
Expand Down

0 comments on commit 33786ee

Please sign in to comment.