Skip to content

Commit 7163bfa

Browse files
committed
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>
1 parent dcba353 commit 7163bfa

2 files changed

Lines changed: 25 additions & 60 deletions

File tree

plugin.go

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -50,56 +50,6 @@ type Type string
5050

5151
func (t Type) String() string { return string(t) }
5252

53-
const (
54-
// InternalPlugin implements an internal plugin to containerd
55-
InternalPlugin Type = "io.containerd.internal.v1"
56-
// RuntimePlugin implements a runtime
57-
RuntimePlugin Type = "io.containerd.runtime.v1"
58-
// RuntimePluginV2 implements a runtime v2
59-
RuntimePluginV2 Type = "io.containerd.runtime.v2"
60-
// ServicePlugin implements a internal service
61-
ServicePlugin Type = "io.containerd.service.v1"
62-
// GRPCPlugin implements a grpc service
63-
GRPCPlugin Type = "io.containerd.grpc.v1"
64-
// TTRPCPlugin implements a ttrpc shim service
65-
TTRPCPlugin Type = "io.containerd.ttrpc.v1"
66-
// SnapshotPlugin implements a snapshotter
67-
SnapshotPlugin Type = "io.containerd.snapshotter.v1"
68-
// TaskMonitorPlugin implements a task monitor
69-
TaskMonitorPlugin Type = "io.containerd.monitor.v1"
70-
// DiffPlugin implements a differ
71-
DiffPlugin Type = "io.containerd.differ.v1"
72-
// MetadataPlugin implements a metadata store
73-
MetadataPlugin Type = "io.containerd.metadata.v1"
74-
// ContentPlugin implements a content store
75-
ContentPlugin Type = "io.containerd.content.v1"
76-
// GCPlugin implements garbage collection policy
77-
GCPlugin Type = "io.containerd.gc.v1"
78-
// EventPlugin implements event handling
79-
EventPlugin Type = "io.containerd.event.v1"
80-
// LeasePlugin implements lease manager
81-
LeasePlugin Type = "io.containerd.lease.v1"
82-
// StreamingPlugin implements a stream manager
83-
StreamingPlugin Type = "io.containerd.streaming.v1"
84-
// TracingProcessorPlugin implements a open telemetry span processor
85-
TracingProcessorPlugin Type = "io.containerd.tracing.processor.v1"
86-
// NRIApiPlugin implements the NRI adaptation interface for containerd.
87-
NRIApiPlugin Type = "io.containerd.nri.v1"
88-
// TransferPlugin implements a transfer service
89-
TransferPlugin Type = "io.containerd.transfer.v1"
90-
// SandboxStorePlugin implements a sandbox store
91-
SandboxStorePlugin Type = "io.containerd.sandbox.store.v1"
92-
// SandboxControllerPlugin implements a sandbox controller
93-
SandboxControllerPlugin Type = "io.containerd.sandbox.controller.v1"
94-
// ImageVerifierPlugin implements an image verifier service
95-
ImageVerifierPlugin Type = "io.containerd.image-verifier.v1"
96-
)
97-
98-
const (
99-
// RuntimeRuncV2 is the runc runtime that supports multiple containers per shim
100-
RuntimeRuncV2 = "io.containerd.runc.v2"
101-
)
102-
10353
// Registration contains information for registering a plugin
10454
type Registration struct {
10555
// Type of the plugin

plugin_test.go

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,39 @@ func mockPluginFilter(*Registration) bool {
3232
return false
3333
}
3434

35-
var tasksServiceRequires = []Type{
36-
RuntimePlugin,
37-
RuntimePluginV2,
38-
MetadataPlugin,
39-
TaskMonitorPlugin,
40-
}
41-
4235
// TestContainerdPlugin tests the logic of Graph, use the containerd's plugin
4336
func TestContainerdPlugin(t *testing.T) {
4437
registerClear()
38+
// Plugin types commonly used by containerd
39+
const (
40+
InternalPlugin Type = "io.containerd.internal.v1"
41+
RuntimePlugin Type = "io.containerd.runtime.v1"
42+
RuntimePluginV2 Type = "io.containerd.runtime.v2"
43+
ServicePlugin Type = "io.containerd.service.v1"
44+
GRPCPlugin Type = "io.containerd.grpc.v1"
45+
SnapshotPlugin Type = "io.containerd.snapshotter.v1"
46+
TaskMonitorPlugin Type = "io.containerd.monitor.v1"
47+
DiffPlugin Type = "io.containerd.differ.v1"
48+
MetadataPlugin Type = "io.containerd.metadata.v1"
49+
ContentPlugin Type = "io.containerd.content.v1"
50+
GCPlugin Type = "io.containerd.gc.v1"
51+
LeasePlugin Type = "io.containerd.lease.v1"
52+
TracingProcessorPlugin Type = "io.containerd.tracing.processor.v1"
53+
)
54+
4555
Register(&Registration{
4656
Type: TaskMonitorPlugin,
4757
ID: "cgroups",
4858
})
4959
Register(&Registration{
50-
Type: ServicePlugin,
51-
ID: services.TasksService,
52-
Requires: tasksServiceRequires,
60+
Type: ServicePlugin,
61+
ID: services.TasksService,
62+
Requires: []Type{
63+
RuntimePlugin,
64+
RuntimePluginV2,
65+
MetadataPlugin,
66+
TaskMonitorPlugin,
67+
},
5368
})
5469
Register(&Registration{
5570
Type: ServicePlugin,

0 commit comments

Comments
 (0)