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:
parent
cb969085f5
commit
a80606bc2d
@ -52,7 +52,7 @@ import (
|
|||||||
"github.com/containerd/containerd/namespaces"
|
"github.com/containerd/containerd/namespaces"
|
||||||
"github.com/containerd/containerd/pkg/dialer"
|
"github.com/containerd/containerd/pkg/dialer"
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugins"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
"github.com/containerd/containerd/remotes"
|
"github.com/containerd/containerd/remotes"
|
||||||
"github.com/containerd/containerd/remotes/docker"
|
"github.com/containerd/containerd/remotes/docker"
|
||||||
@ -185,7 +185,7 @@ func NewWithConn(conn *grpc.ClientConn, opts ...ClientOpt) (*Client, error) {
|
|||||||
c := &Client{
|
c := &Client{
|
||||||
defaultns: copts.defaultns,
|
defaultns: copts.defaultns,
|
||||||
conn: conn,
|
conn: conn,
|
||||||
runtime: plugin.RuntimePlugin.String() + "." + runtime.GOOS,
|
runtime: plugins.RuntimePlugin.String() + "." + runtime.GOOS,
|
||||||
}
|
}
|
||||||
|
|
||||||
if copts.defaultPlatform != nil {
|
if copts.defaultPlatform != nil {
|
||||||
@ -826,7 +826,7 @@ func (c *Client) getSnapshotter(ctx context.Context, name string) (snapshots.Sna
|
|||||||
// GetSnapshotterSupportedPlatforms returns a platform matchers which represents the
|
// GetSnapshotterSupportedPlatforms returns a platform matchers which represents the
|
||||||
// supported platforms for the given snapshotters
|
// supported platforms for the given snapshotters
|
||||||
func (c *Client) GetSnapshotterSupportedPlatforms(ctx context.Context, snapshotterName string) (platforms.MatchComparer, error) {
|
func (c *Client) GetSnapshotterSupportedPlatforms(ctx context.Context, snapshotterName string) (platforms.MatchComparer, error) {
|
||||||
filters := []string{fmt.Sprintf("type==%s, id==%s", plugin.SnapshotPlugin, snapshotterName)}
|
filters := []string{fmt.Sprintf("type==%s, id==%s", plugins.SnapshotPlugin, snapshotterName)}
|
||||||
in := c.IntrospectionService()
|
in := c.IntrospectionService()
|
||||||
|
|
||||||
resp, err := in.Plugins(ctx, filters)
|
resp, err := in.Plugins(ctx, filters)
|
||||||
@ -857,7 +857,7 @@ func toPlatforms(pt []*apitypes.Platform) []ocispec.Platform {
|
|||||||
|
|
||||||
// GetSnapshotterCapabilities returns the capabilities of a snapshotter.
|
// GetSnapshotterCapabilities returns the capabilities of a snapshotter.
|
||||||
func (c *Client) GetSnapshotterCapabilities(ctx context.Context, snapshotterName string) ([]string, error) {
|
func (c *Client) GetSnapshotterCapabilities(ctx context.Context, snapshotterName string) ([]string, error) {
|
||||||
filters := []string{fmt.Sprintf("type==%s, id==%s", plugin.SnapshotPlugin, snapshotterName)}
|
filters := []string{fmt.Sprintf("type==%s, id==%s", plugins.SnapshotPlugin, snapshotterName)}
|
||||||
in := c.IntrospectionService()
|
in := c.IntrospectionService()
|
||||||
|
|
||||||
resp, err := in.Plugins(ctx, filters)
|
resp, err := in.Plugins(ctx, filters)
|
||||||
|
@ -31,7 +31,7 @@ import (
|
|||||||
"github.com/containerd/containerd"
|
"github.com/containerd/containerd"
|
||||||
"github.com/containerd/containerd/integration/remote"
|
"github.com/containerd/containerd/integration/remote"
|
||||||
"github.com/containerd/containerd/namespaces"
|
"github.com/containerd/containerd/namespaces"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
metrics "github.com/docker/go-metrics"
|
metrics "github.com/docker/go-metrics"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
@ -167,7 +167,7 @@ func main() {
|
|||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "runtime",
|
Name: "runtime",
|
||||||
Usage: "Set the runtime to stress test",
|
Usage: "Set the runtime to stress test",
|
||||||
Value: plugin.RuntimeRuncV2,
|
Value: plugins.RuntimeRuncV2,
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "snapshotter",
|
Name: "snapshotter",
|
||||||
|
@ -36,6 +36,7 @@ import (
|
|||||||
"github.com/containerd/containerd/metadata"
|
"github.com/containerd/containerd/metadata"
|
||||||
"github.com/containerd/containerd/mount"
|
"github.com/containerd/containerd/mount"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
@ -48,13 +49,13 @@ const (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.DiffPlugin,
|
Type: plugins.DiffPlugin,
|
||||||
ID: "windows-lcow",
|
ID: "windows-lcow",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
md, err := ic.Get(plugin.MetadataPlugin)
|
md, err := ic.Get(plugins.MetadataPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -23,17 +23,18 @@ import (
|
|||||||
"github.com/containerd/containerd/metadata"
|
"github.com/containerd/containerd/metadata"
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.DiffPlugin,
|
Type: plugins.DiffPlugin,
|
||||||
ID: "walking",
|
ID: "walking",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
md, err := ic.Get(plugin.MetadataPlugin)
|
md, err := ic.Get(plugins.MetadataPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ import (
|
|||||||
"github.com/containerd/containerd/pkg/epoch"
|
"github.com/containerd/containerd/pkg/epoch"
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
@ -46,13 +47,13 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.DiffPlugin,
|
Type: plugins.DiffPlugin,
|
||||||
ID: "windows",
|
ID: "windows",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
md, err := ic.Get(plugin.MetadataPlugin)
|
md, err := ic.Get(plugins.MetadataPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,12 @@ package plugin
|
|||||||
import (
|
import (
|
||||||
"github.com/containerd/containerd/events/exchange"
|
"github.com/containerd/containerd/events/exchange"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.EventPlugin,
|
Type: plugins.EventPlugin,
|
||||||
ID: "exchange",
|
ID: "exchange",
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
return exchange.NewExchange(), nil
|
return exchange.NewExchange(), nil
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/gc"
|
"github.com/containerd/containerd/gc"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -97,10 +98,10 @@ func (d duration) MarshalText() (text []byte, err error) {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GCPlugin,
|
Type: plugins.GCPlugin,
|
||||||
ID: "scheduler",
|
ID: "scheduler",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
},
|
},
|
||||||
Config: &config{
|
Config: &config{
|
||||||
PauseThreshold: 0.02,
|
PauseThreshold: 0.02,
|
||||||
@ -110,14 +111,14 @@ func init() {
|
|||||||
StartupDelay: duration(100 * time.Millisecond),
|
StartupDelay: duration(100 * time.Millisecond),
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
md, err := ic.Get(plugin.MetadataPlugin)
|
md, err := ic.Get(plugins.MetadataPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
mdCollector, ok := md.(collector)
|
mdCollector, ok := md.(collector)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("%s %T must implement collector", plugin.MetadataPlugin, md)
|
return nil, fmt.Errorf("%s %T must implement collector", plugins.MetadataPlugin, md)
|
||||||
}
|
}
|
||||||
|
|
||||||
m := newScheduler(mdCollector, ic.Config.(*config))
|
m := newScheduler(mdCollector, ic.Config.(*config))
|
||||||
|
@ -38,7 +38,7 @@ import (
|
|||||||
"github.com/containerd/containerd/containers"
|
"github.com/containerd/containerd/containers"
|
||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/oci"
|
"github.com/containerd/containerd/oci"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/runtime/v2/runc/options"
|
"github.com/containerd/containerd/runtime/v2/runc/options"
|
||||||
"github.com/containerd/containerd/sys"
|
"github.com/containerd/containerd/sys"
|
||||||
|
|
||||||
@ -1028,7 +1028,7 @@ func TestContainerRuntimeOptionsv2(t *testing.T) {
|
|||||||
ctx, id,
|
ctx, id,
|
||||||
WithNewSnapshot(id, image),
|
WithNewSnapshot(id, image),
|
||||||
WithNewSpec(oci.WithImageConfig(image), withExitStatus(7)),
|
WithNewSpec(oci.WithImageConfig(image), withExitStatus(7)),
|
||||||
WithRuntime(plugin.RuntimeRuncV2, &options.Options{BinaryName: "no-runc"}),
|
WithRuntime(plugins.RuntimeRuncV2, &options.Options{BinaryName: "no-runc"}),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -39,7 +39,7 @@ import (
|
|||||||
"github.com/containerd/containerd/namespaces"
|
"github.com/containerd/containerd/namespaces"
|
||||||
"github.com/containerd/containerd/oci"
|
"github.com/containerd/containerd/oci"
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugins"
|
||||||
gogotypes "github.com/containerd/containerd/protobuf/types"
|
gogotypes "github.com/containerd/containerd/protobuf/types"
|
||||||
_ "github.com/containerd/containerd/runtime"
|
_ "github.com/containerd/containerd/runtime"
|
||||||
"github.com/containerd/containerd/runtime/v2/runc/options"
|
"github.com/containerd/containerd/runtime/v2/runc/options"
|
||||||
@ -172,7 +172,7 @@ func TestContainerStart(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func readShimPath(taskID string) (string, error) {
|
func readShimPath(taskID string) (string, error) {
|
||||||
runtime := plugin.RuntimePluginV2.String() + ".task"
|
runtime := plugins.RuntimePluginV2.String() + ".task"
|
||||||
shimBinaryNamePath := filepath.Join(defaultState, runtime, testNamespace, taskID, "shim-binary-path")
|
shimBinaryNamePath := filepath.Join(defaultState, runtime, testNamespace, taskID, "shim-binary-path")
|
||||||
|
|
||||||
shimPath, err := os.ReadFile(shimBinaryNamePath)
|
shimPath, err := os.ReadFile(shimBinaryNamePath)
|
||||||
|
@ -29,7 +29,7 @@ import (
|
|||||||
"github.com/containerd/cgroups/v3"
|
"github.com/containerd/cgroups/v3"
|
||||||
. "github.com/containerd/containerd"
|
. "github.com/containerd/containerd"
|
||||||
"github.com/containerd/containerd/oci"
|
"github.com/containerd/containerd/oci"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/runtime/v2/runc/options"
|
"github.com/containerd/containerd/runtime/v2/runc/options"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ version = 2
|
|||||||
}
|
}
|
||||||
|
|
||||||
id := t.Name()
|
id := t.Name()
|
||||||
container, err := client.NewContainer(ctx, id, WithNewSnapshot(id, image), WithNewSpec(oci.WithImageConfig(image), withProcessArgs("top")), WithRuntime(plugin.RuntimeRuncV2, &options.Options{
|
container, err := client.NewContainer(ctx, id, WithNewSnapshot(id, image), WithNewSpec(oci.WithImageConfig(image), withProcessArgs("top")), WithRuntime(plugins.RuntimeRuncV2, &options.Options{
|
||||||
Root: runtimeRoot,
|
Root: runtimeRoot,
|
||||||
}))
|
}))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -28,6 +28,7 @@ import (
|
|||||||
"github.com/containerd/containerd/pkg/failpoint"
|
"github.com/containerd/containerd/pkg/failpoint"
|
||||||
"github.com/containerd/containerd/pkg/shutdown"
|
"github.com/containerd/containerd/pkg/shutdown"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/runtime/v2/runc/task"
|
"github.com/containerd/containerd/runtime/v2/runc/task"
|
||||||
"github.com/containerd/containerd/runtime/v2/shim"
|
"github.com/containerd/containerd/runtime/v2/shim"
|
||||||
"github.com/containerd/ttrpc"
|
"github.com/containerd/ttrpc"
|
||||||
@ -39,18 +40,18 @@ const (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.TTRPCPlugin,
|
Type: plugins.TTRPCPlugin,
|
||||||
ID: "task",
|
ID: "task",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
plugin.InternalPlugin,
|
plugins.InternalPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
pp, err := ic.GetByID(plugin.EventPlugin, "publisher")
|
pp, err := ic.GetByID(plugins.EventPlugin, "publisher")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ss, err := ic.GetByID(plugin.InternalPlugin, "shutdown")
|
ss, err := ic.GetByID(plugins.InternalPlugin, "shutdown")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -23,22 +23,23 @@ import (
|
|||||||
"github.com/containerd/containerd/leases"
|
"github.com/containerd/containerd/leases"
|
||||||
"github.com/containerd/containerd/metadata"
|
"github.com/containerd/containerd/metadata"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.LeasePlugin,
|
Type: plugins.LeasePlugin,
|
||||||
ID: "manager",
|
ID: "manager",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
plugin.GCPlugin,
|
plugins.GCPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
m, err := ic.Get(plugin.MetadataPlugin)
|
m, err := ic.Get(plugins.MetadataPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
g, err := ic.Get(plugin.GCPlugin)
|
g, err := ic.Get(plugins.GCPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import (
|
|||||||
"github.com/containerd/containerd/metadata"
|
"github.com/containerd/containerd/metadata"
|
||||||
"github.com/containerd/containerd/pkg/timeout"
|
"github.com/containerd/containerd/pkg/timeout"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/snapshots"
|
"github.com/containerd/containerd/snapshots"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
|
||||||
@ -82,12 +83,12 @@ func (bc *BoltConfig) Validate() error {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.MetadataPlugin,
|
Type: plugins.MetadataPlugin,
|
||||||
ID: "bolt",
|
ID: "bolt",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.ContentPlugin,
|
plugins.ContentPlugin,
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
plugin.SnapshotPlugin,
|
plugins.SnapshotPlugin,
|
||||||
},
|
},
|
||||||
Config: &BoltConfig{
|
Config: &BoltConfig{
|
||||||
ContentSharingPolicy: SharingPolicyShared,
|
ContentSharingPolicy: SharingPolicyShared,
|
||||||
@ -96,12 +97,12 @@ func init() {
|
|||||||
if err := os.MkdirAll(ic.Root, 0711); err != nil {
|
if err := os.MkdirAll(ic.Root, 0711); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
cs, err := ic.Get(plugin.ContentPlugin)
|
cs, err := ic.Get(plugins.ContentPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
snapshottersRaw, err := ic.GetByType(plugin.SnapshotPlugin)
|
snapshottersRaw, err := ic.GetByType(plugins.SnapshotPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -119,7 +120,7 @@ func init() {
|
|||||||
snapshotters[name] = sn.(snapshots.Snapshotter)
|
snapshotters[name] = sn.(snapshots.Snapshotter)
|
||||||
}
|
}
|
||||||
|
|
||||||
ep, err := ic.Get(plugin.EventPlugin)
|
ep, err := ic.Get(plugins.EventPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
v2 "github.com/containerd/containerd/metrics/cgroups/v2"
|
v2 "github.com/containerd/containerd/metrics/cgroups/v2"
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/runtime"
|
"github.com/containerd/containerd/runtime"
|
||||||
metrics "github.com/docker/go-metrics"
|
metrics "github.com/docker/go-metrics"
|
||||||
)
|
)
|
||||||
@ -36,11 +37,11 @@ type Config struct {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.TaskMonitorPlugin,
|
Type: plugins.TaskMonitorPlugin,
|
||||||
ID: "cgroups",
|
ID: "cgroups",
|
||||||
InitFn: New,
|
InitFn: New,
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
},
|
},
|
||||||
Config: &Config{},
|
Config: &Config{},
|
||||||
})
|
})
|
||||||
@ -58,7 +59,7 @@ func New(ic *plugin.InitContext) (interface{}, error) {
|
|||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
ep, err := ic.Get(plugin.EventPlugin)
|
ep, err := ic.Get(plugins.EventPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
nriservice "github.com/containerd/containerd/pkg/nri"
|
nriservice "github.com/containerd/containerd/pkg/nri"
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
@ -39,13 +40,13 @@ import (
|
|||||||
func init() {
|
func init() {
|
||||||
config := criconfig.DefaultConfig()
|
config := criconfig.DefaultConfig()
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GRPCPlugin,
|
Type: plugins.GRPCPlugin,
|
||||||
ID: "cri",
|
ID: "cri",
|
||||||
Config: &config,
|
Config: &config,
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
plugin.ServicePlugin,
|
plugins.ServicePlugin,
|
||||||
plugin.NRIApiPlugin,
|
plugins.NRIApiPlugin,
|
||||||
},
|
},
|
||||||
InitFn: initCRIService,
|
InitFn: initCRIService,
|
||||||
})
|
})
|
||||||
@ -125,7 +126,7 @@ func setGLogLevel() error {
|
|||||||
// Get the NRI plugin, and set up our NRI API for it.
|
// Get the NRI plugin, and set up our NRI API for it.
|
||||||
func getNRIAPI(ic *plugin.InitContext) *nri.API {
|
func getNRIAPI(ic *plugin.InitContext) *nri.API {
|
||||||
const (
|
const (
|
||||||
pluginType = plugin.NRIApiPlugin
|
pluginType = plugins.NRIApiPlugin
|
||||||
pluginName = "nri"
|
pluginName = "nri"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ import (
|
|||||||
containerstore "github.com/containerd/containerd/pkg/cri/store/container"
|
containerstore "github.com/containerd/containerd/pkg/cri/store/container"
|
||||||
imagestore "github.com/containerd/containerd/pkg/cri/store/image"
|
imagestore "github.com/containerd/containerd/pkg/cri/store/image"
|
||||||
runtimeoptions "github.com/containerd/containerd/pkg/runtimeoptions/v1"
|
runtimeoptions "github.com/containerd/containerd/pkg/runtimeoptions/v1"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugins"
|
||||||
runcoptions "github.com/containerd/containerd/runtime/v2/runc/options"
|
runcoptions "github.com/containerd/containerd/runtime/v2/runc/options"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
)
|
)
|
||||||
@ -289,7 +289,7 @@ func generateRuntimeOptions(r criconfig.Runtime) (interface{}, error) {
|
|||||||
// getRuntimeOptionsType gets empty runtime options by the runtime type name.
|
// getRuntimeOptionsType gets empty runtime options by the runtime type name.
|
||||||
func getRuntimeOptionsType(t string) interface{} {
|
func getRuntimeOptionsType(t string) interface{} {
|
||||||
switch t {
|
switch t {
|
||||||
case plugin.RuntimeRuncV2:
|
case plugins.RuntimeRuncV2:
|
||||||
return &runcoptions.Options{}
|
return &runcoptions.Options{}
|
||||||
case runtimeRunhcsV1:
|
case runtimeRunhcsV1:
|
||||||
return &runhcsoptions.Options{}
|
return &runhcsoptions.Options{}
|
||||||
|
@ -30,7 +30,7 @@ import (
|
|||||||
"github.com/containerd/containerd/oci"
|
"github.com/containerd/containerd/oci"
|
||||||
criconfig "github.com/containerd/containerd/pkg/cri/config"
|
criconfig "github.com/containerd/containerd/pkg/cri/config"
|
||||||
containerstore "github.com/containerd/containerd/pkg/cri/store/container"
|
containerstore "github.com/containerd/containerd/pkg/cri/store/container"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/protobuf/types"
|
"github.com/containerd/containerd/protobuf/types"
|
||||||
runcoptions "github.com/containerd/containerd/runtime/v2/runc/options"
|
runcoptions "github.com/containerd/containerd/runtime/v2/runc/options"
|
||||||
"github.com/containerd/typeurl/v2"
|
"github.com/containerd/typeurl/v2"
|
||||||
@ -119,7 +119,7 @@ systemd_cgroup = true
|
|||||||
no_pivot = true
|
no_pivot = true
|
||||||
default_runtime_name = "default"
|
default_runtime_name = "default"
|
||||||
[containerd.runtimes.runcv2]
|
[containerd.runtimes.runcv2]
|
||||||
runtime_type = "` + plugin.RuntimeRuncV2 + `"
|
runtime_type = "` + plugins.RuntimeRuncV2 + `"
|
||||||
`
|
`
|
||||||
nonNilOpts := `
|
nonNilOpts := `
|
||||||
systemd_cgroup = true
|
systemd_cgroup = true
|
||||||
@ -134,7 +134,7 @@ systemd_cgroup = true
|
|||||||
Root = "/runc"
|
Root = "/runc"
|
||||||
NoNewKeyring = true
|
NoNewKeyring = true
|
||||||
[containerd.runtimes.runcv2]
|
[containerd.runtimes.runcv2]
|
||||||
runtime_type = "` + plugin.RuntimeRuncV2 + `"
|
runtime_type = "` + plugins.RuntimeRuncV2 + `"
|
||||||
[containerd.runtimes.runcv2.options]
|
[containerd.runtimes.runcv2.options]
|
||||||
BinaryName = "runc"
|
BinaryName = "runc"
|
||||||
Root = "/runcv2"
|
Root = "/runcv2"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
|
|
||||||
criconfig "github.com/containerd/containerd/pkg/cri/config"
|
criconfig "github.com/containerd/containerd/pkg/cri/config"
|
||||||
"github.com/containerd/containerd/pkg/systemd"
|
"github.com/containerd/containerd/pkg/systemd"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||||
)
|
)
|
||||||
@ -30,7 +30,7 @@ import (
|
|||||||
func newFakeRuntimeConfig(runcV2, systemdCgroup bool) criconfig.Runtime {
|
func newFakeRuntimeConfig(runcV2, systemdCgroup bool) criconfig.Runtime {
|
||||||
r := criconfig.Runtime{Type: "default", Options: map[string]interface{}{}}
|
r := criconfig.Runtime{Type: "default", Options: map[string]interface{}{}}
|
||||||
if runcV2 {
|
if runcV2 {
|
||||||
r.Type = plugin.RuntimeRuncV2
|
r.Type = plugins.RuntimeRuncV2
|
||||||
if systemdCgroup {
|
if systemdCgroup {
|
||||||
r.Options["SystemdCgroup"] = true
|
r.Options["SystemdCgroup"] = true
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ import (
|
|||||||
imagestore "github.com/containerd/containerd/pkg/cri/store/image"
|
imagestore "github.com/containerd/containerd/pkg/cri/store/image"
|
||||||
snapshotstore "github.com/containerd/containerd/pkg/cri/store/snapshot"
|
snapshotstore "github.com/containerd/containerd/pkg/cri/store/snapshot"
|
||||||
"github.com/containerd/containerd/pkg/cri/streaming"
|
"github.com/containerd/containerd/pkg/cri/streaming"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/sandbox"
|
"github.com/containerd/containerd/sandbox"
|
||||||
"github.com/containerd/go-cni"
|
"github.com/containerd/go-cni"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
@ -350,7 +350,7 @@ func (c *criService) register(s *grpc.Server) error {
|
|||||||
// imageFSPath returns containerd image filesystem path.
|
// imageFSPath returns containerd image filesystem path.
|
||||||
// Note that if containerd changes directory layout, we also needs to change this.
|
// Note that if containerd changes directory layout, we also needs to change this.
|
||||||
func imageFSPath(rootDir, snapshotter string) string {
|
func imageFSPath(rootDir, snapshotter string) string {
|
||||||
return filepath.Join(rootDir, plugin.SnapshotPlugin.String()+"."+snapshotter)
|
return filepath.Join(rootDir, plugins.SnapshotPlugin.String()+"."+snapshotter)
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadOCISpec(filename string) (*oci.Spec, error) {
|
func loadOCISpec(filename string) (*oci.Spec, error) {
|
||||||
|
@ -19,11 +19,12 @@ package plugin
|
|||||||
import (
|
import (
|
||||||
"github.com/containerd/containerd/pkg/nri"
|
"github.com/containerd/containerd/pkg/nri"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.NRIApiPlugin,
|
Type: plugins.NRIApiPlugin,
|
||||||
ID: "nri",
|
ID: "nri",
|
||||||
Config: nri.DefaultConfig(),
|
Config: nri.DefaultConfig(),
|
||||||
InitFn: initFunc,
|
InitFn: initFunc,
|
||||||
|
@ -50,56 +50,6 @@ type Type string
|
|||||||
|
|
||||||
func (t Type) String() string { return string(t) }
|
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
|
// Registration contains information for registering a plugin
|
||||||
type Registration struct {
|
type Registration struct {
|
||||||
// Type of the plugin
|
// Type of the plugin
|
||||||
|
@ -32,24 +32,39 @@ func mockPluginFilter(*Registration) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
var tasksServiceRequires = []Type{
|
|
||||||
RuntimePlugin,
|
|
||||||
RuntimePluginV2,
|
|
||||||
MetadataPlugin,
|
|
||||||
TaskMonitorPlugin,
|
|
||||||
}
|
|
||||||
|
|
||||||
// TestContainerdPlugin tests the logic of Graph, use the containerd's plugin
|
// TestContainerdPlugin tests the logic of Graph, use the containerd's plugin
|
||||||
func TestContainerdPlugin(t *testing.T) {
|
func TestContainerdPlugin(t *testing.T) {
|
||||||
registerClear()
|
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{
|
Register(&Registration{
|
||||||
Type: TaskMonitorPlugin,
|
Type: TaskMonitorPlugin,
|
||||||
ID: "cgroups",
|
ID: "cgroups",
|
||||||
})
|
})
|
||||||
Register(&Registration{
|
Register(&Registration{
|
||||||
Type: ServicePlugin,
|
Type: ServicePlugin,
|
||||||
ID: services.TasksService,
|
ID: services.TasksService,
|
||||||
Requires: tasksServiceRequires,
|
Requires: []Type{
|
||||||
|
RuntimePlugin,
|
||||||
|
RuntimePluginV2,
|
||||||
|
MetadataPlugin,
|
||||||
|
TaskMonitorPlugin,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
Register(&Registration{
|
Register(&Registration{
|
||||||
Type: ServicePlugin,
|
Type: ServicePlugin,
|
||||||
|
@ -22,12 +22,13 @@ import (
|
|||||||
"github.com/containerd/containerd/pkg/imageverifier/bindir"
|
"github.com/containerd/containerd/pkg/imageverifier/bindir"
|
||||||
"github.com/containerd/containerd/pkg/tomlext"
|
"github.com/containerd/containerd/pkg/tomlext"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Register default image verifier service plugin
|
// Register default image verifier service plugin
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.ImageVerifierPlugin,
|
Type: plugins.ImageVerifierPlugin,
|
||||||
ID: "bindir",
|
ID: "bindir",
|
||||||
Config: defaultConfig(),
|
Config: defaultConfig(),
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
|
@ -29,6 +29,7 @@ import (
|
|||||||
"github.com/containerd/containerd/mount"
|
"github.com/containerd/containerd/mount"
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/runtime"
|
"github.com/containerd/containerd/runtime"
|
||||||
v2 "github.com/containerd/containerd/runtime/v2"
|
v2 "github.com/containerd/containerd/runtime/v2"
|
||||||
"github.com/containerd/containerd/sandbox"
|
"github.com/containerd/containerd/sandbox"
|
||||||
@ -39,25 +40,25 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.SandboxControllerPlugin,
|
Type: plugins.SandboxControllerPlugin,
|
||||||
ID: "local",
|
ID: "local",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.RuntimePluginV2,
|
plugins.RuntimePluginV2,
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
plugin.SandboxStorePlugin,
|
plugins.SandboxStorePlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
shimPlugin, err := ic.GetByID(plugin.RuntimePluginV2, "shim")
|
shimPlugin, err := ic.GetByID(plugins.RuntimePluginV2, "shim")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
exchangePlugin, err := ic.GetByID(plugin.EventPlugin, "exchange")
|
exchangePlugin, err := ic.GetByID(plugins.EventPlugin, "exchange")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
sbPlugin, err := ic.GetByID(plugin.SandboxStorePlugin, "local")
|
sbPlugin, err := ic.GetByID(plugins.SandboxStorePlugin, "local")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -19,17 +19,18 @@ package sandbox
|
|||||||
import (
|
import (
|
||||||
"github.com/containerd/containerd/metadata"
|
"github.com/containerd/containerd/metadata"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.SandboxStorePlugin,
|
Type: plugins.SandboxStorePlugin,
|
||||||
ID: "local",
|
ID: "local",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
m, err := ic.Get(plugin.MetadataPlugin)
|
m, err := ic.Get(plugins.MetadataPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -28,17 +28,18 @@ import (
|
|||||||
"github.com/containerd/containerd/namespaces"
|
"github.com/containerd/containerd/namespaces"
|
||||||
"github.com/containerd/containerd/pkg/streaming"
|
"github.com/containerd/containerd/pkg/streaming"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.StreamingPlugin,
|
Type: plugins.StreamingPlugin,
|
||||||
ID: "manager",
|
ID: "manager",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
md, err := ic.Get(plugin.MetadataPlugin)
|
md, err := ic.Get(plugins.MetadataPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import (
|
|||||||
"github.com/containerd/containerd/pkg/unpack"
|
"github.com/containerd/containerd/pkg/unpack"
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
|
|
||||||
// Load packages with type registrations
|
// Load packages with type registrations
|
||||||
@ -40,29 +41,29 @@ import (
|
|||||||
// Register local transfer service plugin
|
// Register local transfer service plugin
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.TransferPlugin,
|
Type: plugins.TransferPlugin,
|
||||||
ID: "local",
|
ID: "local",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.LeasePlugin,
|
plugins.LeasePlugin,
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
plugin.DiffPlugin,
|
plugins.DiffPlugin,
|
||||||
plugin.ImageVerifierPlugin,
|
plugins.ImageVerifierPlugin,
|
||||||
},
|
},
|
||||||
Config: defaultConfig(),
|
Config: defaultConfig(),
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
config := ic.Config.(*transferConfig)
|
config := ic.Config.(*transferConfig)
|
||||||
m, err := ic.Get(plugin.MetadataPlugin)
|
m, err := ic.Get(plugins.MetadataPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ms := m.(*metadata.DB)
|
ms := m.(*metadata.DB)
|
||||||
l, err := ic.Get(plugin.LeasePlugin)
|
l, err := ic.Get(plugins.LeasePlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
vfs := make(map[string]imageverifier.ImageVerifier)
|
vfs := make(map[string]imageverifier.ImageVerifier)
|
||||||
vps, err := ic.GetByType(plugin.ImageVerifierPlugin)
|
vps, err := ic.GetByType(plugins.ImageVerifierPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -82,7 +83,7 @@ func init() {
|
|||||||
for _, uc := range config.UnpackConfiguration {
|
for _, uc := range config.UnpackConfiguration {
|
||||||
p, err := platforms.Parse(uc.Platform)
|
p, err := platforms.Parse(uc.Platform)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("%s: platform configuration %v invalid", plugin.TransferPlugin, uc.Platform)
|
return nil, fmt.Errorf("%s: platform configuration %v invalid", plugins.TransferPlugin, uc.Platform)
|
||||||
}
|
}
|
||||||
|
|
||||||
sn := ms.Snapshotter(uc.Snapshotter)
|
sn := ms.Snapshotter(uc.Snapshotter)
|
||||||
@ -90,7 +91,7 @@ func init() {
|
|||||||
return nil, fmt.Errorf("snapshotter %q not found: %w", uc.Snapshotter, errdefs.ErrNotFound)
|
return nil, fmt.Errorf("snapshotter %q not found: %w", uc.Snapshotter, errdefs.ErrNotFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
diffPlugins, err := ic.GetByType(plugin.DiffPlugin)
|
diffPlugins, err := ic.GetByType(plugins.DiffPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error loading diff plugins: %w", err)
|
return nil, fmt.Errorf("error loading diff plugins: %w", err)
|
||||||
}
|
}
|
||||||
|
84
plugins/types.go
Normal file
84
plugins/types.go
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// plugins package stores all the plugin types used by containerd internally.
|
||||||
|
//
|
||||||
|
// External plugins should copy from these types and avoid importing this
|
||||||
|
// package.
|
||||||
|
package plugins
|
||||||
|
|
||||||
|
import "github.com/containerd/containerd/plugin"
|
||||||
|
|
||||||
|
const (
|
||||||
|
// InternalPlugin implements an internal plugin to containerd
|
||||||
|
InternalPlugin plugin.Type = "io.containerd.internal.v1"
|
||||||
|
// RuntimePlugin implements a runtime
|
||||||
|
RuntimePlugin plugin.Type = "io.containerd.runtime.v1"
|
||||||
|
// RuntimePluginV2 implements a runtime v2
|
||||||
|
RuntimePluginV2 plugin.Type = "io.containerd.runtime.v2"
|
||||||
|
// ServicePlugin implements a internal service
|
||||||
|
ServicePlugin plugin.Type = "io.containerd.service.v1"
|
||||||
|
// GRPCPlugin implements a grpc service
|
||||||
|
GRPCPlugin plugin.Type = "io.containerd.grpc.v1"
|
||||||
|
// TTRPCPlugin implements a ttrpc shim service
|
||||||
|
TTRPCPlugin plugin.Type = "io.containerd.ttrpc.v1"
|
||||||
|
// SnapshotPlugin implements a snapshotter
|
||||||
|
SnapshotPlugin plugin.Type = "io.containerd.snapshotter.v1"
|
||||||
|
// TaskMonitorPlugin implements a task monitor
|
||||||
|
TaskMonitorPlugin plugin.Type = "io.containerd.monitor.v1"
|
||||||
|
// DiffPlugin implements a differ
|
||||||
|
DiffPlugin plugin.Type = "io.containerd.differ.v1"
|
||||||
|
// MetadataPlugin implements a metadata store
|
||||||
|
MetadataPlugin plugin.Type = "io.containerd.metadata.v1"
|
||||||
|
// ContentPlugin implements a content store
|
||||||
|
ContentPlugin plugin.Type = "io.containerd.content.v1"
|
||||||
|
// GCPlugin implements garbage collection policy
|
||||||
|
GCPlugin plugin.Type = "io.containerd.gc.v1"
|
||||||
|
// EventPlugin implements event handling
|
||||||
|
EventPlugin plugin.Type = "io.containerd.event.v1"
|
||||||
|
// LeasePlugin implements lease manager
|
||||||
|
LeasePlugin plugin.Type = "io.containerd.lease.v1"
|
||||||
|
// StreamingPlugin implements a stream manager
|
||||||
|
StreamingPlugin plugin.Type = "io.containerd.streaming.v1"
|
||||||
|
// TracingProcessorPlugin implements a open telemetry span processor
|
||||||
|
TracingProcessorPlugin plugin.Type = "io.containerd.tracing.processor.v1"
|
||||||
|
// NRIApiPlugin implements the NRI adaptation interface for containerd.
|
||||||
|
NRIApiPlugin plugin.Type = "io.containerd.nri.v1"
|
||||||
|
// TransferPlugin implements a transfer service
|
||||||
|
TransferPlugin plugin.Type = "io.containerd.transfer.v1"
|
||||||
|
// SandboxStorePlugin implements a sandbox store
|
||||||
|
SandboxStorePlugin plugin.Type = "io.containerd.sandbox.store.v1"
|
||||||
|
// SandboxControllerPlugin implements a sandbox controller
|
||||||
|
SandboxControllerPlugin plugin.Type = "io.containerd.sandbox.controller.v1"
|
||||||
|
// ImageVerifierPlugin implements an image verifier service
|
||||||
|
ImageVerifierPlugin plugin.Type = "io.containerd.image-verifier.v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// RuntimeRuncV2 is the runc runtime that supports multiple containers per shim
|
||||||
|
RuntimeRuncV2 = "io.containerd.runc.v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// PropertyRootDir sets the root directory property for a plugin
|
||||||
|
PropertyRootDir = "io.containerd.plugin.root"
|
||||||
|
// PropertyStateDir sets the state directory property for a plugin
|
||||||
|
PropertyStateDir = "io.containerd.plugin.state"
|
||||||
|
// PropertyGRPCAddress is the grpc address used for client connections to containerd
|
||||||
|
PropertyGRPCAddress = "io.containerd.plugin.grpc.address"
|
||||||
|
// PropertyGRPCAddress is the ttrpc address used for client connections to containerd
|
||||||
|
PropertyTTRPCAddress = "io.containerd.plugin.ttrpc.address"
|
||||||
|
)
|
@ -26,6 +26,7 @@ import (
|
|||||||
"github.com/containerd/containerd"
|
"github.com/containerd/containerd"
|
||||||
"github.com/containerd/containerd/namespaces"
|
"github.com/containerd/containerd/namespaces"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/runtime/restart"
|
"github.com/containerd/containerd/runtime/restart"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
)
|
)
|
||||||
@ -52,10 +53,10 @@ type Config struct {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.InternalPlugin,
|
Type: plugins.InternalPlugin,
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
plugin.ServicePlugin,
|
plugins.ServicePlugin,
|
||||||
},
|
},
|
||||||
ID: "restart",
|
ID: "restart",
|
||||||
Config: &Config{
|
Config: &Config{
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/pkg/shutdown"
|
"github.com/containerd/containerd/pkg/shutdown"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
"github.com/containerd/containerd/runtime/v2/shim"
|
"github.com/containerd/containerd/runtime/v2/shim"
|
||||||
"github.com/containerd/ttrpc"
|
"github.com/containerd/ttrpc"
|
||||||
@ -31,18 +32,18 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.TTRPCPlugin,
|
Type: plugins.TTRPCPlugin,
|
||||||
ID: "task",
|
ID: "task",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
plugin.InternalPlugin,
|
plugins.InternalPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
pp, err := ic.GetByID(plugin.EventPlugin, "publisher")
|
pp, err := ic.GetByID(plugins.EventPlugin, "publisher")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ss, err := ic.GetByID(plugin.InternalPlugin, "shutdown")
|
ss, err := ic.GetByID(plugins.InternalPlugin, "shutdown")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ import (
|
|||||||
"github.com/containerd/containerd/pkg/timeout"
|
"github.com/containerd/containerd/pkg/timeout"
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/protobuf"
|
"github.com/containerd/containerd/protobuf"
|
||||||
"github.com/containerd/containerd/runtime"
|
"github.com/containerd/containerd/runtime"
|
||||||
shimbinary "github.com/containerd/containerd/runtime/v2/shim"
|
shimbinary "github.com/containerd/containerd/runtime/v2/shim"
|
||||||
@ -51,11 +52,11 @@ type Config struct {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.RuntimePluginV2,
|
Type: plugins.RuntimePluginV2,
|
||||||
ID: "task",
|
ID: "task",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
},
|
},
|
||||||
Config: &Config{
|
Config: &Config{
|
||||||
Platforms: defaultPlatforms(),
|
Platforms: defaultPlatforms(),
|
||||||
@ -69,11 +70,11 @@ func init() {
|
|||||||
|
|
||||||
ic.Meta.Platforms = supportedPlatforms
|
ic.Meta.Platforms = supportedPlatforms
|
||||||
|
|
||||||
m, err := ic.Get(plugin.MetadataPlugin)
|
m, err := ic.Get(plugins.MetadataPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ep, err := ic.GetByID(plugin.EventPlugin, "exchange")
|
ep, err := ic.GetByID(plugins.EventPlugin, "exchange")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -104,10 +105,10 @@ func init() {
|
|||||||
// use the following workaround.
|
// use the following workaround.
|
||||||
// This expected to be removed in 1.7.
|
// This expected to be removed in 1.7.
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.RuntimePluginV2,
|
Type: plugins.RuntimePluginV2,
|
||||||
ID: "shim",
|
ID: "shim",
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
taskManagerI, err := ic.GetByID(plugin.RuntimePluginV2, "task")
|
taskManagerI, err := ic.GetByID(plugins.RuntimePluginV2, "task")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -176,7 +177,7 @@ type ShimManager struct {
|
|||||||
|
|
||||||
// ID of the shim manager
|
// ID of the shim manager
|
||||||
func (m *ShimManager) ID() string {
|
func (m *ShimManager) ID() string {
|
||||||
return plugin.RuntimePluginV2.String() + ".shim"
|
return plugins.RuntimePluginV2.String() + ".shim"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start launches a new shim instance
|
// Start launches a new shim instance
|
||||||
@ -400,7 +401,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 plugin.RuntimePluginV2.String() + ".task"
|
return plugins.RuntimePluginV2.String() + ".task"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create launches new shim instance and creates new task
|
// Create launches new shim instance and creates new task
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/api/types"
|
"github.com/containerd/containerd/api/types"
|
||||||
"github.com/containerd/containerd/pkg/shutdown"
|
"github.com/containerd/containerd/pkg/shutdown"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/runtime/v2/shim"
|
"github.com/containerd/containerd/runtime/v2/shim"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
"github.com/containerd/ttrpc"
|
"github.com/containerd/ttrpc"
|
||||||
@ -34,13 +35,13 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.TTRPCPlugin,
|
Type: plugins.TTRPCPlugin,
|
||||||
ID: "pause",
|
ID: "pause",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.InternalPlugin,
|
plugins.InternalPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
ss, err := ic.GetByID(plugin.InternalPlugin, "shutdown")
|
ss, err := ic.GetByID(plugins.InternalPlugin, "shutdown")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -19,24 +19,25 @@ package plugin
|
|||||||
import (
|
import (
|
||||||
"github.com/containerd/containerd/pkg/shutdown"
|
"github.com/containerd/containerd/pkg/shutdown"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/runtime/v2/runc/task"
|
"github.com/containerd/containerd/runtime/v2/runc/task"
|
||||||
"github.com/containerd/containerd/runtime/v2/shim"
|
"github.com/containerd/containerd/runtime/v2/shim"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.TTRPCPlugin,
|
Type: plugins.TTRPCPlugin,
|
||||||
ID: "task",
|
ID: "task",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
plugin.InternalPlugin,
|
plugins.InternalPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
pp, err := ic.GetByID(plugin.EventPlugin, "publisher")
|
pp, err := ic.GetByID(plugins.EventPlugin, "publisher")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ss, err := ic.GetByID(plugin.InternalPlugin, "shutdown")
|
ss, err := ic.GetByID(plugins.InternalPlugin, "shutdown")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ import (
|
|||||||
"github.com/containerd/containerd/namespaces"
|
"github.com/containerd/containerd/namespaces"
|
||||||
"github.com/containerd/containerd/pkg/shutdown"
|
"github.com/containerd/containerd/pkg/shutdown"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/protobuf"
|
"github.com/containerd/containerd/protobuf"
|
||||||
"github.com/containerd/containerd/protobuf/proto"
|
"github.com/containerd/containerd/protobuf/proto"
|
||||||
"github.com/containerd/containerd/version"
|
"github.com/containerd/containerd/version"
|
||||||
@ -284,7 +285,7 @@ func run(ctx context.Context, manager Manager, name string, config Config) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.InternalPlugin,
|
Type: plugins.InternalPlugin,
|
||||||
ID: "shutdown",
|
ID: "shutdown",
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
return sd, nil
|
return sd, nil
|
||||||
@ -293,7 +294,7 @@ func run(ctx context.Context, manager Manager, name string, config Config) error
|
|||||||
|
|
||||||
// Register event plugin
|
// Register event plugin
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.EventPlugin,
|
Type: plugins.EventPlugin,
|
||||||
ID: "publisher",
|
ID: "publisher",
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
return publisher, nil
|
return publisher, nil
|
||||||
|
11
services.go
11
services.go
@ -31,6 +31,7 @@ import (
|
|||||||
"github.com/containerd/containerd/leases"
|
"github.com/containerd/containerd/leases"
|
||||||
"github.com/containerd/containerd/namespaces"
|
"github.com/containerd/containerd/namespaces"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/sandbox"
|
"github.com/containerd/containerd/sandbox"
|
||||||
srv "github.com/containerd/containerd/services"
|
srv "github.com/containerd/containerd/services"
|
||||||
"github.com/containerd/containerd/services/introspection"
|
"github.com/containerd/containerd/services/introspection"
|
||||||
@ -183,16 +184,16 @@ func WithInMemoryServices(ic *plugin.InitContext) ClientOpt {
|
|||||||
return func(c *clientOpts) error {
|
return func(c *clientOpts) error {
|
||||||
var opts []ServicesOpt
|
var opts []ServicesOpt
|
||||||
for t, fn := range map[plugin.Type]func(interface{}) ServicesOpt{
|
for t, fn := range map[plugin.Type]func(interface{}) ServicesOpt{
|
||||||
plugin.EventPlugin: func(i interface{}) ServicesOpt {
|
plugins.EventPlugin: func(i interface{}) ServicesOpt {
|
||||||
return WithEventService(i.(EventService))
|
return WithEventService(i.(EventService))
|
||||||
},
|
},
|
||||||
plugin.LeasePlugin: func(i interface{}) ServicesOpt {
|
plugins.LeasePlugin: func(i interface{}) ServicesOpt {
|
||||||
return WithLeasesService(i.(leases.Manager))
|
return WithLeasesService(i.(leases.Manager))
|
||||||
},
|
},
|
||||||
plugin.SandboxStorePlugin: func(i interface{}) ServicesOpt {
|
plugins.SandboxStorePlugin: func(i interface{}) ServicesOpt {
|
||||||
return WithSandboxStore(i.(sandbox.Store))
|
return WithSandboxStore(i.(sandbox.Store))
|
||||||
},
|
},
|
||||||
plugin.SandboxControllerPlugin: func(i interface{}) ServicesOpt {
|
plugins.SandboxControllerPlugin: func(i interface{}) ServicesOpt {
|
||||||
return WithSandboxController(i.(sandbox.Controller))
|
return WithSandboxController(i.(sandbox.Controller))
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
@ -203,7 +204,7 @@ func WithInMemoryServices(ic *plugin.InitContext) ClientOpt {
|
|||||||
opts = append(opts, fn(i))
|
opts = append(opts, fn(i))
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins, err := ic.GetByType(plugin.ServicePlugin)
|
plugins, err := ic.GetByType(plugins.ServicePlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get service plugin: %w", err)
|
return fmt.Errorf("failed to get service plugin: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
"github.com/containerd/containerd/events"
|
"github.com/containerd/containerd/events"
|
||||||
"github.com/containerd/containerd/metadata"
|
"github.com/containerd/containerd/metadata"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
"github.com/containerd/containerd/services"
|
"github.com/containerd/containerd/services"
|
||||||
bolt "go.etcd.io/bbolt"
|
bolt "go.etcd.io/bbolt"
|
||||||
@ -38,18 +39,18 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.ServicePlugin,
|
Type: plugins.ServicePlugin,
|
||||||
ID: services.ContainersService,
|
ID: services.ContainersService,
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
m, err := ic.Get(plugin.MetadataPlugin)
|
m, err := ic.Get(plugins.MetadataPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ep, err := ic.Get(plugin.EventPlugin)
|
ep, err := ic.Get(plugins.EventPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
|
|
||||||
api "github.com/containerd/containerd/api/services/containers/v1"
|
api "github.com/containerd/containerd/api/services/containers/v1"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
"github.com/containerd/containerd/services"
|
"github.com/containerd/containerd/services"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
@ -30,17 +31,17 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GRPCPlugin,
|
Type: plugins.GRPCPlugin,
|
||||||
ID: "containers",
|
ID: "containers",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.ServicePlugin,
|
plugins.ServicePlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
plugins, err := ic.GetByType(plugin.ServicePlugin)
|
sps, err := ic.GetByType(plugins.ServicePlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
p, ok := plugins[services.ContainersService]
|
p, ok := sps[services.ContainersService]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.New("containers service not found")
|
return nil, errors.New("containers service not found")
|
||||||
}
|
}
|
||||||
|
@ -21,19 +21,20 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/content"
|
"github.com/containerd/containerd/content"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/services"
|
"github.com/containerd/containerd/services"
|
||||||
"github.com/containerd/containerd/services/content/contentserver"
|
"github.com/containerd/containerd/services/content/contentserver"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GRPCPlugin,
|
Type: plugins.GRPCPlugin,
|
||||||
ID: "content",
|
ID: "content",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.ServicePlugin,
|
plugins.ServicePlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
plugins, err := ic.GetByType(plugin.ServicePlugin)
|
plugins, err := ic.GetByType(plugins.ServicePlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
"github.com/containerd/containerd/events"
|
"github.com/containerd/containerd/events"
|
||||||
"github.com/containerd/containerd/metadata"
|
"github.com/containerd/containerd/metadata"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/services"
|
"github.com/containerd/containerd/services"
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
)
|
)
|
||||||
@ -36,18 +37,18 @@ type store struct {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.ServicePlugin,
|
Type: plugins.ServicePlugin,
|
||||||
ID: services.ContentService,
|
ID: services.ContentService,
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
m, err := ic.Get(plugin.MetadataPlugin)
|
m, err := ic.Get(plugins.MetadataPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ep, err := ic.Get(plugin.EventPlugin)
|
ep, err := ic.Get(plugins.EventPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
"github.com/containerd/containerd/mount"
|
"github.com/containerd/containerd/mount"
|
||||||
"github.com/containerd/containerd/oci"
|
"github.com/containerd/containerd/oci"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/services"
|
"github.com/containerd/containerd/services"
|
||||||
"github.com/containerd/typeurl/v2"
|
"github.com/containerd/typeurl/v2"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
@ -49,14 +50,14 @@ type differ interface {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.ServicePlugin,
|
Type: plugins.ServicePlugin,
|
||||||
ID: services.DiffService,
|
ID: services.DiffService,
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.DiffPlugin,
|
plugins.DiffPlugin,
|
||||||
},
|
},
|
||||||
Config: defaultDifferConfig,
|
Config: defaultDifferConfig,
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
differs, err := ic.GetByType(plugin.DiffPlugin)
|
differs, err := ic.GetByType(plugins.DiffPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -22,23 +22,24 @@ import (
|
|||||||
|
|
||||||
diffapi "github.com/containerd/containerd/api/services/diff/v1"
|
diffapi "github.com/containerd/containerd/api/services/diff/v1"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/services"
|
"github.com/containerd/containerd/services"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GRPCPlugin,
|
Type: plugins.GRPCPlugin,
|
||||||
ID: "diff",
|
ID: "diff",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.ServicePlugin,
|
plugins.ServicePlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
plugins, err := ic.GetByType(plugin.ServicePlugin)
|
sps, err := ic.GetByType(plugins.ServicePlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
p, ok := plugins[services.DiffService]
|
p, ok := sps[services.DiffService]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.New("diff service not found")
|
return nil, errors.New("diff service not found")
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
"github.com/containerd/containerd/events"
|
"github.com/containerd/containerd/events"
|
||||||
"github.com/containerd/containerd/events/exchange"
|
"github.com/containerd/containerd/events/exchange"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/protobuf"
|
"github.com/containerd/containerd/protobuf"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
"github.com/containerd/ttrpc"
|
"github.com/containerd/ttrpc"
|
||||||
@ -34,13 +35,13 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GRPCPlugin,
|
Type: plugins.GRPCPlugin,
|
||||||
ID: "events",
|
ID: "events",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
ep, err := ic.GetByID(plugin.EventPlugin, "exchange")
|
ep, err := ic.GetByID(plugins.EventPlugin, "exchange")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ package healthcheck
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/health"
|
"google.golang.org/grpc/health"
|
||||||
@ -30,7 +31,7 @@ type service struct {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GRPCPlugin,
|
Type: plugins.GRPCPlugin,
|
||||||
ID: "healthcheck",
|
ID: "healthcheck",
|
||||||
InitFn: func(*plugin.InitContext) (interface{}, error) {
|
InitFn: func(*plugin.InitContext) (interface{}, error) {
|
||||||
return newService()
|
return newService()
|
||||||
|
@ -28,6 +28,7 @@ import (
|
|||||||
"github.com/containerd/containerd/metadata"
|
"github.com/containerd/containerd/metadata"
|
||||||
"github.com/containerd/containerd/pkg/epoch"
|
"github.com/containerd/containerd/pkg/epoch"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
"github.com/containerd/containerd/services"
|
"github.com/containerd/containerd/services"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
@ -38,24 +39,24 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.ServicePlugin,
|
Type: plugins.ServicePlugin,
|
||||||
ID: services.ImagesService,
|
ID: services.ImagesService,
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
plugin.GCPlugin,
|
plugins.GCPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
m, err := ic.Get(plugin.MetadataPlugin)
|
m, err := ic.Get(plugins.MetadataPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
g, err := ic.Get(plugin.GCPlugin)
|
g, err := ic.Get(plugins.GCPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ep, err := ic.Get(plugin.EventPlugin)
|
ep, err := ic.Get(plugins.EventPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
imagesapi "github.com/containerd/containerd/api/services/images/v1"
|
imagesapi "github.com/containerd/containerd/api/services/images/v1"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
"github.com/containerd/containerd/services"
|
"github.com/containerd/containerd/services"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
@ -29,17 +30,17 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GRPCPlugin,
|
Type: plugins.GRPCPlugin,
|
||||||
ID: "images",
|
ID: "images",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.ServicePlugin,
|
plugins.ServicePlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
plugins, err := ic.GetByType(plugin.ServicePlugin)
|
sps, err := ic.GetByType(plugins.ServicePlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
p, ok := plugins[services.ImagesService]
|
p, ok := sps[services.ImagesService]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.New("images service not found")
|
return nil, errors.New("images service not found")
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import (
|
|||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/filters"
|
"github.com/containerd/containerd/filters"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
"github.com/containerd/containerd/services"
|
"github.com/containerd/containerd/services"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
@ -39,7 +40,7 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.ServicePlugin,
|
Type: plugins.ServicePlugin,
|
||||||
ID: services.IntrospectionService,
|
ID: services.IntrospectionService,
|
||||||
Requires: []plugin.Type{},
|
Requires: []plugin.Type{},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
api "github.com/containerd/containerd/api/services/introspection/v1"
|
api "github.com/containerd/containerd/api/services/introspection/v1"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
"github.com/containerd/containerd/services"
|
"github.com/containerd/containerd/services"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
@ -29,15 +30,15 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GRPCPlugin,
|
Type: plugins.GRPCPlugin,
|
||||||
ID: "introspection",
|
ID: "introspection",
|
||||||
Requires: []plugin.Type{plugin.ServicePlugin},
|
Requires: []plugin.Type{plugins.ServicePlugin},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
plugins, err := ic.GetByType(plugin.ServicePlugin)
|
sps, err := ic.GetByType(plugins.ServicePlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
p, ok := plugins[services.IntrospectionService]
|
p, ok := sps[services.IntrospectionService]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.New("introspection service not found")
|
return nil, errors.New("introspection service not found")
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/leases"
|
"github.com/containerd/containerd/leases"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/protobuf"
|
"github.com/containerd/containerd/protobuf"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
@ -30,13 +31,13 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GRPCPlugin,
|
Type: plugins.GRPCPlugin,
|
||||||
ID: "leases",
|
ID: "leases",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.LeasePlugin,
|
plugins.LeasePlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
i, err := ic.GetByID(plugin.LeasePlugin, "manager")
|
i, err := ic.GetByID(plugins.LeasePlugin, "manager")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
"github.com/containerd/containerd/metadata"
|
"github.com/containerd/containerd/metadata"
|
||||||
"github.com/containerd/containerd/namespaces"
|
"github.com/containerd/containerd/namespaces"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
"github.com/containerd/containerd/services"
|
"github.com/containerd/containerd/services"
|
||||||
bolt "go.etcd.io/bbolt"
|
bolt "go.etcd.io/bbolt"
|
||||||
@ -37,18 +38,18 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.ServicePlugin,
|
Type: plugins.ServicePlugin,
|
||||||
ID: services.NamespacesService,
|
ID: services.NamespacesService,
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
m, err := ic.Get(plugin.MetadataPlugin)
|
m, err := ic.Get(plugins.MetadataPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ep, err := ic.Get(plugin.EventPlugin)
|
ep, err := ic.Get(plugins.EventPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
api "github.com/containerd/containerd/api/services/namespaces/v1"
|
api "github.com/containerd/containerd/api/services/namespaces/v1"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
"github.com/containerd/containerd/services"
|
"github.com/containerd/containerd/services"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
@ -29,17 +30,17 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GRPCPlugin,
|
Type: plugins.GRPCPlugin,
|
||||||
ID: "namespaces",
|
ID: "namespaces",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.ServicePlugin,
|
plugins.ServicePlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
plugins, err := ic.GetByType(plugin.ServicePlugin)
|
sps, err := ic.GetByType(plugins.ServicePlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
p, ok := plugins[services.NamespacesService]
|
p, ok := sps[services.NamespacesService]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.New("namespaces service not found")
|
return nil, errors.New("namespaces service not found")
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config for the opt manager
|
// Config for the opt manager
|
||||||
@ -32,7 +33,7 @@ type Config struct {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.InternalPlugin,
|
Type: plugins.InternalPlugin,
|
||||||
ID: "opt",
|
ID: "opt",
|
||||||
Config: &Config{
|
Config: &Config{
|
||||||
Path: defaultPath,
|
Path: defaultPath,
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/events"
|
"github.com/containerd/containerd/events"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/protobuf"
|
"github.com/containerd/containerd/protobuf"
|
||||||
"github.com/containerd/containerd/sandbox"
|
"github.com/containerd/containerd/sandbox"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
@ -34,19 +35,19 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GRPCPlugin,
|
Type: plugins.GRPCPlugin,
|
||||||
ID: "sandbox-controllers",
|
ID: "sandbox-controllers",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.SandboxControllerPlugin,
|
plugins.SandboxControllerPlugin,
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
sc, err := ic.GetByID(plugin.SandboxControllerPlugin, "local")
|
sc, err := ic.GetByID(plugins.SandboxControllerPlugin, "local")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ep, err := ic.Get(plugin.EventPlugin)
|
ep, err := ic.Get(plugins.EventPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -25,19 +25,20 @@ import (
|
|||||||
"github.com/containerd/containerd/api/types"
|
"github.com/containerd/containerd/api/types"
|
||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/sandbox"
|
"github.com/containerd/containerd/sandbox"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GRPCPlugin,
|
Type: plugins.GRPCPlugin,
|
||||||
ID: "sandboxes",
|
ID: "sandboxes",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.SandboxStorePlugin,
|
plugins.SandboxStorePlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
sp, err := ic.GetByID(plugin.SandboxStorePlugin, "local")
|
sp, err := ic.GetByID(plugins.SandboxStorePlugin, "local")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ import (
|
|||||||
"github.com/containerd/containerd/pkg/timeout"
|
"github.com/containerd/containerd/pkg/timeout"
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
srvconfig "github.com/containerd/containerd/services/server/config"
|
srvconfig "github.com/containerd/containerd/services/server/config"
|
||||||
ssproxy "github.com/containerd/containerd/snapshots/proxy"
|
ssproxy "github.com/containerd/containerd/snapshots/proxy"
|
||||||
"github.com/containerd/containerd/sys"
|
"github.com/containerd/containerd/sys"
|
||||||
@ -127,7 +128,7 @@ func New(ctx context.Context, config *srvconfig.Config) (*Server, error) {
|
|||||||
}
|
}
|
||||||
timeout.Set(key, d)
|
timeout.Set(key, d)
|
||||||
}
|
}
|
||||||
plugins, err := LoadPlugins(ctx, config)
|
loaded, err := LoadPlugins(ctx, config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -223,7 +224,7 @@ func New(ctx context.Context, config *srvconfig.Config) (*Server, error) {
|
|||||||
// Run each plugin migration for each version to ensure that migration logic is simple and
|
// Run each plugin migration for each version to ensure that migration logic is simple and
|
||||||
// focused on upgrading from one version at a time.
|
// focused on upgrading from one version at a time.
|
||||||
for v := version; v < srvconfig.CurrentConfigVersion; v++ {
|
for v := version; v < srvconfig.CurrentConfigVersion; v++ {
|
||||||
for _, p := range plugins {
|
for _, p := range loaded {
|
||||||
if p.ConfigMigration != nil {
|
if p.ConfigMigration != nil {
|
||||||
if err := p.ConfigMigration(ctx, v, config.Plugins); err != nil {
|
if err := p.ConfigMigration(ctx, v, config.Plugins); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -237,7 +238,7 @@ func New(ctx context.Context, config *srvconfig.Config) (*Server, error) {
|
|||||||
log.G(ctx).WithField("t", migrationT).Warnf("Configuration migrated from version %d, use `containerd config migrate` to avoid migration", version)
|
log.G(ctx).WithField("t", migrationT).Warnf("Configuration migrated from version %d, use `containerd config migrate` to avoid migration", version)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, p := range plugins {
|
for _, p := range loaded {
|
||||||
id := p.URI()
|
id := p.URI()
|
||||||
log.G(ctx).WithField("type", p.Type).Infof("loading plugin %q...", id)
|
log.G(ctx).WithField("type", p.Type).Infof("loading plugin %q...", id)
|
||||||
var mustSucceed int32
|
var mustSucceed int32
|
||||||
@ -436,7 +437,7 @@ func LoadPlugins(ctx context.Context, config *srvconfig.Config) ([]*plugin.Regis
|
|||||||
}
|
}
|
||||||
// load additional plugins that don't automatically register themselves
|
// load additional plugins that don't automatically register themselves
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.ContentPlugin,
|
Type: plugins.ContentPlugin,
|
||||||
ID: "content",
|
ID: "content",
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
ic.Meta.Exports["root"] = ic.Root
|
ic.Meta.Exports["root"] = ic.Root
|
||||||
@ -456,20 +457,20 @@ func LoadPlugins(ctx context.Context, config *srvconfig.Config) ([]*plugin.Regis
|
|||||||
)
|
)
|
||||||
|
|
||||||
switch pp.Type {
|
switch pp.Type {
|
||||||
case string(plugin.SnapshotPlugin), "snapshot":
|
case string(plugins.SnapshotPlugin), "snapshot":
|
||||||
t = plugin.SnapshotPlugin
|
t = plugins.SnapshotPlugin
|
||||||
ssname := name
|
ssname := name
|
||||||
f = func(conn *grpc.ClientConn) interface{} {
|
f = func(conn *grpc.ClientConn) interface{} {
|
||||||
return ssproxy.NewSnapshotter(ssapi.NewSnapshotsClient(conn), ssname)
|
return ssproxy.NewSnapshotter(ssapi.NewSnapshotsClient(conn), ssname)
|
||||||
}
|
}
|
||||||
|
|
||||||
case string(plugin.ContentPlugin), "content":
|
case string(plugins.ContentPlugin), "content":
|
||||||
t = plugin.ContentPlugin
|
t = plugins.ContentPlugin
|
||||||
f = func(conn *grpc.ClientConn) interface{} {
|
f = func(conn *grpc.ClientConn) interface{} {
|
||||||
return csproxy.NewContentStore(csapi.NewContentClient(conn))
|
return csproxy.NewContentStore(csapi.NewContentClient(conn))
|
||||||
}
|
}
|
||||||
case string(plugin.DiffPlugin), "diff":
|
case string(plugins.DiffPlugin), "diff":
|
||||||
t = plugin.DiffPlugin
|
t = plugins.DiffPlugin
|
||||||
f = func(conn *grpc.ClientConn) interface{} {
|
f = func(conn *grpc.ClientConn) interface{} {
|
||||||
return diffproxy.NewDiffApplier(diffapi.NewDiffClient(conn))
|
return diffproxy.NewDiffApplier(diffapi.NewDiffClient(conn))
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/mount"
|
"github.com/containerd/containerd/mount"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
"github.com/containerd/containerd/services"
|
"github.com/containerd/containerd/services"
|
||||||
"github.com/containerd/containerd/snapshots"
|
"github.com/containerd/containerd/snapshots"
|
||||||
@ -33,10 +34,10 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GRPCPlugin,
|
Type: plugins.GRPCPlugin,
|
||||||
ID: "snapshots",
|
ID: "snapshots",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.ServicePlugin,
|
plugins.ServicePlugin,
|
||||||
},
|
},
|
||||||
InitFn: newService,
|
InitFn: newService,
|
||||||
})
|
})
|
||||||
@ -50,11 +51,11 @@ type service struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newService(ic *plugin.InitContext) (interface{}, error) {
|
func newService(ic *plugin.InitContext) (interface{}, error) {
|
||||||
plugins, err := ic.GetByType(plugin.ServicePlugin)
|
sps, err := ic.GetByType(plugins.ServicePlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
p, ok := plugins[services.SnapshotsService]
|
p, ok := sps[services.SnapshotsService]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.New("snapshots service not found")
|
return nil, errors.New("snapshots service not found")
|
||||||
}
|
}
|
||||||
|
@ -19,18 +19,19 @@ package snapshots
|
|||||||
import (
|
import (
|
||||||
"github.com/containerd/containerd/metadata"
|
"github.com/containerd/containerd/metadata"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/services"
|
"github.com/containerd/containerd/services"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.ServicePlugin,
|
Type: plugins.ServicePlugin,
|
||||||
ID: services.SnapshotsService,
|
ID: services.SnapshotsService,
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
m, err := ic.Get(plugin.MetadataPlugin)
|
m, err := ic.Get(plugins.MetadataPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/pkg/streaming"
|
"github.com/containerd/containerd/pkg/streaming"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/protobuf"
|
"github.com/containerd/containerd/protobuf"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
@ -42,13 +43,13 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GRPCPlugin,
|
Type: plugins.GRPCPlugin,
|
||||||
ID: "streaming",
|
ID: "streaming",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.StreamingPlugin,
|
plugins.StreamingPlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
i, err := ic.GetByID(plugin.StreamingPlugin, "manager")
|
i, err := ic.GetByID(plugins.StreamingPlugin, "manager")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ import (
|
|||||||
"github.com/containerd/containerd/pkg/rdt"
|
"github.com/containerd/containerd/pkg/rdt"
|
||||||
"github.com/containerd/containerd/pkg/timeout"
|
"github.com/containerd/containerd/pkg/timeout"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/protobuf"
|
"github.com/containerd/containerd/protobuf"
|
||||||
"github.com/containerd/containerd/protobuf/proto"
|
"github.com/containerd/containerd/protobuf/proto"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
@ -75,7 +76,7 @@ type Config struct {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.ServicePlugin,
|
Type: plugins.ServicePlugin,
|
||||||
ID: services.TasksService,
|
ID: services.TasksService,
|
||||||
Requires: tasksServiceRequires,
|
Requires: tasksServiceRequires,
|
||||||
Config: &Config{},
|
Config: &Config{},
|
||||||
@ -88,22 +89,22 @@ func init() {
|
|||||||
func initFunc(ic *plugin.InitContext) (interface{}, error) {
|
func initFunc(ic *plugin.InitContext) (interface{}, error) {
|
||||||
config := ic.Config.(*Config)
|
config := ic.Config.(*Config)
|
||||||
|
|
||||||
v2r, err := ic.GetByID(plugin.RuntimePluginV2, "task")
|
v2r, err := ic.GetByID(plugins.RuntimePluginV2, "task")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
m, err := ic.Get(plugin.MetadataPlugin)
|
m, err := ic.Get(plugins.MetadataPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ep, err := ic.Get(plugin.EventPlugin)
|
ep, err := ic.Get(plugins.EventPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
monitor, err := ic.Get(plugin.TaskMonitorPlugin)
|
monitor, err := ic.Get(plugins.TaskMonitorPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !errdefs.IsNotFound(err) {
|
if !errdefs.IsNotFound(err) {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -20,10 +20,11 @@ package tasks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
var tasksServiceRequires = []plugin.Type{
|
var tasksServiceRequires = []plugin.Type{
|
||||||
plugin.RuntimePluginV2,
|
plugins.RuntimePluginV2,
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
plugin.TaskMonitorPlugin,
|
plugins.TaskMonitorPlugin,
|
||||||
}
|
}
|
||||||
|
@ -18,11 +18,12 @@ package tasks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
var tasksServiceRequires = []plugin.Type{
|
var tasksServiceRequires = []plugin.Type{
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
plugin.RuntimePluginV2,
|
plugins.RuntimePluginV2,
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
plugin.TaskMonitorPlugin,
|
plugins.TaskMonitorPlugin,
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,13 @@ package tasks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
var tasksServiceRequires = []plugin.Type{
|
var tasksServiceRequires = []plugin.Type{
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
plugin.RuntimePlugin,
|
plugins.RuntimePlugin,
|
||||||
plugin.RuntimePluginV2,
|
plugins.RuntimePluginV2,
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
plugin.TaskMonitorPlugin,
|
plugins.TaskMonitorPlugin,
|
||||||
}
|
}
|
||||||
|
@ -18,11 +18,12 @@ package tasks
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
var tasksServiceRequires = []plugin.Type{
|
var tasksServiceRequires = []plugin.Type{
|
||||||
plugin.EventPlugin,
|
plugins.EventPlugin,
|
||||||
plugin.RuntimePluginV2,
|
plugins.RuntimePluginV2,
|
||||||
plugin.MetadataPlugin,
|
plugins.MetadataPlugin,
|
||||||
plugin.TaskMonitorPlugin,
|
plugins.TaskMonitorPlugin,
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
api "github.com/containerd/containerd/api/services/tasks/v1"
|
api "github.com/containerd/containerd/api/services/tasks/v1"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
"github.com/containerd/containerd/services"
|
"github.com/containerd/containerd/services"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
@ -33,17 +34,17 @@ var (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GRPCPlugin,
|
Type: plugins.GRPCPlugin,
|
||||||
ID: "tasks",
|
ID: "tasks",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.ServicePlugin,
|
plugins.ServicePlugin,
|
||||||
},
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
plugins, err := ic.GetByType(plugin.ServicePlugin)
|
sps, err := ic.GetByType(plugins.ServicePlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
p, ok := plugins[services.TasksService]
|
p, ok := sps[services.TasksService]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.New("tasks service not found")
|
return nil, errors.New("tasks service not found")
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,9 @@ import (
|
|||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/pkg/streaming"
|
"github.com/containerd/containerd/pkg/streaming"
|
||||||
"github.com/containerd/containerd/pkg/transfer"
|
"github.com/containerd/containerd/pkg/transfer"
|
||||||
"github.com/containerd/containerd/pkg/transfer/plugins"
|
tplugins "github.com/containerd/containerd/pkg/transfer/plugins"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
"github.com/containerd/typeurl/v2"
|
"github.com/containerd/typeurl/v2"
|
||||||
@ -37,11 +38,11 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GRPCPlugin,
|
Type: plugins.GRPCPlugin,
|
||||||
ID: "transfer",
|
ID: "transfer",
|
||||||
Requires: []plugin.Type{
|
Requires: []plugin.Type{
|
||||||
plugin.TransferPlugin,
|
plugins.TransferPlugin,
|
||||||
plugin.StreamingPlugin,
|
plugins.StreamingPlugin,
|
||||||
},
|
},
|
||||||
InitFn: newService,
|
InitFn: newService,
|
||||||
})
|
})
|
||||||
@ -54,21 +55,21 @@ type service struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newService(ic *plugin.InitContext) (interface{}, error) {
|
func newService(ic *plugin.InitContext) (interface{}, error) {
|
||||||
plugins, err := ic.GetByType(plugin.TransferPlugin)
|
sps, err := ic.GetByType(plugins.TransferPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: how to determine order?
|
// TODO: how to determine order?
|
||||||
t := make([]transfer.Transferrer, 0, len(plugins))
|
t := make([]transfer.Transferrer, 0, len(sps))
|
||||||
for _, p := range plugins {
|
for _, p := range sps {
|
||||||
i, err := p.Instance()
|
i, err := p.Instance()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
t = append(t, i.(transfer.Transferrer))
|
t = append(t, i.(transfer.Transferrer))
|
||||||
}
|
}
|
||||||
sp, err := ic.GetByID(plugin.StreamingPlugin, "manager")
|
sp, err := ic.GetByID(plugins.StreamingPlugin, "manager")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -134,7 +135,7 @@ func (s *service) Transfer(ctx context.Context, req *transferapi.TransferRequest
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *service) convertAny(ctx context.Context, a typeurl.Any) (interface{}, error) {
|
func (s *service) convertAny(ctx context.Context, a typeurl.Any) (interface{}, error) {
|
||||||
obj, err := plugins.ResolveType(a)
|
obj, err := tplugins.ResolveType(a)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errdefs.IsNotFound(err) {
|
if errdefs.IsNotFound(err) {
|
||||||
return typeurl.UnmarshalAny(a)
|
return typeurl.UnmarshalAny(a)
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
api "github.com/containerd/containerd/api/services/version/v1"
|
api "github.com/containerd/containerd/api/services/version/v1"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
ptypes "github.com/containerd/containerd/protobuf/types"
|
ptypes "github.com/containerd/containerd/protobuf/types"
|
||||||
ctrdversion "github.com/containerd/containerd/version"
|
ctrdversion "github.com/containerd/containerd/version"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
@ -30,7 +31,7 @@ var _ api.VersionServer = &service{}
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.GRPCPlugin,
|
Type: plugins.GRPCPlugin,
|
||||||
ID: "version",
|
ID: "version",
|
||||||
InitFn: initFunc,
|
InitFn: initFunc,
|
||||||
})
|
})
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/snapshots/blockfile"
|
"github.com/containerd/containerd/snapshots/blockfile"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ type Config struct {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.SnapshotPlugin,
|
Type: plugins.SnapshotPlugin,
|
||||||
ID: "blockfile",
|
ID: "blockfile",
|
||||||
Config: &Config{},
|
Config: &Config{},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/snapshots/btrfs"
|
"github.com/containerd/containerd/snapshots/btrfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ type Config struct {
|
|||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
ID: "btrfs",
|
ID: "btrfs",
|
||||||
Type: plugin.SnapshotPlugin,
|
Type: plugins.SnapshotPlugin,
|
||||||
Config: &Config{},
|
Config: &Config{},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
ic.Meta.Platforms = []ocispec.Platform{platforms.DefaultSpec()}
|
ic.Meta.Platforms = []ocispec.Platform{platforms.DefaultSpec()}
|
||||||
|
@ -24,12 +24,13 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/snapshots/devmapper"
|
"github.com/containerd/containerd/snapshots/devmapper"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.SnapshotPlugin,
|
Type: plugins.SnapshotPlugin,
|
||||||
ID: "devmapper",
|
ID: "devmapper",
|
||||||
Config: &devmapper.Config{},
|
Config: &devmapper.Config{},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
|
@ -37,6 +37,7 @@ import (
|
|||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/mount"
|
"github.com/containerd/containerd/mount"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/snapshots"
|
"github.com/containerd/containerd/snapshots"
|
||||||
"github.com/containerd/containerd/snapshots/storage"
|
"github.com/containerd/containerd/snapshots/storage"
|
||||||
"github.com/containerd/continuity/fs"
|
"github.com/containerd/continuity/fs"
|
||||||
@ -46,7 +47,7 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.SnapshotPlugin,
|
Type: plugins.SnapshotPlugin,
|
||||||
ID: "windows-lcow",
|
ID: "windows-lcow",
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
ic.Meta.Platforms = append(ic.Meta.Platforms, ocispec.Platform{
|
ic.Meta.Platforms = append(ic.Meta.Platforms, ocispec.Platform{
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/snapshots/native"
|
"github.com/containerd/containerd/snapshots/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -32,7 +33,7 @@ type Config struct {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.SnapshotPlugin,
|
Type: plugins.SnapshotPlugin,
|
||||||
ID: "native",
|
ID: "native",
|
||||||
Config: &Config{},
|
Config: &Config{},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/snapshots/overlay"
|
"github.com/containerd/containerd/snapshots/overlay"
|
||||||
"github.com/containerd/containerd/snapshots/overlay/overlayutils"
|
"github.com/containerd/containerd/snapshots/overlay/overlayutils"
|
||||||
)
|
)
|
||||||
@ -50,7 +51,7 @@ type Config struct {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.SnapshotPlugin,
|
Type: plugins.SnapshotPlugin,
|
||||||
ID: "overlayfs",
|
ID: "overlayfs",
|
||||||
Config: &Config{},
|
Config: &Config{},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
|
@ -38,6 +38,7 @@ import (
|
|||||||
"github.com/containerd/containerd/mount"
|
"github.com/containerd/containerd/mount"
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/snapshots"
|
"github.com/containerd/containerd/snapshots"
|
||||||
"github.com/containerd/containerd/snapshots/storage"
|
"github.com/containerd/containerd/snapshots/storage"
|
||||||
"github.com/containerd/continuity/fs"
|
"github.com/containerd/continuity/fs"
|
||||||
@ -47,7 +48,7 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
Type: plugin.SnapshotPlugin,
|
Type: plugins.SnapshotPlugin,
|
||||||
ID: "windows",
|
ID: "windows",
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
ic.Meta.Platforms = []ocispec.Platform{platforms.DefaultSpec()}
|
ic.Meta.Platforms = []ocispec.Platform{platforms.DefaultSpec()}
|
||||||
|
8
task.go
8
task.go
@ -35,7 +35,7 @@ import (
|
|||||||
"github.com/containerd/containerd/images"
|
"github.com/containerd/containerd/images"
|
||||||
"github.com/containerd/containerd/mount"
|
"github.com/containerd/containerd/mount"
|
||||||
"github.com/containerd/containerd/oci"
|
"github.com/containerd/containerd/oci"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/protobuf"
|
"github.com/containerd/containerd/protobuf"
|
||||||
google_protobuf "github.com/containerd/containerd/protobuf/types"
|
google_protobuf "github.com/containerd/containerd/protobuf/types"
|
||||||
"github.com/containerd/containerd/rootfs"
|
"github.com/containerd/containerd/rootfs"
|
||||||
@ -309,7 +309,7 @@ func (t *task) Delete(ctx context.Context, opts ...ProcessDeleteOpts) (*ExitStat
|
|||||||
switch status.Status {
|
switch status.Status {
|
||||||
case Stopped, Unknown, "":
|
case Stopped, Unknown, "":
|
||||||
case Created:
|
case Created:
|
||||||
if t.client.runtime == plugin.RuntimePlugin.String()+".windows" {
|
if t.client.runtime == plugins.RuntimePlugin.String()+".windows" {
|
||||||
// On windows Created is akin to Stopped
|
// On windows Created is akin to Stopped
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -326,7 +326,7 @@ func (t *task) Delete(ctx context.Context, opts ...ProcessDeleteOpts) (*ExitStat
|
|||||||
// io.Wait locks for restored tasks on Windows unless we call
|
// io.Wait locks for restored tasks on Windows unless we call
|
||||||
// io.Close first (https://github.com/containerd/containerd/issues/5621)
|
// io.Close first (https://github.com/containerd/containerd/issues/5621)
|
||||||
// in other cases, preserve the contract and let IO finish before closing
|
// in other cases, preserve the contract and let IO finish before closing
|
||||||
if t.client.runtime == plugin.RuntimePlugin.String()+".windows" {
|
if t.client.runtime == plugins.RuntimePlugin.String()+".windows" {
|
||||||
t.io.Close()
|
t.io.Close()
|
||||||
}
|
}
|
||||||
// io.Cancel is used to cancel the io goroutine while it is in
|
// io.Cancel is used to cancel the io goroutine while it is in
|
||||||
@ -690,7 +690,7 @@ func isCheckpointPathExist(runtime string, v interface{}) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch runtime {
|
switch runtime {
|
||||||
case plugin.RuntimeRuncV2:
|
case plugins.RuntimeRuncV2:
|
||||||
if opts, ok := v.(*options.CheckpointOptions); ok && opts.ImagePath != "" {
|
if opts, ok := v.(*options.CheckpointOptions); ok && opts.ImagePath != "" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/plugin"
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/plugins"
|
||||||
"github.com/containerd/containerd/tracing"
|
"github.com/containerd/containerd/tracing"
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@ -43,7 +44,7 @@ const exporterPlugin = "otlp"
|
|||||||
func init() {
|
func init() {
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
ID: exporterPlugin,
|
ID: exporterPlugin,
|
||||||
Type: plugin.TracingProcessorPlugin,
|
Type: plugins.TracingProcessorPlugin,
|
||||||
Config: &OTLPConfig{},
|
Config: &OTLPConfig{},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
cfg := ic.Config.(*OTLPConfig)
|
cfg := ic.Config.(*OTLPConfig)
|
||||||
@ -55,13 +56,18 @@ func init() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
plugin.Register(&plugin.Registration{
|
plugin.Register(&plugin.Registration{
|
||||||
ID: "tracing",
|
ID: "tracing",
|
||||||
Type: plugin.InternalPlugin,
|
Type: plugins.InternalPlugin,
|
||||||
Requires: []plugin.Type{plugin.TracingProcessorPlugin},
|
Requires: []plugin.Type{
|
||||||
Config: &TraceConfig{ServiceName: "containerd", TraceSamplingRatio: 1.0},
|
plugins.TracingProcessorPlugin,
|
||||||
|
},
|
||||||
|
Config: &TraceConfig{
|
||||||
|
ServiceName: "containerd",
|
||||||
|
TraceSamplingRatio: 1.0,
|
||||||
|
},
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
//get TracingProcessorPlugin which is a dependency
|
//get TracingProcessorPlugin which is a dependency
|
||||||
plugins, err := ic.GetByType(plugin.TracingProcessorPlugin)
|
plugins, err := ic.GetByType(plugins.TracingProcessorPlugin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to get tracing processors: %w", err)
|
return nil, fmt.Errorf("failed to get tracing processors: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user