Move plugin type definitions to containerd plugins package

The plugins packages defines the plugins used by containerd.
Move all the types and properties to this package.

Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
Derek McGowan
2023-10-12 15:31:45 -07:00
parent cb969085f5
commit a80606bc2d
74 changed files with 429 additions and 314 deletions

View File

@@ -50,56 +50,6 @@ type Type string
func (t Type) String() string { return string(t) }
const (
// InternalPlugin implements an internal plugin to containerd
InternalPlugin Type = "io.containerd.internal.v1"
// RuntimePlugin implements a runtime
RuntimePlugin Type = "io.containerd.runtime.v1"
// RuntimePluginV2 implements a runtime v2
RuntimePluginV2 Type = "io.containerd.runtime.v2"
// ServicePlugin implements a internal service
ServicePlugin Type = "io.containerd.service.v1"
// GRPCPlugin implements a grpc service
GRPCPlugin Type = "io.containerd.grpc.v1"
// TTRPCPlugin implements a ttrpc shim service
TTRPCPlugin Type = "io.containerd.ttrpc.v1"
// SnapshotPlugin implements a snapshotter
SnapshotPlugin Type = "io.containerd.snapshotter.v1"
// TaskMonitorPlugin implements a task monitor
TaskMonitorPlugin Type = "io.containerd.monitor.v1"
// DiffPlugin implements a differ
DiffPlugin Type = "io.containerd.differ.v1"
// MetadataPlugin implements a metadata store
MetadataPlugin Type = "io.containerd.metadata.v1"
// ContentPlugin implements a content store
ContentPlugin Type = "io.containerd.content.v1"
// GCPlugin implements garbage collection policy
GCPlugin Type = "io.containerd.gc.v1"
// EventPlugin implements event handling
EventPlugin Type = "io.containerd.event.v1"
// LeasePlugin implements lease manager
LeasePlugin Type = "io.containerd.lease.v1"
// StreamingPlugin implements a stream manager
StreamingPlugin Type = "io.containerd.streaming.v1"
// TracingProcessorPlugin implements a open telemetry span processor
TracingProcessorPlugin Type = "io.containerd.tracing.processor.v1"
// NRIApiPlugin implements the NRI adaptation interface for containerd.
NRIApiPlugin Type = "io.containerd.nri.v1"
// TransferPlugin implements a transfer service
TransferPlugin Type = "io.containerd.transfer.v1"
// SandboxStorePlugin implements a sandbox store
SandboxStorePlugin Type = "io.containerd.sandbox.store.v1"
// SandboxControllerPlugin implements a sandbox controller
SandboxControllerPlugin Type = "io.containerd.sandbox.controller.v1"
// ImageVerifierPlugin implements an image verifier service
ImageVerifierPlugin Type = "io.containerd.image-verifier.v1"
)
const (
// RuntimeRuncV2 is the runc runtime that supports multiple containers per shim
RuntimeRuncV2 = "io.containerd.runc.v2"
)
// Registration contains information for registering a plugin
type Registration struct {
// Type of the plugin

View File

@@ -32,24 +32,39 @@ func mockPluginFilter(*Registration) bool {
return false
}
var tasksServiceRequires = []Type{
RuntimePlugin,
RuntimePluginV2,
MetadataPlugin,
TaskMonitorPlugin,
}
// TestContainerdPlugin tests the logic of Graph, use the containerd's plugin
func TestContainerdPlugin(t *testing.T) {
registerClear()
// Plugin types commonly used by containerd
const (
InternalPlugin Type = "io.containerd.internal.v1"
RuntimePlugin Type = "io.containerd.runtime.v1"
RuntimePluginV2 Type = "io.containerd.runtime.v2"
ServicePlugin Type = "io.containerd.service.v1"
GRPCPlugin Type = "io.containerd.grpc.v1"
SnapshotPlugin Type = "io.containerd.snapshotter.v1"
TaskMonitorPlugin Type = "io.containerd.monitor.v1"
DiffPlugin Type = "io.containerd.differ.v1"
MetadataPlugin Type = "io.containerd.metadata.v1"
ContentPlugin Type = "io.containerd.content.v1"
GCPlugin Type = "io.containerd.gc.v1"
LeasePlugin Type = "io.containerd.lease.v1"
TracingProcessorPlugin Type = "io.containerd.tracing.processor.v1"
)
Register(&Registration{
Type: TaskMonitorPlugin,
ID: "cgroups",
})
Register(&Registration{
Type: ServicePlugin,
ID: services.TasksService,
Requires: tasksServiceRequires,
Type: ServicePlugin,
ID: services.TasksService,
Requires: []Type{
RuntimePlugin,
RuntimePluginV2,
MetadataPlugin,
TaskMonitorPlugin,
},
})
Register(&Registration{
Type: ServicePlugin,