Merge pull request #9321 from dmcgowan/switch-to-plugin-repo
Switch to plugin repo
This commit is contained in:
		| @@ -30,12 +30,12 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/images" | 	"github.com/containerd/containerd/v2/images" | ||||||
| 	"github.com/containerd/containerd/v2/leases" | 	"github.com/containerd/containerd/v2/leases" | ||||||
| 	"github.com/containerd/containerd/v2/namespaces" | 	"github.com/containerd/containerd/v2/namespaces" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/sandbox" | 	"github.com/containerd/containerd/v2/sandbox" | ||||||
| 	srv "github.com/containerd/containerd/v2/services" | 	srv "github.com/containerd/containerd/v2/services" | ||||||
| 	"github.com/containerd/containerd/v2/services/introspection" | 	"github.com/containerd/containerd/v2/services/introspection" | ||||||
| 	"github.com/containerd/containerd/v2/snapshots" | 	"github.com/containerd/containerd/v2/snapshots" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type services struct { | type services struct { | ||||||
| @@ -197,7 +197,7 @@ func WithInMemoryServices(ic *plugin.InitContext) Opt { | |||||||
| 				return WithSandboxStore(i.(sandbox.Store)) | 				return WithSandboxStore(i.(sandbox.Store)) | ||||||
| 			}, | 			}, | ||||||
| 		} { | 		} { | ||||||
| 			i, err := ic.Get(t) | 			i, err := ic.GetSingle(t) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return fmt.Errorf("failed to get %q plugin: %w", t, err) | 				return fmt.Errorf("failed to get %q plugin: %w", t, err) | ||||||
| 			} | 			} | ||||||
| @@ -237,16 +237,9 @@ func WithInMemoryServices(ic *plugin.InitContext) Opt { | |||||||
| 				return WithIntrospectionClient(s.(introspectionapi.IntrospectionClient)) | 				return WithIntrospectionClient(s.(introspectionapi.IntrospectionClient)) | ||||||
| 			}, | 			}, | ||||||
| 		} { | 		} { | ||||||
| 			p := plugins[s] | 			i := plugins[s] | ||||||
| 			if p == nil { |  | ||||||
| 				return fmt.Errorf("service %q not found", s) |  | ||||||
| 			} |  | ||||||
| 			i, err := p.Instance() |  | ||||||
| 			if err != nil { |  | ||||||
| 				return fmt.Errorf("failed to get instance of service %q: %w", s, err) |  | ||||||
| 			} |  | ||||||
| 			if i == nil { | 			if i == nil { | ||||||
| 				return fmt.Errorf("instance of service %q not found", s) | 				return fmt.Errorf("service %q not found", s) | ||||||
| 			} | 			} | ||||||
| 			opts = append(opts, fn(i)) | 			opts = append(opts, fn(i)) | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -24,9 +24,9 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/defaults" | 	"github.com/containerd/containerd/v2/defaults" | ||||||
| 	"github.com/containerd/containerd/v2/images" | 	"github.com/containerd/containerd/v2/images" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/timeout" | 	"github.com/containerd/containerd/v2/pkg/timeout" | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/services/server" | 	"github.com/containerd/containerd/v2/services/server" | ||||||
| 	srvconfig "github.com/containerd/containerd/v2/services/server/config" | 	srvconfig "github.com/containerd/containerd/v2/services/server/config" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	ocispec "github.com/opencontainers/image-spec/specs-go/v1" | 	ocispec "github.com/opencontainers/image-spec/specs-go/v1" | ||||||
| 	"github.com/pelletier/go-toml/v2" | 	"github.com/pelletier/go-toml/v2" | ||||||
| 	"github.com/urfave/cli" | 	"github.com/urfave/cli" | ||||||
|   | |||||||
| @@ -26,7 +26,7 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/api/types" | 	"github.com/containerd/containerd/v2/api/types" | ||||||
| 	"github.com/containerd/containerd/v2/cmd/ctr/commands" | 	"github.com/containerd/containerd/v2/cmd/ctr/commands" | ||||||
| 	"github.com/containerd/containerd/v2/platforms" | 	"github.com/containerd/containerd/v2/platforms" | ||||||
| 	pluginutils "github.com/containerd/containerd/v2/plugin" | 	pluginutils "github.com/containerd/plugin" | ||||||
| 	v1 "github.com/opencontainers/image-spec/specs-go/v1" | 	v1 "github.com/opencontainers/image-spec/specs-go/v1" | ||||||
| 	"github.com/urfave/cli" | 	"github.com/urfave/cli" | ||||||
| 	"google.golang.org/grpc/codes" | 	"google.golang.org/grpc/codes" | ||||||
|   | |||||||
| @@ -35,10 +35,10 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/errdefs" | 	"github.com/containerd/containerd/v2/errdefs" | ||||||
| 	"github.com/containerd/containerd/v2/metadata" | 	"github.com/containerd/containerd/v2/metadata" | ||||||
| 	"github.com/containerd/containerd/v2/mount" | 	"github.com/containerd/containerd/v2/mount" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	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" | ||||||
| ) | ) | ||||||
| @@ -56,7 +56,7 @@ func init() { | |||||||
| 			plugins.MetadataPlugin, | 			plugins.MetadataPlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			md, err := ic.Get(plugins.MetadataPlugin) | 			md, err := ic.GetSingle(plugins.MetadataPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -22,9 +22,9 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/diff/walking" | 	"github.com/containerd/containerd/v2/diff/walking" | ||||||
| 	"github.com/containerd/containerd/v2/metadata" | 	"github.com/containerd/containerd/v2/metadata" | ||||||
| 	"github.com/containerd/containerd/v2/platforms" | 	"github.com/containerd/containerd/v2/platforms" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| @@ -35,7 +35,7 @@ func init() { | |||||||
| 			plugins.MetadataPlugin, | 			plugins.MetadataPlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			md, err := ic.Get(plugins.MetadataPlugin) | 			md, err := ic.GetSingle(plugins.MetadataPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -38,10 +38,10 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/mount" | 	"github.com/containerd/containerd/v2/mount" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/epoch" | 	"github.com/containerd/containerd/v2/pkg/epoch" | ||||||
| 	"github.com/containerd/containerd/v2/platforms" | 	"github.com/containerd/containerd/v2/platforms" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"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" | ||||||
| ) | ) | ||||||
| @@ -54,7 +54,7 @@ func init() { | |||||||
| 			plugins.MetadataPlugin, | 			plugins.MetadataPlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			md, err := ic.Get(plugins.MetadataPlugin) | 			md, err := ic.GetSingle(plugins.MetadataPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -18,9 +18,9 @@ package plugin | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/containerd/containerd/v2/events/exchange" | 	"github.com/containerd/containerd/v2/events/exchange" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
|   | |||||||
| @@ -24,10 +24,10 @@ import ( | |||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/v2/gc" | 	"github.com/containerd/containerd/v2/gc" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // config configures the garbage collection policies. | // config configures the garbage collection policies. | ||||||
| @@ -112,7 +112,7 @@ 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(plugins.MetadataPlugin) | 			md, err := ic.GetSingle(plugins.MetadataPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								go.mod
									
									
									
									
									
								
							| @@ -19,6 +19,7 @@ require ( | |||||||
| 	github.com/containerd/go-runc v1.1.0 | 	github.com/containerd/go-runc v1.1.0 | ||||||
| 	github.com/containerd/log v0.1.0 | 	github.com/containerd/log v0.1.0 | ||||||
| 	github.com/containerd/nri v0.5.0 | 	github.com/containerd/nri v0.5.0 | ||||||
|  | 	github.com/containerd/plugin v0.0.0-20231101173250-7ec69893e1e7 | ||||||
| 	github.com/containerd/ttrpc v1.2.2 | 	github.com/containerd/ttrpc v1.2.2 | ||||||
| 	github.com/containerd/typeurl/v2 v2.1.1 | 	github.com/containerd/typeurl/v2 v2.1.1 | ||||||
| 	github.com/containernetworking/cni v1.1.2 | 	github.com/containernetworking/cni v1.1.2 | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.sum
									
									
									
									
									
								
							| @@ -188,6 +188,8 @@ github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3 | |||||||
| github.com/containerd/nri v0.0.0-20201007170849-eb1350a75164/go.mod h1:+2wGSDGFYfE5+So4M5syatU0N0f0LbWpuqyMi4/BE8c= | github.com/containerd/nri v0.0.0-20201007170849-eb1350a75164/go.mod h1:+2wGSDGFYfE5+So4M5syatU0N0f0LbWpuqyMi4/BE8c= | ||||||
| github.com/containerd/nri v0.5.0 h1:bwCtKpi8i5FCA8g8WjIZNod91CEfIloYpV0+TH2prnQ= | github.com/containerd/nri v0.5.0 h1:bwCtKpi8i5FCA8g8WjIZNod91CEfIloYpV0+TH2prnQ= | ||||||
| github.com/containerd/nri v0.5.0/go.mod h1:qIu2NlP3r/qK4YGnNuQf0De4VPqQWP2i2CVBfAZbGzg= | github.com/containerd/nri v0.5.0/go.mod h1:qIu2NlP3r/qK4YGnNuQf0De4VPqQWP2i2CVBfAZbGzg= | ||||||
|  | github.com/containerd/plugin v0.0.0-20231101173250-7ec69893e1e7 h1:MUbtIMHEcMzj+8mPgHd5ett0WVbY/KYHa5tMvFs5Ejs= | ||||||
|  | github.com/containerd/plugin v0.0.0-20231101173250-7ec69893e1e7/go.mod h1:j6HlpMtkiZMgT4UsfVNxPBUkwdw9KQGU6nCLfRxnq+w= | ||||||
| github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= | github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= | ||||||
| github.com/containerd/ttrpc v0.0.0-20190828172938-92c8520ef9f8/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= | github.com/containerd/ttrpc v0.0.0-20190828172938-92c8520ef9f8/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= | ||||||
| github.com/containerd/ttrpc v0.0.0-20191028202541-4f1b8fe65a5c/go.mod h1:LPm1u0xBw8r8NOKoOdNMeVHSawSsltak+Ihv+etqsE8= | github.com/containerd/ttrpc v0.0.0-20191028202541-4f1b8fe65a5c/go.mod h1:LPm1u0xBw8r8NOKoOdNMeVHSawSsltak+Ihv+etqsE8= | ||||||
|   | |||||||
| @@ -25,11 +25,11 @@ import ( | |||||||
| 	containerd "github.com/containerd/containerd/v2/client" | 	containerd "github.com/containerd/containerd/v2/client" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/cri/constants" | 	"github.com/containerd/containerd/v2/pkg/cri/constants" | ||||||
| 	"github.com/containerd/containerd/v2/platforms" | 	"github.com/containerd/containerd/v2/platforms" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	ctrdsrv "github.com/containerd/containerd/v2/services/server" | 	ctrdsrv "github.com/containerd/containerd/v2/services/server" | ||||||
| 	srvconfig "github.com/containerd/containerd/v2/services/server/config" | 	srvconfig "github.com/containerd/containerd/v2/services/server/config" | ||||||
| 	"github.com/containerd/log/logtest" | 	"github.com/containerd/log/logtest" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  |  | ||||||
| 	_ "github.com/containerd/containerd/v2/diff/walking/plugin" | 	_ "github.com/containerd/containerd/v2/diff/walking/plugin" | ||||||
| 	_ "github.com/containerd/containerd/v2/events/plugin" | 	_ "github.com/containerd/containerd/v2/events/plugin" | ||||||
|   | |||||||
| @@ -27,11 +27,11 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/oci" | 	"github.com/containerd/containerd/v2/oci" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/failpoint" | 	"github.com/containerd/containerd/v2/pkg/failpoint" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/shutdown" | 	"github.com/containerd/containerd/v2/pkg/shutdown" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/runtime/v2/runc/task" | 	"github.com/containerd/containerd/v2/runtime/v2/runc/task" | ||||||
| 	"github.com/containerd/containerd/v2/runtime/v2/shim" | 	"github.com/containerd/containerd/v2/runtime/v2/shim" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"github.com/containerd/ttrpc" | 	"github.com/containerd/ttrpc" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -22,9 +22,9 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/gc" | 	"github.com/containerd/containerd/v2/gc" | ||||||
| 	"github.com/containerd/containerd/v2/leases" | 	"github.com/containerd/containerd/v2/leases" | ||||||
| 	"github.com/containerd/containerd/v2/metadata" | 	"github.com/containerd/containerd/v2/metadata" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| @@ -36,11 +36,11 @@ func init() { | |||||||
| 			plugins.GCPlugin, | 			plugins.GCPlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			m, err := ic.Get(plugins.MetadataPlugin) | 			m, err := ic.GetSingle(plugins.MetadataPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
| 			g, err := ic.Get(plugins.GCPlugin) | 			g, err := ic.GetSingle(plugins.GCPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -27,11 +27,11 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/events" | 	"github.com/containerd/containerd/v2/events" | ||||||
| 	"github.com/containerd/containerd/v2/metadata" | 	"github.com/containerd/containerd/v2/metadata" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/timeout" | 	"github.com/containerd/containerd/v2/pkg/timeout" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/snapshots" | 	"github.com/containerd/containerd/v2/snapshots" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
|  |  | ||||||
| 	bolt "go.etcd.io/bbolt" | 	bolt "go.etcd.io/bbolt" | ||||||
| ) | ) | ||||||
| @@ -99,7 +99,7 @@ func init() { | |||||||
| 			if err := os.MkdirAll(root, 0711); err != nil { | 			if err := os.MkdirAll(root, 0711); err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
| 			cs, err := ic.Get(plugins.ContentPlugin) | 			cs, err := ic.GetSingle(plugins.ContentPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
| @@ -111,18 +111,10 @@ func init() { | |||||||
|  |  | ||||||
| 			snapshotters := make(map[string]snapshots.Snapshotter) | 			snapshotters := make(map[string]snapshots.Snapshotter) | ||||||
| 			for name, sn := range snapshottersRaw { | 			for name, sn := range snapshottersRaw { | ||||||
| 				sn, err := sn.Instance() |  | ||||||
| 				if err != nil { |  | ||||||
| 					if !plugin.IsSkipPlugin(err) { |  | ||||||
| 						log.G(ic.Context).WithError(err). |  | ||||||
| 							Warnf("could not use snapshotter %v in metadata plugin", name) |  | ||||||
| 					} |  | ||||||
| 					continue |  | ||||||
| 				} |  | ||||||
| 				snapshotters[name] = sn.(snapshots.Snapshotter) | 				snapshotters[name] = sn.(snapshots.Snapshotter) | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			ep, err := ic.Get(plugins.EventPlugin) | 			ep, err := ic.GetSingle(plugins.EventPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -24,10 +24,10 @@ import ( | |||||||
| 	v1 "github.com/containerd/containerd/v2/metrics/cgroups/v1" | 	v1 "github.com/containerd/containerd/v2/metrics/cgroups/v1" | ||||||
| 	v2 "github.com/containerd/containerd/v2/metrics/cgroups/v2" | 	v2 "github.com/containerd/containerd/v2/metrics/cgroups/v2" | ||||||
| 	"github.com/containerd/containerd/v2/platforms" | 	"github.com/containerd/containerd/v2/platforms" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/runtime" | 	"github.com/containerd/containerd/v2/runtime" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	metrics "github.com/docker/go-metrics" | 	metrics "github.com/docker/go-metrics" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -60,7 +60,7 @@ func New(ic *plugin.InitContext) (interface{}, error) { | |||||||
| 		err error | 		err error | ||||||
| 	) | 	) | ||||||
|  |  | ||||||
| 	ep, err := ic.Get(plugins.EventPlugin) | 	ep, err := ic.GetSingle(plugins.EventPlugin) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, err | 		return nil, err | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -26,10 +26,10 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/pkg/cri/server" | 	"github.com/containerd/containerd/v2/pkg/cri/server" | ||||||
| 	nriservice "github.com/containerd/containerd/v2/pkg/nri" | 	nriservice "github.com/containerd/containerd/v2/pkg/nri" | ||||||
| 	"github.com/containerd/containerd/v2/platforms" | 	"github.com/containerd/containerd/v2/platforms" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	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" | ||||||
|  |  | ||||||
|   | |||||||
| @@ -34,11 +34,11 @@ import ( | |||||||
| 	ctrdutil "github.com/containerd/containerd/v2/pkg/cri/util" | 	ctrdutil "github.com/containerd/containerd/v2/pkg/cri/util" | ||||||
| 	osinterface "github.com/containerd/containerd/v2/pkg/os" | 	osinterface "github.com/containerd/containerd/v2/pkg/os" | ||||||
| 	"github.com/containerd/containerd/v2/platforms" | 	"github.com/containerd/containerd/v2/platforms" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/protobuf" | 	"github.com/containerd/containerd/v2/protobuf" | ||||||
| 	"github.com/containerd/containerd/v2/sandbox" | 	"github.com/containerd/containerd/v2/sandbox" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
|   | |||||||
| @@ -18,9 +18,9 @@ package plugin | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/containerd/containerd/v2/pkg/nri" | 	"github.com/containerd/containerd/v2/pkg/nri" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
|   | |||||||
| @@ -1,381 +0,0 @@ | |||||||
| /* |  | ||||||
|    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. |  | ||||||
| */ |  | ||||||
|  |  | ||||||
| package plugin |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
| 	"testing" |  | ||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/v2/services" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| func mockPluginFilter(*Registration) bool { |  | ||||||
| 	return false |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // TestContainerdPlugin tests the logic of Graph, use the containerd's plugin |  | ||||||
| func TestContainerdPlugin(t *testing.T) { |  | ||||||
| 	// 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" |  | ||||||
| 	) |  | ||||||
|  |  | ||||||
| 	var register Registry |  | ||||||
| 	register = register.Register(&Registration{ |  | ||||||
| 		Type: TaskMonitorPlugin, |  | ||||||
| 		ID:   "cgroups", |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: ServicePlugin, |  | ||||||
| 		ID:   services.TasksService, |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			RuntimePlugin, |  | ||||||
| 			RuntimePluginV2, |  | ||||||
| 			MetadataPlugin, |  | ||||||
| 			TaskMonitorPlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: ServicePlugin, |  | ||||||
| 		ID:   services.IntrospectionService, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: ServicePlugin, |  | ||||||
| 		ID:   services.NamespacesService, |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			MetadataPlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: GRPCPlugin, |  | ||||||
| 		ID:   "namespaces", |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			ServicePlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: GRPCPlugin, |  | ||||||
| 		ID:   "content", |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			ServicePlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: GRPCPlugin, |  | ||||||
| 		ID:   "containers", |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			ServicePlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: ServicePlugin, |  | ||||||
| 		ID:   services.ContainersService, |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			MetadataPlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: GRPCPlugin, |  | ||||||
| 		ID:   "events", |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: GRPCPlugin, |  | ||||||
| 		ID:   "leases", |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			LeasePlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: LeasePlugin, |  | ||||||
| 		ID:   "manager", |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			MetadataPlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: GRPCPlugin, |  | ||||||
| 		ID:   "diff", |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			ServicePlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: ServicePlugin, |  | ||||||
| 		ID:   services.DiffService, |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			DiffPlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: ServicePlugin, |  | ||||||
| 		ID:   services.SnapshotsService, |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			MetadataPlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: GRPCPlugin, |  | ||||||
| 		ID:   "snapshots", |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			ServicePlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: GRPCPlugin, |  | ||||||
| 		ID:   "version", |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: GRPCPlugin, |  | ||||||
| 		ID:   "images", |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			ServicePlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: GCPlugin, |  | ||||||
| 		ID:   "scheduler", |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			MetadataPlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: RuntimePluginV2, |  | ||||||
| 		ID:   "task", |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			MetadataPlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: GRPCPlugin, |  | ||||||
| 		ID:   "tasks", |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			ServicePlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type:     GRPCPlugin, |  | ||||||
| 		ID:       "introspection", |  | ||||||
| 		Requires: []Type{"*"}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: ServicePlugin, |  | ||||||
| 		ID:   services.ContentService, |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			MetadataPlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: GRPCPlugin, |  | ||||||
| 		ID:   "healthcheck", |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: InternalPlugin, |  | ||||||
| 		ID:   "opt", |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: GRPCPlugin, |  | ||||||
| 		ID:   "cri", |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			ServicePlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: RuntimePlugin, |  | ||||||
| 		ID:   "linux", |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			MetadataPlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: InternalPlugin, |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			ServicePlugin, |  | ||||||
| 		}, |  | ||||||
| 		ID: "restart", |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: DiffPlugin, |  | ||||||
| 		ID:   "walking", |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			MetadataPlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: SnapshotPlugin, |  | ||||||
| 		ID:   "native", |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: SnapshotPlugin, |  | ||||||
| 		ID:   "overlayfs", |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: ContentPlugin, |  | ||||||
| 		ID:   "content", |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: MetadataPlugin, |  | ||||||
| 		ID:   "bolt", |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			ContentPlugin, |  | ||||||
| 			SnapshotPlugin, |  | ||||||
| 		}, |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: TracingProcessorPlugin, |  | ||||||
| 		ID:   "otlp", |  | ||||||
| 	}).Register(&Registration{ |  | ||||||
| 		Type: InternalPlugin, |  | ||||||
| 		ID:   "tracing", |  | ||||||
| 		Requires: []Type{ |  | ||||||
| 			TracingProcessorPlugin, |  | ||||||
| 		}, |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	ordered := register.Graph(mockPluginFilter) |  | ||||||
| 	expectedURI := []string{ |  | ||||||
| 		"io.containerd.monitor.v1.cgroups", |  | ||||||
| 		"io.containerd.content.v1.content", |  | ||||||
| 		"io.containerd.snapshotter.v1.native", |  | ||||||
| 		"io.containerd.snapshotter.v1.overlayfs", |  | ||||||
| 		"io.containerd.metadata.v1.bolt", |  | ||||||
| 		"io.containerd.runtime.v1.linux", |  | ||||||
| 		"io.containerd.runtime.v2.task", |  | ||||||
| 		"io.containerd.service.v1.tasks-service", |  | ||||||
| 		"io.containerd.service.v1.introspection-service", |  | ||||||
| 		"io.containerd.service.v1.namespaces-service", |  | ||||||
| 		"io.containerd.service.v1.containers-service", |  | ||||||
| 		"io.containerd.differ.v1.walking", |  | ||||||
| 		"io.containerd.service.v1.diff-service", |  | ||||||
| 		"io.containerd.service.v1.snapshots-service", |  | ||||||
| 		"io.containerd.service.v1.content-service", |  | ||||||
| 		"io.containerd.grpc.v1.namespaces", |  | ||||||
| 		"io.containerd.grpc.v1.content", |  | ||||||
| 		"io.containerd.grpc.v1.containers", |  | ||||||
| 		"io.containerd.grpc.v1.events", |  | ||||||
| 		"io.containerd.lease.v1.manager", |  | ||||||
| 		"io.containerd.grpc.v1.leases", |  | ||||||
| 		"io.containerd.grpc.v1.diff", |  | ||||||
| 		"io.containerd.grpc.v1.snapshots", |  | ||||||
| 		"io.containerd.grpc.v1.version", |  | ||||||
| 		"io.containerd.grpc.v1.images", |  | ||||||
| 		"io.containerd.gc.v1.scheduler", |  | ||||||
| 		"io.containerd.grpc.v1.tasks", |  | ||||||
| 		"io.containerd.grpc.v1.healthcheck", |  | ||||||
| 		"io.containerd.internal.v1.opt", |  | ||||||
| 		"io.containerd.grpc.v1.cri", |  | ||||||
| 		"io.containerd.internal.v1.restart", |  | ||||||
| 		"io.containerd.tracing.processor.v1.otlp", |  | ||||||
| 		"io.containerd.internal.v1.tracing", |  | ||||||
| 		"io.containerd.grpc.v1.introspection", |  | ||||||
| 	} |  | ||||||
| 	cmpOrdered(t, ordered, expectedURI) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func cmpOrdered(t *testing.T, ordered []Registration, expectedURI []string) { |  | ||||||
| 	if len(ordered) != len(expectedURI) { |  | ||||||
| 		t.Fatalf("ordered compare failed, %d != %d", len(ordered), len(expectedURI)) |  | ||||||
| 	} |  | ||||||
| 	for i := range ordered { |  | ||||||
| 		if ordered[i].URI() != expectedURI[i] { |  | ||||||
| 			t.Fatalf("graph failed, expected: %s, but return: %s", expectedURI[i], ordered[i].URI()) |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // TestPluginGraph tests the logic of Graph |  | ||||||
| func TestPluginGraph(t *testing.T) { |  | ||||||
| 	for _, testcase := range []struct { |  | ||||||
| 		input       []*Registration |  | ||||||
| 		expectedURI []string |  | ||||||
| 		filter      DisableFilter |  | ||||||
| 	}{ |  | ||||||
| 		// test requires * |  | ||||||
| 		{ |  | ||||||
| 			input: []*Registration{ |  | ||||||
| 				{ |  | ||||||
| 					Type: "grpc", |  | ||||||
| 					ID:   "introspection", |  | ||||||
| 					Requires: []Type{ |  | ||||||
| 						"*", |  | ||||||
| 					}, |  | ||||||
| 				}, |  | ||||||
| 				{ |  | ||||||
| 					Type: "service", |  | ||||||
| 					ID:   "container", |  | ||||||
| 				}, |  | ||||||
| 			}, |  | ||||||
| 			expectedURI: []string{ |  | ||||||
| 				"service.container", |  | ||||||
| 				"grpc.introspection", |  | ||||||
| 			}, |  | ||||||
| 		}, |  | ||||||
| 		// test requires |  | ||||||
| 		{ |  | ||||||
| 			input: []*Registration{ |  | ||||||
| 				{ |  | ||||||
| 					Type: "service", |  | ||||||
| 					ID:   "container", |  | ||||||
| 					Requires: []Type{ |  | ||||||
| 						"metadata", |  | ||||||
| 					}, |  | ||||||
| 				}, |  | ||||||
| 				{ |  | ||||||
| 					Type: "metadata", |  | ||||||
| 					ID:   "bolt", |  | ||||||
| 				}, |  | ||||||
| 			}, |  | ||||||
| 			expectedURI: []string{ |  | ||||||
| 				"metadata.bolt", |  | ||||||
| 				"service.container", |  | ||||||
| 			}, |  | ||||||
| 		}, |  | ||||||
| 		{ |  | ||||||
| 			input: []*Registration{ |  | ||||||
| 				{ |  | ||||||
| 					Type: "metadata", |  | ||||||
| 					ID:   "bolt", |  | ||||||
| 					Requires: []Type{ |  | ||||||
| 						"content", |  | ||||||
| 						"snapshotter", |  | ||||||
| 					}, |  | ||||||
| 				}, |  | ||||||
| 				{ |  | ||||||
| 					Type: "snapshotter", |  | ||||||
| 					ID:   "overlayfs", |  | ||||||
| 				}, |  | ||||||
| 				{ |  | ||||||
| 					Type: "content", |  | ||||||
| 					ID:   "content", |  | ||||||
| 				}, |  | ||||||
| 			}, |  | ||||||
| 			expectedURI: []string{ |  | ||||||
| 				"content.content", |  | ||||||
| 				"snapshotter.overlayfs", |  | ||||||
| 				"metadata.bolt", |  | ||||||
| 			}, |  | ||||||
| 		}, |  | ||||||
| 		// test disable |  | ||||||
| 		{ |  | ||||||
| 			input: []*Registration{ |  | ||||||
| 				{ |  | ||||||
| 					Type: "content", |  | ||||||
| 					ID:   "content", |  | ||||||
| 				}, |  | ||||||
| 				{ |  | ||||||
| 					Type: "disable", |  | ||||||
| 					ID:   "disable", |  | ||||||
| 				}, |  | ||||||
| 			}, |  | ||||||
| 			expectedURI: []string{ |  | ||||||
| 				"content.content", |  | ||||||
| 			}, |  | ||||||
| 			filter: func(r *Registration) bool { |  | ||||||
| 				return r.Type == "disable" |  | ||||||
| 			}, |  | ||||||
| 		}, |  | ||||||
| 	} { |  | ||||||
| 		var register Registry |  | ||||||
| 		for _, in := range testcase.input { |  | ||||||
| 			register = register.Register(in) |  | ||||||
| 		} |  | ||||||
| 		var filter DisableFilter = mockPluginFilter |  | ||||||
| 		if testcase.filter != nil { |  | ||||||
| 			filter = testcase.filter |  | ||||||
| 		} |  | ||||||
| 		ordered := register.Graph(filter) |  | ||||||
| 		cmpOrdered(t, ordered, testcase.expectedURI) |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| @@ -21,9 +21,9 @@ import ( | |||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/v2/pkg/imageverifier/bindir" | 	"github.com/containerd/containerd/v2/pkg/imageverifier/bindir" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/tomlext" | 	"github.com/containerd/containerd/v2/pkg/tomlext" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // Register default image verifier service plugin | // Register default image verifier service plugin | ||||||
|   | |||||||
| @@ -28,13 +28,13 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/events/exchange" | 	"github.com/containerd/containerd/v2/events/exchange" | ||||||
| 	"github.com/containerd/containerd/v2/mount" | 	"github.com/containerd/containerd/v2/mount" | ||||||
| 	"github.com/containerd/containerd/v2/platforms" | 	"github.com/containerd/containerd/v2/platforms" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/runtime" | 	"github.com/containerd/containerd/v2/runtime" | ||||||
| 	v2 "github.com/containerd/containerd/v2/runtime/v2" | 	v2 "github.com/containerd/containerd/v2/runtime/v2" | ||||||
| 	"github.com/containerd/containerd/v2/sandbox" | 	"github.com/containerd/containerd/v2/sandbox" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
|  |  | ||||||
| 	"google.golang.org/protobuf/types/known/anypb" | 	"google.golang.org/protobuf/types/known/anypb" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -18,9 +18,9 @@ package sandbox | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/containerd/containerd/v2/metadata" | 	"github.com/containerd/containerd/v2/metadata" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| @@ -31,7 +31,7 @@ func init() { | |||||||
| 			plugins.MetadataPlugin, | 			plugins.MetadataPlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			m, err := ic.Get(plugins.MetadataPlugin) | 			m, err := ic.GetSingle(plugins.MetadataPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -27,9 +27,9 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/metadata" | 	"github.com/containerd/containerd/v2/metadata" | ||||||
| 	"github.com/containerd/containerd/v2/namespaces" | 	"github.com/containerd/containerd/v2/namespaces" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/streaming" | 	"github.com/containerd/containerd/v2/pkg/streaming" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| @@ -40,7 +40,7 @@ func init() { | |||||||
| 			plugins.MetadataPlugin, | 			plugins.MetadataPlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			md, err := ic.Get(plugins.MetadataPlugin) | 			md, err := ic.GetSingle(plugins.MetadataPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -28,10 +28,10 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/pkg/transfer/local" | 	"github.com/containerd/containerd/v2/pkg/transfer/local" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/unpack" | 	"github.com/containerd/containerd/v2/pkg/unpack" | ||||||
| 	"github.com/containerd/containerd/v2/platforms" | 	"github.com/containerd/containerd/v2/platforms" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
|  |  | ||||||
| 	// Load packages with type registrations | 	// Load packages with type registrations | ||||||
| 	_ "github.com/containerd/containerd/v2/pkg/transfer/archive" | 	_ "github.com/containerd/containerd/v2/pkg/transfer/archive" | ||||||
| @@ -53,12 +53,12 @@ func init() { | |||||||
| 		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(plugins.MetadataPlugin) | 			m, err := ic.GetSingle(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(plugins.LeasePlugin) | 			l, err := ic.GetSingle(plugins.LeasePlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
| @@ -70,11 +70,7 @@ func init() { | |||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			for name, vp := range vps { | 			for name, vp := range vps { | ||||||
| 				inst, err := vp.Instance() | 				vfs[name] = vp.(imageverifier.ImageVerifier) | ||||||
| 				if err != nil { |  | ||||||
| 					return nil, err |  | ||||||
| 				} |  | ||||||
| 				vfs[name] = inst.(imageverifier.ImageVerifier) |  | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
| 			// Set configuration based on default or user input | 			// Set configuration based on default or user input | ||||||
| @@ -92,24 +88,19 @@ 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(plugins.DiffPlugin) |  | ||||||
| 				if err != nil { |  | ||||||
| 					return nil, fmt.Errorf("error loading diff plugins: %w", err) |  | ||||||
| 				} |  | ||||||
| 				var applier diff.Applier | 				var applier diff.Applier | ||||||
| 				target := platforms.OnlyStrict(p) | 				target := platforms.OnlyStrict(p) | ||||||
| 				if uc.Differ != "" { | 				if uc.Differ != "" { | ||||||
| 					plugin, ok := diffPlugins[uc.Differ] | 					inst, err := ic.GetByID(plugins.DiffPlugin, uc.Differ) | ||||||
| 					if !ok { |  | ||||||
| 						return nil, fmt.Errorf("diff plugin %q: %w", uc.Differ, errdefs.ErrNotFound) |  | ||||||
| 					} |  | ||||||
| 					inst, err := plugin.Instance() |  | ||||||
| 					if err != nil { | 					if err != nil { | ||||||
| 						return nil, fmt.Errorf("failed to get instance for diff plugin %q: %w", uc.Differ, err) | 						return nil, fmt.Errorf("failed to get instance for diff plugin %q: %w", uc.Differ, err) | ||||||
| 					} | 					} | ||||||
| 					applier = inst.(diff.Applier) | 					applier = inst.(diff.Applier) | ||||||
| 				} else { | 				} else { | ||||||
| 					for name, plugin := range diffPlugins { | 					for name, plugin := range ic.GetAll() { | ||||||
|  | 						if plugin.Registration.Type != plugins.DiffPlugin { | ||||||
|  | 							continue | ||||||
|  | 						} | ||||||
| 						var matched bool | 						var matched bool | ||||||
| 						for _, p := range plugin.Meta.Platforms { | 						for _, p := range plugin.Meta.Platforms { | ||||||
| 							if target.Match(p) { | 							if target.Match(p) { | ||||||
|   | |||||||
| @@ -20,7 +20,7 @@ | |||||||
| // package. | // package. | ||||||
| package plugins | package plugins | ||||||
|  |  | ||||||
| import "github.com/containerd/containerd/v2/plugin" | import "github.com/containerd/plugin" | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
| 	// InternalPlugin implements an internal plugin to containerd | 	// InternalPlugin implements an internal plugin to containerd | ||||||
|   | |||||||
| @@ -25,11 +25,11 @@ import ( | |||||||
|  |  | ||||||
| 	containerd "github.com/containerd/containerd/v2/client" | 	containerd "github.com/containerd/containerd/v2/client" | ||||||
| 	"github.com/containerd/containerd/v2/namespaces" | 	"github.com/containerd/containerd/v2/namespaces" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/runtime/restart" | 	"github.com/containerd/containerd/v2/runtime/restart" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type duration struct { | type duration struct { | ||||||
|   | |||||||
| @@ -23,11 +23,11 @@ import ( | |||||||
| 	taskAPI "github.com/containerd/containerd/v2/api/runtime/task/v2" | 	taskAPI "github.com/containerd/containerd/v2/api/runtime/task/v2" | ||||||
| 	"github.com/containerd/containerd/v2/errdefs" | 	"github.com/containerd/containerd/v2/errdefs" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/shutdown" | 	"github.com/containerd/containerd/v2/pkg/shutdown" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | ||||||
| 	"github.com/containerd/containerd/v2/runtime/v2/shim" | 	"github.com/containerd/containerd/v2/runtime/v2/shim" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"github.com/containerd/ttrpc" | 	"github.com/containerd/ttrpc" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -34,14 +34,14 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/pkg/cleanup" | 	"github.com/containerd/containerd/v2/pkg/cleanup" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/timeout" | 	"github.com/containerd/containerd/v2/pkg/timeout" | ||||||
| 	"github.com/containerd/containerd/v2/platforms" | 	"github.com/containerd/containerd/v2/platforms" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/protobuf" | 	"github.com/containerd/containerd/v2/protobuf" | ||||||
| 	"github.com/containerd/containerd/v2/runtime" | 	"github.com/containerd/containerd/v2/runtime" | ||||||
| 	shimbinary "github.com/containerd/containerd/v2/runtime/v2/shim" | 	shimbinary "github.com/containerd/containerd/v2/runtime/v2/shim" | ||||||
| 	"github.com/containerd/containerd/v2/sandbox" | 	"github.com/containerd/containerd/v2/sandbox" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // Config for the v2 runtime | // Config for the v2 runtime | ||||||
| @@ -72,7 +72,7 @@ func init() { | |||||||
|  |  | ||||||
| 			ic.Meta.Platforms = supportedPlatforms | 			ic.Meta.Platforms = supportedPlatforms | ||||||
|  |  | ||||||
| 			m, err := ic.Get(plugins.MetadataPlugin) | 			m, err := ic.GetSingle(plugins.MetadataPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -22,16 +22,15 @@ import ( | |||||||
| 	"context" | 	"context" | ||||||
| 	"runtime" | 	"runtime" | ||||||
|  |  | ||||||
|  | 	api "github.com/containerd/containerd/v2/api/runtime/sandbox/v1" | ||||||
| 	"github.com/containerd/containerd/v2/api/types" | 	"github.com/containerd/containerd/v2/api/types" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/shutdown" | 	"github.com/containerd/containerd/v2/pkg/shutdown" | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/runtime/v2/shim" | 	"github.com/containerd/containerd/v2/runtime/v2/shim" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"github.com/containerd/ttrpc" | 	"github.com/containerd/ttrpc" | ||||||
|  |  | ||||||
| 	api "github.com/containerd/containerd/v2/api/runtime/sandbox/v1" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
|   | |||||||
| @@ -18,11 +18,11 @@ package plugin | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/containerd/containerd/v2/pkg/shutdown" | 	"github.com/containerd/containerd/v2/pkg/shutdown" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/runtime/v2/runc/task" | 	"github.com/containerd/containerd/v2/runtime/v2/runc/task" | ||||||
| 	"github.com/containerd/containerd/v2/runtime/v2/shim" | 	"github.com/containerd/containerd/v2/runtime/v2/shim" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
|   | |||||||
| @@ -34,13 +34,13 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/events" | 	"github.com/containerd/containerd/v2/events" | ||||||
| 	"github.com/containerd/containerd/v2/namespaces" | 	"github.com/containerd/containerd/v2/namespaces" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/shutdown" | 	"github.com/containerd/containerd/v2/pkg/shutdown" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/protobuf" | 	"github.com/containerd/containerd/v2/protobuf" | ||||||
| 	"github.com/containerd/containerd/v2/protobuf/proto" | 	"github.com/containerd/containerd/v2/protobuf/proto" | ||||||
| 	"github.com/containerd/containerd/v2/version" | 	"github.com/containerd/containerd/v2/version" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"github.com/containerd/ttrpc" | 	"github.com/containerd/ttrpc" | ||||||
| 	"github.com/sirupsen/logrus" | 	"github.com/sirupsen/logrus" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -26,11 +26,11 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/errdefs" | 	"github.com/containerd/containerd/v2/errdefs" | ||||||
| 	"github.com/containerd/containerd/v2/events" | 	"github.com/containerd/containerd/v2/events" | ||||||
| 	"github.com/containerd/containerd/v2/metadata" | 	"github.com/containerd/containerd/v2/metadata" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	bolt "go.etcd.io/bbolt" | 	bolt "go.etcd.io/bbolt" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
| 	"google.golang.org/grpc/codes" | 	"google.golang.org/grpc/codes" | ||||||
| @@ -47,11 +47,11 @@ func init() { | |||||||
| 			plugins.MetadataPlugin, | 			plugins.MetadataPlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			m, err := ic.Get(plugins.MetadataPlugin) | 			m, err := ic.GetSingle(plugins.MetadataPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
| 			ep, err := ic.Get(plugins.EventPlugin) | 			ep, err := ic.GetSingle(plugins.EventPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -18,15 +18,14 @@ package containers | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"errors" |  | ||||||
| 	"io" | 	"io" | ||||||
|  |  | ||||||
| 	api "github.com/containerd/containerd/v2/api/services/containers/v1" | 	api "github.com/containerd/containerd/v2/api/services/containers/v1" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -38,15 +37,7 @@ func init() { | |||||||
| 			plugins.ServicePlugin, | 			plugins.ServicePlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			sps, err := ic.GetByType(plugins.ServicePlugin) | 			i, err := ic.GetByID(plugins.ServicePlugin, services.ContainersService) | ||||||
| 			if err != nil { |  | ||||||
| 				return nil, err |  | ||||||
| 			} |  | ||||||
| 			p, ok := sps[services.ContainersService] |  | ||||||
| 			if !ok { |  | ||||||
| 				return nil, errors.New("containers service not found") |  | ||||||
| 			} |  | ||||||
| 			i, err := p.Instance() |  | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -17,14 +17,12 @@ | |||||||
| package content | package content | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"errors" |  | ||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/v2/content" | 	"github.com/containerd/containerd/v2/content" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
| 	"github.com/containerd/containerd/v2/services/content/contentserver" | 	"github.com/containerd/containerd/v2/services/content/contentserver" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| @@ -35,15 +33,7 @@ func init() { | |||||||
| 			plugins.ServicePlugin, | 			plugins.ServicePlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			plugins, err := ic.GetByType(plugins.ServicePlugin) | 			cs, err := ic.GetByID(plugins.ServicePlugin, services.ContentService) | ||||||
| 			if err != nil { |  | ||||||
| 				return nil, err |  | ||||||
| 			} |  | ||||||
| 			p, ok := plugins[services.ContentService] |  | ||||||
| 			if !ok { |  | ||||||
| 				return nil, errors.New("content store service not found") |  | ||||||
| 			} |  | ||||||
| 			cs, err := p.Instance() |  | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -23,10 +23,10 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/content" | 	"github.com/containerd/containerd/v2/content" | ||||||
| 	"github.com/containerd/containerd/v2/events" | 	"github.com/containerd/containerd/v2/events" | ||||||
| 	"github.com/containerd/containerd/v2/metadata" | 	"github.com/containerd/containerd/v2/metadata" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	digest "github.com/opencontainers/go-digest" | 	digest "github.com/opencontainers/go-digest" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -45,11 +45,11 @@ func init() { | |||||||
| 			plugins.MetadataPlugin, | 			plugins.MetadataPlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			m, err := ic.Get(plugins.MetadataPlugin) | 			m, err := ic.GetSingle(plugins.MetadataPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
| 			ep, err := ic.Get(plugins.EventPlugin) | 			ep, err := ic.GetSingle(plugins.EventPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -25,10 +25,10 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/errdefs" | 	"github.com/containerd/containerd/v2/errdefs" | ||||||
| 	"github.com/containerd/containerd/v2/mount" | 	"github.com/containerd/containerd/v2/mount" | ||||||
| 	"github.com/containerd/containerd/v2/oci" | 	"github.com/containerd/containerd/v2/oci" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"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" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
| @@ -66,14 +66,10 @@ func init() { | |||||||
| 			orderedNames := ic.Config.(*config).Order | 			orderedNames := ic.Config.(*config).Order | ||||||
| 			ordered := make([]differ, len(orderedNames)) | 			ordered := make([]differ, len(orderedNames)) | ||||||
| 			for i, n := range orderedNames { | 			for i, n := range orderedNames { | ||||||
| 				differp, ok := differs[n] | 				d, ok := differs[n] | ||||||
| 				if !ok { | 				if !ok { | ||||||
| 					return nil, fmt.Errorf("needed differ not loaded: %s", n) | 					return nil, fmt.Errorf("needed differ not loaded: %s", n) | ||||||
| 				} | 				} | ||||||
| 				d, err := differp.Instance() |  | ||||||
| 				if err != nil { |  | ||||||
| 					return nil, fmt.Errorf("could not load required differ due plugin init error: %s: %w", n, err) |  | ||||||
| 				} |  | ||||||
|  |  | ||||||
| 				ordered[i], ok = d.(differ) | 				ordered[i], ok = d.(differ) | ||||||
| 				if !ok { | 				if !ok { | ||||||
|   | |||||||
| @@ -18,13 +18,12 @@ package diff | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"errors" |  | ||||||
|  |  | ||||||
| 	diffapi "github.com/containerd/containerd/v2/api/services/diff/v1" | 	diffapi "github.com/containerd/containerd/v2/api/services/diff/v1" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -36,15 +35,7 @@ func init() { | |||||||
| 			plugins.ServicePlugin, | 			plugins.ServicePlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			sps, err := ic.GetByType(plugins.ServicePlugin) | 			i, err := ic.GetByID(plugins.ServicePlugin, services.DiffService) | ||||||
| 			if err != nil { |  | ||||||
| 				return nil, err |  | ||||||
| 			} |  | ||||||
| 			p, ok := sps[services.DiffService] |  | ||||||
| 			if !ok { |  | ||||||
| 				return nil, errors.New("diff service not found") |  | ||||||
| 			} |  | ||||||
| 			i, err := p.Instance() |  | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -25,11 +25,11 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/errdefs" | 	"github.com/containerd/containerd/v2/errdefs" | ||||||
| 	"github.com/containerd/containerd/v2/events" | 	"github.com/containerd/containerd/v2/events" | ||||||
| 	"github.com/containerd/containerd/v2/events/exchange" | 	"github.com/containerd/containerd/v2/events/exchange" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/protobuf" | 	"github.com/containerd/containerd/v2/protobuf" | ||||||
| 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"github.com/containerd/ttrpc" | 	"github.com/containerd/ttrpc" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -17,9 +17,9 @@ | |||||||
| package healthcheck | package healthcheck | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
|  |  | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
| 	"google.golang.org/grpc/health" | 	"google.golang.org/grpc/health" | ||||||
|   | |||||||
| @@ -33,12 +33,12 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/metadata" | 	"github.com/containerd/containerd/v2/metadata" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/deprecation" | 	"github.com/containerd/containerd/v2/pkg/deprecation" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/epoch" | 	"github.com/containerd/containerd/v2/pkg/epoch" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
| 	"github.com/containerd/containerd/v2/services/warning" | 	"github.com/containerd/containerd/v2/services/warning" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| @@ -52,19 +52,19 @@ func init() { | |||||||
| 			plugins.WarningPlugin, | 			plugins.WarningPlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			m, err := ic.Get(plugins.MetadataPlugin) | 			m, err := ic.GetSingle(plugins.MetadataPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
| 			g, err := ic.Get(plugins.GCPlugin) | 			g, err := ic.GetSingle(plugins.GCPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
| 			ep, err := ic.Get(plugins.EventPlugin) | 			ep, err := ic.GetSingle(plugins.EventPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
| 			w, err := ic.Get(plugins.WarningPlugin) | 			w, err := ic.GetSingle(plugins.WarningPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -18,14 +18,13 @@ package images | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"errors" |  | ||||||
|  |  | ||||||
| 	imagesapi "github.com/containerd/containerd/v2/api/services/images/v1" | 	imagesapi "github.com/containerd/containerd/v2/api/services/images/v1" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -37,15 +36,7 @@ func init() { | |||||||
| 			plugins.ServicePlugin, | 			plugins.ServicePlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			sps, err := ic.GetByType(plugins.ServicePlugin) | 			i, err := ic.GetByID(plugins.ServicePlugin, services.ImagesService) | ||||||
| 			if err != nil { |  | ||||||
| 				return nil, err |  | ||||||
| 			} |  | ||||||
| 			p, ok := sps[services.ImagesService] |  | ||||||
| 			if !ok { |  | ||||||
| 				return nil, errors.New("images service not found") |  | ||||||
| 			} |  | ||||||
| 			i, err := p.Instance() |  | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -34,13 +34,13 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/api/types" | 	"github.com/containerd/containerd/v2/api/types" | ||||||
| 	"github.com/containerd/containerd/v2/errdefs" | 	"github.com/containerd/containerd/v2/errdefs" | ||||||
| 	"github.com/containerd/containerd/v2/filters" | 	"github.com/containerd/containerd/v2/filters" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/protobuf" | 	"github.com/containerd/containerd/v2/protobuf" | ||||||
| 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
| 	"github.com/containerd/containerd/v2/services/warning" | 	"github.com/containerd/containerd/v2/services/warning" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| @@ -49,16 +49,7 @@ func init() { | |||||||
| 		ID:       services.IntrospectionService, | 		ID:       services.IntrospectionService, | ||||||
| 		Requires: []plugin.Type{plugins.WarningPlugin}, | 		Requires: []plugin.Type{plugins.WarningPlugin}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			sps, err := ic.GetByType(plugins.WarningPlugin) | 			i, err := ic.GetByID(plugins.WarningPlugin, plugins.DeprecationsPlugin) | ||||||
| 			if err != nil { |  | ||||||
| 				return nil, err |  | ||||||
| 			} |  | ||||||
| 			p, ok := sps[plugins.DeprecationsPlugin] |  | ||||||
| 			if !ok { |  | ||||||
| 				return nil, errors.New("warning service not found") |  | ||||||
| 			} |  | ||||||
|  |  | ||||||
| 			i, err := p.Instance() |  | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -21,11 +21,11 @@ import ( | |||||||
| 	"errors" | 	"errors" | ||||||
|  |  | ||||||
| 	api "github.com/containerd/containerd/v2/api/services/introspection/v1" | 	api "github.com/containerd/containerd/v2/api/services/introspection/v1" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -35,16 +35,7 @@ func init() { | |||||||
| 		ID:       "introspection", | 		ID:       "introspection", | ||||||
| 		Requires: []plugin.Type{plugins.ServicePlugin}, | 		Requires: []plugin.Type{plugins.ServicePlugin}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			sps, err := ic.GetByType(plugins.ServicePlugin) | 			i, err := ic.GetByID(plugins.ServicePlugin, services.IntrospectionService) | ||||||
| 			if err != nil { |  | ||||||
| 				return nil, err |  | ||||||
| 			} |  | ||||||
| 			p, ok := sps[services.IntrospectionService] |  | ||||||
| 			if !ok { |  | ||||||
| 				return nil, errors.New("introspection service not found") |  | ||||||
| 			} |  | ||||||
|  |  | ||||||
| 			i, err := p.Instance() |  | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -22,11 +22,11 @@ import ( | |||||||
| 	api "github.com/containerd/containerd/v2/api/services/leases/v1" | 	api "github.com/containerd/containerd/v2/api/services/leases/v1" | ||||||
| 	"github.com/containerd/containerd/v2/errdefs" | 	"github.com/containerd/containerd/v2/errdefs" | ||||||
| 	"github.com/containerd/containerd/v2/leases" | 	"github.com/containerd/containerd/v2/leases" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/protobuf" | 	"github.com/containerd/containerd/v2/protobuf" | ||||||
| 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -26,11 +26,11 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/events" | 	"github.com/containerd/containerd/v2/events" | ||||||
| 	"github.com/containerd/containerd/v2/metadata" | 	"github.com/containerd/containerd/v2/metadata" | ||||||
| 	"github.com/containerd/containerd/v2/namespaces" | 	"github.com/containerd/containerd/v2/namespaces" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	bolt "go.etcd.io/bbolt" | 	bolt "go.etcd.io/bbolt" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
| 	"google.golang.org/grpc/codes" | 	"google.golang.org/grpc/codes" | ||||||
| @@ -46,11 +46,11 @@ func init() { | |||||||
| 			plugins.MetadataPlugin, | 			plugins.MetadataPlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			m, err := ic.Get(plugins.MetadataPlugin) | 			m, err := ic.GetSingle(plugins.MetadataPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
| 			ep, err := ic.Get(plugins.EventPlugin) | 			ep, err := ic.GetSingle(plugins.EventPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -18,14 +18,13 @@ package namespaces | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"errors" |  | ||||||
|  |  | ||||||
| 	api "github.com/containerd/containerd/v2/api/services/namespaces/v1" | 	api "github.com/containerd/containerd/v2/api/services/namespaces/v1" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -37,15 +36,7 @@ func init() { | |||||||
| 			plugins.ServicePlugin, | 			plugins.ServicePlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			sps, err := ic.GetByType(plugins.ServicePlugin) | 			i, err := ic.GetByID(plugins.ServicePlugin, services.NamespacesService) | ||||||
| 			if err != nil { |  | ||||||
| 				return nil, err |  | ||||||
| 			} |  | ||||||
| 			p, ok := sps[services.NamespacesService] |  | ||||||
| 			if !ok { |  | ||||||
| 				return nil, errors.New("namespaces service not found") |  | ||||||
| 			} |  | ||||||
| 			i, err := p.Instance() |  | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -21,9 +21,9 @@ import ( | |||||||
| 	"os" | 	"os" | ||||||
| 	"path/filepath" | 	"path/filepath" | ||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // Config for the opt manager | // Config for the opt manager | ||||||
|   | |||||||
| @@ -18,7 +18,6 @@ package sandbox | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"errors" |  | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
| @@ -29,13 +28,13 @@ import ( | |||||||
| 	api "github.com/containerd/containerd/v2/api/services/sandbox/v1" | 	api "github.com/containerd/containerd/v2/api/services/sandbox/v1" | ||||||
| 	"github.com/containerd/containerd/v2/errdefs" | 	"github.com/containerd/containerd/v2/errdefs" | ||||||
| 	"github.com/containerd/containerd/v2/events" | 	"github.com/containerd/containerd/v2/events" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/protobuf" | 	"github.com/containerd/containerd/v2/protobuf" | ||||||
| 	"github.com/containerd/containerd/v2/sandbox" | 	"github.com/containerd/containerd/v2/sandbox" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| @@ -47,20 +46,12 @@ func init() { | |||||||
| 			plugins.EventPlugin, | 			plugins.EventPlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			plugs, err := ic.GetByType(plugins.ServicePlugin) | 			i, err := ic.GetByID(plugins.ServicePlugin, services.SandboxControllersService) | ||||||
| 			if err != nil { |  | ||||||
| 				return nil, err |  | ||||||
| 			} |  | ||||||
| 			p, ok := plugs[services.SandboxControllersService] |  | ||||||
| 			if !ok { |  | ||||||
| 				return nil, errors.New("sandboxes service not found") |  | ||||||
| 			} |  | ||||||
| 			i, err := p.Instance() |  | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
| 			sc := i.(map[string]sandbox.Controller) | 			sc := i.(map[string]sandbox.Controller) | ||||||
| 			ep, err := ic.Get(plugins.EventPlugin) | 			ep, err := ic.GetSingle(plugins.EventPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -17,11 +17,11 @@ | |||||||
| package sandbox | package sandbox | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/sandbox" | 	"github.com/containerd/containerd/v2/sandbox" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| @@ -38,11 +38,7 @@ func init() { | |||||||
| 			} | 			} | ||||||
| 			sandboxers := make(map[string]sandbox.Controller) | 			sandboxers := make(map[string]sandbox.Controller) | ||||||
| 			for name, srv := range sandboxesRaw { | 			for name, srv := range sandboxesRaw { | ||||||
| 				inst, err := srv.Instance() | 				sandboxers[name] = srv.(sandbox.Controller) | ||||||
| 				if err != nil { |  | ||||||
| 					return nil, err |  | ||||||
| 				} |  | ||||||
| 				sandboxers[name] = inst.(sandbox.Controller) |  | ||||||
| 			} | 			} | ||||||
| 			return sandboxers, nil | 			return sandboxers, nil | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
| @@ -24,11 +24,11 @@ import ( | |||||||
| 	api "github.com/containerd/containerd/v2/api/services/sandbox/v1" | 	api "github.com/containerd/containerd/v2/api/services/sandbox/v1" | ||||||
| 	"github.com/containerd/containerd/v2/api/types" | 	"github.com/containerd/containerd/v2/api/types" | ||||||
| 	"github.com/containerd/containerd/v2/errdefs" | 	"github.com/containerd/containerd/v2/errdefs" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/sandbox" | 	"github.com/containerd/containerd/v2/sandbox" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
|   | |||||||
| @@ -36,8 +36,8 @@ import ( | |||||||
| 	"github.com/pelletier/go-toml/v2" | 	"github.com/pelletier/go-toml/v2" | ||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/v2/errdefs" | 	"github.com/containerd/containerd/v2/errdefs" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // CurrentConfigVersion is the max config version which is supported | // CurrentConfigVersion is the max config version which is supported | ||||||
|   | |||||||
| @@ -59,15 +59,15 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/pkg/dialer" | 	"github.com/containerd/containerd/v2/pkg/dialer" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/timeout" | 	"github.com/containerd/containerd/v2/pkg/timeout" | ||||||
| 	"github.com/containerd/containerd/v2/platforms" | 	"github.com/containerd/containerd/v2/platforms" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/dynamic" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	sbproxy "github.com/containerd/containerd/v2/sandbox/proxy" | 	sbproxy "github.com/containerd/containerd/v2/sandbox/proxy" | ||||||
| 	srvconfig "github.com/containerd/containerd/v2/services/server/config" | 	srvconfig "github.com/containerd/containerd/v2/services/server/config" | ||||||
| 	"github.com/containerd/containerd/v2/services/warning" | 	"github.com/containerd/containerd/v2/services/warning" | ||||||
| 	ssproxy "github.com/containerd/containerd/v2/snapshots/proxy" | 	ssproxy "github.com/containerd/containerd/v2/snapshots/proxy" | ||||||
| 	"github.com/containerd/containerd/v2/sys" | 	"github.com/containerd/containerd/v2/sys" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/dynamic" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // CreateTopLevelDirectories creates the top-level root and state directories. | // CreateTopLevelDirectories creates the top-level root and state directories. | ||||||
| @@ -341,9 +341,9 @@ func New(ctx context.Context, config *srvconfig.Config) (*Server, error) { | |||||||
| // recordConfigDeprecations attempts to record use of any deprecated config field.  Failures are logged and ignored. | // recordConfigDeprecations attempts to record use of any deprecated config field.  Failures are logged and ignored. | ||||||
| func recordConfigDeprecations(ctx context.Context, config *srvconfig.Config, set *plugin.Set) { | func recordConfigDeprecations(ctx context.Context, config *srvconfig.Config, set *plugin.Set) { | ||||||
| 	// record any detected deprecations without blocking server startup | 	// record any detected deprecations without blocking server startup | ||||||
| 	plugin, err := set.GetByID(plugins.WarningPlugin, plugins.DeprecationsPlugin) | 	plugin := set.Get(plugins.WarningPlugin, plugins.DeprecationsPlugin) | ||||||
| 	if err != nil { | 	if plugin == nil { | ||||||
| 		log.G(ctx).WithError(err).Warn("failed to load warning service to record deprecations") | 		log.G(ctx).Warn("failed to find warning service to record deprecations") | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 	instance, err := plugin.Instance() | 	instance, err := plugin.Instance() | ||||||
|   | |||||||
| @@ -20,9 +20,9 @@ import ( | |||||||
| 	"context" | 	"context" | ||||||
| 	"testing" | 	"testing" | ||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	srvconfig "github.com/containerd/containerd/v2/services/server/config" | 	srvconfig "github.com/containerd/containerd/v2/services/server/config" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"github.com/stretchr/testify/assert" | 	"github.com/stretchr/testify/assert" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -18,18 +18,17 @@ package snapshots | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"errors" |  | ||||||
|  |  | ||||||
| 	snapshotsapi "github.com/containerd/containerd/v2/api/services/snapshots/v1" | 	snapshotsapi "github.com/containerd/containerd/v2/api/services/snapshots/v1" | ||||||
| 	"github.com/containerd/containerd/v2/errdefs" | 	"github.com/containerd/containerd/v2/errdefs" | ||||||
| 	"github.com/containerd/containerd/v2/mount" | 	"github.com/containerd/containerd/v2/mount" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
| 	"github.com/containerd/containerd/v2/snapshots" | 	"github.com/containerd/containerd/v2/snapshots" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -52,20 +51,11 @@ type service struct { | |||||||
| } | } | ||||||
|  |  | ||||||
| func newService(ic *plugin.InitContext) (interface{}, error) { | func newService(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 	sps, err := ic.GetByType(plugins.ServicePlugin) | 	i, err := ic.GetByID(plugins.ServicePlugin, services.SnapshotsService) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, err | 		return nil, err | ||||||
| 	} | 	} | ||||||
| 	p, ok := sps[services.SnapshotsService] | 	return &service{ss: i.(map[string]snapshots.Snapshotter)}, nil | ||||||
| 	if !ok { |  | ||||||
| 		return nil, errors.New("snapshots service not found") |  | ||||||
| 	} |  | ||||||
| 	i, err := p.Instance() |  | ||||||
| 	if err != nil { |  | ||||||
| 		return nil, err |  | ||||||
| 	} |  | ||||||
| 	ss := i.(map[string]snapshots.Snapshotter) |  | ||||||
| 	return &service{ss: ss}, nil |  | ||||||
| } | } | ||||||
|  |  | ||||||
| func (s *service) getSnapshotter(name string) (snapshots.Snapshotter, error) { | func (s *service) getSnapshotter(name string) (snapshots.Snapshotter, error) { | ||||||
|   | |||||||
| @@ -18,10 +18,10 @@ package snapshots | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/containerd/containerd/v2/metadata" | 	"github.com/containerd/containerd/v2/metadata" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| @@ -32,7 +32,7 @@ func init() { | |||||||
| 			plugins.MetadataPlugin, | 			plugins.MetadataPlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			m, err := ic.Get(plugins.MetadataPlugin) | 			m, err := ic.GetSingle(plugins.MetadataPlugin) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -23,12 +23,12 @@ import ( | |||||||
| 	api "github.com/containerd/containerd/v2/api/services/streaming/v1" | 	api "github.com/containerd/containerd/v2/api/services/streaming/v1" | ||||||
| 	"github.com/containerd/containerd/v2/errdefs" | 	"github.com/containerd/containerd/v2/errdefs" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/streaming" | 	"github.com/containerd/containerd/v2/pkg/streaming" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/protobuf" | 	"github.com/containerd/containerd/v2/protobuf" | ||||||
| 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"github.com/containerd/typeurl/v2" | 	"github.com/containerd/typeurl/v2" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -41,8 +41,6 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/pkg/blockio" | 	"github.com/containerd/containerd/v2/pkg/blockio" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/rdt" | 	"github.com/containerd/containerd/v2/pkg/rdt" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/timeout" | 	"github.com/containerd/containerd/v2/pkg/timeout" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/protobuf" | 	"github.com/containerd/containerd/v2/protobuf" | ||||||
| 	"github.com/containerd/containerd/v2/protobuf/proto" | 	"github.com/containerd/containerd/v2/protobuf/proto" | ||||||
| @@ -51,6 +49,8 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/runtime/v2/runc/options" | 	"github.com/containerd/containerd/v2/runtime/v2/runc/options" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"github.com/containerd/typeurl/v2" | 	"github.com/containerd/typeurl/v2" | ||||||
| 	"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" | ||||||
| @@ -96,17 +96,17 @@ func initFunc(ic *plugin.InitContext) (interface{}, error) { | |||||||
| 		return nil, err | 		return nil, err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	m, err := ic.Get(plugins.MetadataPlugin) | 	m, err := ic.GetSingle(plugins.MetadataPlugin) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, err | 		return nil, err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	ep, err := ic.Get(plugins.EventPlugin) | 	ep, err := ic.GetSingle(plugins.EventPlugin) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, err | 		return nil, err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	monitor, err := ic.Get(plugins.TaskMonitorPlugin) | 	monitor, err := ic.GetSingle(plugins.TaskMonitorPlugin) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		if !errors.Is(err, plugin.ErrPluginNotFound) { | 		if !errors.Is(err, plugin.ErrPluginNotFound) { | ||||||
| 			return nil, err | 			return nil, err | ||||||
|   | |||||||
| @@ -19,8 +19,8 @@ | |||||||
| package tasks | package tasks | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var tasksServiceRequires = []plugin.Type{ | var tasksServiceRequires = []plugin.Type{ | ||||||
|   | |||||||
| @@ -17,8 +17,8 @@ | |||||||
| package tasks | package tasks | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var tasksServiceRequires = []plugin.Type{ | var tasksServiceRequires = []plugin.Type{ | ||||||
|   | |||||||
| @@ -19,8 +19,8 @@ | |||||||
| package tasks | package tasks | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var tasksServiceRequires = []plugin.Type{ | var tasksServiceRequires = []plugin.Type{ | ||||||
|   | |||||||
| @@ -17,8 +17,8 @@ | |||||||
| package tasks | package tasks | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var tasksServiceRequires = []plugin.Type{ | var tasksServiceRequires = []plugin.Type{ | ||||||
|   | |||||||
| @@ -18,14 +18,13 @@ package tasks | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"errors" |  | ||||||
|  |  | ||||||
| 	api "github.com/containerd/containerd/v2/api/services/tasks/v1" | 	api "github.com/containerd/containerd/v2/api/services/tasks/v1" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | ||||||
| 	"github.com/containerd/containerd/v2/services" | 	"github.com/containerd/containerd/v2/services" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -41,15 +40,7 @@ func init() { | |||||||
| 			plugins.ServicePlugin, | 			plugins.ServicePlugin, | ||||||
| 		}, | 		}, | ||||||
| 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | 		InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||||||
| 			sps, err := ic.GetByType(plugins.ServicePlugin) | 			i, err := ic.GetByID(plugins.ServicePlugin, services.TasksService) | ||||||
| 			if err != nil { |  | ||||||
| 				return nil, err |  | ||||||
| 			} |  | ||||||
| 			p, ok := sps[services.TasksService] |  | ||||||
| 			if !ok { |  | ||||||
| 				return nil, errors.New("tasks service not found") |  | ||||||
| 			} |  | ||||||
| 			i, err := p.Instance() |  | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return nil, err | 				return nil, err | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -25,11 +25,11 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/pkg/streaming" | 	"github.com/containerd/containerd/v2/pkg/streaming" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/transfer" | 	"github.com/containerd/containerd/v2/pkg/transfer" | ||||||
| 	tplugins "github.com/containerd/containerd/v2/pkg/transfer/plugins" | 	tplugins "github.com/containerd/containerd/v2/pkg/transfer/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"github.com/containerd/typeurl/v2" | 	"github.com/containerd/typeurl/v2" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
| 	"google.golang.org/grpc/codes" | 	"google.golang.org/grpc/codes" | ||||||
| @@ -64,11 +64,7 @@ func newService(ic *plugin.InitContext) (interface{}, error) { | |||||||
| 	// TODO: how to determine order? | 	// TODO: how to determine order? | ||||||
| 	t := make([]transfer.Transferrer, 0, len(sps)) | 	t := make([]transfer.Transferrer, 0, len(sps)) | ||||||
| 	for _, p := range sps { | 	for _, p := range sps { | ||||||
| 		i, err := p.Instance() | 		t = append(t, p.(transfer.Transferrer)) | ||||||
| 		if err != nil { |  | ||||||
| 			return nil, err |  | ||||||
| 		} |  | ||||||
| 		t = append(t, i.(transfer.Transferrer)) |  | ||||||
| 	} | 	} | ||||||
| 	sp, err := ic.GetByID(plugins.StreamingPlugin, "manager") | 	sp, err := ic.GetByID(plugins.StreamingPlugin, "manager") | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
|   | |||||||
| @@ -20,11 +20,11 @@ import ( | |||||||
| 	"context" | 	"context" | ||||||
|  |  | ||||||
| 	api "github.com/containerd/containerd/v2/api/services/version/v1" | 	api "github.com/containerd/containerd/v2/api/services/version/v1" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | 	ptypes "github.com/containerd/containerd/v2/protobuf/types" | ||||||
| 	ctrdversion "github.com/containerd/containerd/v2/version" | 	ctrdversion "github.com/containerd/containerd/v2/version" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -24,9 +24,9 @@ import ( | |||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  |  | ||||||
| 	deprecation "github.com/containerd/containerd/v2/pkg/deprecation" | 	deprecation "github.com/containerd/containerd/v2/pkg/deprecation" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type Service interface { | type Service interface { | ||||||
|   | |||||||
| @@ -25,11 +25,11 @@ import ( | |||||||
| 	"runtime" | 	"runtime" | ||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/v2/mount" | 	"github.com/containerd/containerd/v2/mount" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/snapshots" | 	"github.com/containerd/containerd/v2/snapshots" | ||||||
| 	"github.com/containerd/containerd/v2/snapshots/storage" | 	"github.com/containerd/containerd/v2/snapshots/storage" | ||||||
| 	"github.com/containerd/continuity/fs" | 	"github.com/containerd/continuity/fs" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // viewHookHelper is only used in test for recover the filesystem. | // viewHookHelper is only used in test for recover the filesystem. | ||||||
|   | |||||||
| @@ -20,10 +20,10 @@ import ( | |||||||
| 	"errors" | 	"errors" | ||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/v2/platforms" | 	"github.com/containerd/containerd/v2/platforms" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/snapshots/blockfile" | 	"github.com/containerd/containerd/v2/snapshots/blockfile" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // Config represents configuration for the native plugin. | // Config represents configuration for the native plugin. | ||||||
|   | |||||||
| @@ -29,10 +29,10 @@ import ( | |||||||
| 	"github.com/containerd/continuity/fs" | 	"github.com/containerd/continuity/fs" | ||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/v2/mount" | 	"github.com/containerd/containerd/v2/mount" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/snapshots" | 	"github.com/containerd/containerd/v2/snapshots" | ||||||
| 	"github.com/containerd/containerd/v2/snapshots/storage" | 	"github.com/containerd/containerd/v2/snapshots/storage" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type snapshotter struct { | type snapshotter struct { | ||||||
|   | |||||||
| @@ -31,10 +31,10 @@ import ( | |||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/v2/mount" | 	"github.com/containerd/containerd/v2/mount" | ||||||
| 	"github.com/containerd/containerd/v2/pkg/testutil" | 	"github.com/containerd/containerd/v2/pkg/testutil" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/snapshots" | 	"github.com/containerd/containerd/v2/snapshots" | ||||||
| 	"github.com/containerd/containerd/v2/snapshots/testsuite" | 	"github.com/containerd/containerd/v2/snapshots/testsuite" | ||||||
| 	"github.com/containerd/continuity/testutil/loopback" | 	"github.com/containerd/continuity/testutil/loopback" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
| 	exec "golang.org/x/sys/execabs" | 	exec "golang.org/x/sys/execabs" | ||||||
| 	"golang.org/x/sys/unix" | 	"golang.org/x/sys/unix" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -24,10 +24,10 @@ import ( | |||||||
| 	ocispec "github.com/opencontainers/image-spec/specs-go/v1" | 	ocispec "github.com/opencontainers/image-spec/specs-go/v1" | ||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/v2/platforms" | 	"github.com/containerd/containerd/v2/platforms" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/snapshots/btrfs" | 	"github.com/containerd/containerd/v2/snapshots/btrfs" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // Config represents configuration for the btrfs plugin. | // Config represents configuration for the btrfs plugin. | ||||||
|   | |||||||
| @@ -23,10 +23,10 @@ import ( | |||||||
| 	"fmt" | 	"fmt" | ||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/v2/platforms" | 	"github.com/containerd/containerd/v2/platforms" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/snapshots/devmapper" | 	"github.com/containerd/containerd/v2/snapshots/devmapper" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
|   | |||||||
| @@ -36,13 +36,13 @@ import ( | |||||||
| 	"github.com/Microsoft/hcsshim/pkg/go-runhcs" | 	"github.com/Microsoft/hcsshim/pkg/go-runhcs" | ||||||
| 	"github.com/containerd/containerd/v2/errdefs" | 	"github.com/containerd/containerd/v2/errdefs" | ||||||
| 	"github.com/containerd/containerd/v2/mount" | 	"github.com/containerd/containerd/v2/mount" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/snapshots" | 	"github.com/containerd/containerd/v2/snapshots" | ||||||
| 	"github.com/containerd/containerd/v2/snapshots/storage" | 	"github.com/containerd/containerd/v2/snapshots/storage" | ||||||
| 	"github.com/containerd/continuity/fs" | 	"github.com/containerd/continuity/fs" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	ocispec "github.com/opencontainers/image-spec/specs-go/v1" | 	ocispec "github.com/opencontainers/image-spec/specs-go/v1" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -20,10 +20,10 @@ import ( | |||||||
| 	"errors" | 	"errors" | ||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/v2/platforms" | 	"github.com/containerd/containerd/v2/platforms" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/snapshots/native" | 	"github.com/containerd/containerd/v2/snapshots/native" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // Config represents configuration for the native plugin. | // Config represents configuration for the native plugin. | ||||||
|   | |||||||
| @@ -22,11 +22,11 @@ import ( | |||||||
| 	"errors" | 	"errors" | ||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/v2/platforms" | 	"github.com/containerd/containerd/v2/platforms" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/snapshots/overlay" | 	"github.com/containerd/containerd/v2/snapshots/overlay" | ||||||
| 	"github.com/containerd/containerd/v2/snapshots/overlay/overlayutils" | 	"github.com/containerd/containerd/v2/snapshots/overlay/overlayutils" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
|   | |||||||
| @@ -37,13 +37,13 @@ import ( | |||||||
| 	"github.com/containerd/containerd/v2/errdefs" | 	"github.com/containerd/containerd/v2/errdefs" | ||||||
| 	"github.com/containerd/containerd/v2/mount" | 	"github.com/containerd/containerd/v2/mount" | ||||||
| 	"github.com/containerd/containerd/v2/platforms" | 	"github.com/containerd/containerd/v2/platforms" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/snapshots" | 	"github.com/containerd/containerd/v2/snapshots" | ||||||
| 	"github.com/containerd/containerd/v2/snapshots/storage" | 	"github.com/containerd/containerd/v2/snapshots/storage" | ||||||
| 	"github.com/containerd/continuity/fs" | 	"github.com/containerd/continuity/fs" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/log" | ||||||
|  | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	ocispec "github.com/opencontainers/image-spec/specs-go/v1" | 	ocispec "github.com/opencontainers/image-spec/specs-go/v1" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -24,11 +24,10 @@ import ( | |||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/v2/errdefs" | 	"github.com/containerd/containerd/v2/errdefs" | ||||||
| 	"github.com/containerd/containerd/v2/plugin" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugin/registry" |  | ||||||
| 	"github.com/containerd/containerd/v2/plugins" | 	"github.com/containerd/containerd/v2/plugins" | ||||||
| 	"github.com/containerd/containerd/v2/tracing" | 	"github.com/containerd/containerd/v2/tracing" | ||||||
| 	"github.com/containerd/log" | 	"github.com/containerd/plugin" | ||||||
|  | 	"github.com/containerd/plugin/registry" | ||||||
| 	"github.com/sirupsen/logrus" | 	"github.com/sirupsen/logrus" | ||||||
| 	"go.opentelemetry.io/otel" | 	"go.opentelemetry.io/otel" | ||||||
| 	"go.opentelemetry.io/otel/exporters/otlp/otlptrace" | 	"go.opentelemetry.io/otel/exporters/otlp/otlptrace" | ||||||
| @@ -73,18 +72,8 @@ func init() { | |||||||
| 				return nil, fmt.Errorf("failed to get tracing processors: %w", err) | 				return nil, fmt.Errorf("failed to get tracing processors: %w", err) | ||||||
| 			} | 			} | ||||||
| 			procs := make([]trace.SpanProcessor, 0, len(plugins)) | 			procs := make([]trace.SpanProcessor, 0, len(plugins)) | ||||||
| 			for id, pctx := range plugins { | 			for _, p := range plugins { | ||||||
| 				p, err := pctx.Instance() | 				procs = append(procs, p.(trace.SpanProcessor)) | ||||||
| 				if err != nil { |  | ||||||
| 					if plugin.IsSkipPlugin(err) { |  | ||||||
| 						log.G(ic.Context).WithError(err).Infof("skipping tracing processor initialization (no tracing plugin)") |  | ||||||
| 					} else { |  | ||||||
| 						log.G(ic.Context).WithError(err).Errorf("failed to initialize a tracing processor %q", id) |  | ||||||
| 					} |  | ||||||
| 					continue |  | ||||||
| 				} |  | ||||||
| 				proc := p.(trace.SpanProcessor) |  | ||||||
| 				procs = append(procs, proc) |  | ||||||
| 			} | 			} | ||||||
| 			return newTracer(ic.Context, ic.Config.(*TraceConfig), procs) | 			return newTracer(ic.Context, ic.Config.(*TraceConfig), procs) | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
							
								
								
									
										30
									
								
								vendor/github.com/containerd/plugin/.golangci.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								vendor/github.com/containerd/plugin/.golangci.yml
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | |||||||
|  | linters: | ||||||
|  |   enable: | ||||||
|  |     - exportloopref # Checks for pointers to enclosing loop variables | ||||||
|  |     - gofmt | ||||||
|  |     - goimports | ||||||
|  |     - gosec | ||||||
|  |     - ineffassign | ||||||
|  |     - misspell | ||||||
|  |     - nolintlint | ||||||
|  |     - revive | ||||||
|  |     - staticcheck | ||||||
|  |     - tenv # Detects using os.Setenv instead of t.Setenv since Go 1.17 | ||||||
|  |     - unconvert | ||||||
|  |     - unused | ||||||
|  |     - vet | ||||||
|  |     - dupword # Checks for duplicate words in the source code | ||||||
|  |   disable: | ||||||
|  |     - errcheck | ||||||
|  |  | ||||||
|  | run: | ||||||
|  |   timeout: 5m | ||||||
|  |   skip-dirs: | ||||||
|  |     - api | ||||||
|  |     - cluster | ||||||
|  |     - design | ||||||
|  |     - docs | ||||||
|  |     - docs/man | ||||||
|  |     - releases | ||||||
|  |     - reports | ||||||
|  |     - test # e2e scripts | ||||||
							
								
								
									
										191
									
								
								vendor/github.com/containerd/plugin/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										191
									
								
								vendor/github.com/containerd/plugin/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,191 @@ | |||||||
|  |  | ||||||
|  |                                  Apache License | ||||||
|  |                            Version 2.0, January 2004 | ||||||
|  |                         https://www.apache.org/licenses/ | ||||||
|  |  | ||||||
|  |    TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||||||
|  |  | ||||||
|  |    1. Definitions. | ||||||
|  |  | ||||||
|  |       "License" shall mean the terms and conditions for use, reproduction, | ||||||
|  |       and distribution as defined by Sections 1 through 9 of this document. | ||||||
|  |  | ||||||
|  |       "Licensor" shall mean the copyright owner or entity authorized by | ||||||
|  |       the copyright owner that is granting the License. | ||||||
|  |  | ||||||
|  |       "Legal Entity" shall mean the union of the acting entity and all | ||||||
|  |       other entities that control, are controlled by, or are under common | ||||||
|  |       control with that entity. For the purposes of this definition, | ||||||
|  |       "control" means (i) the power, direct or indirect, to cause the | ||||||
|  |       direction or management of such entity, whether by contract or | ||||||
|  |       otherwise, or (ii) ownership of fifty percent (50%) or more of the | ||||||
|  |       outstanding shares, or (iii) beneficial ownership of such entity. | ||||||
|  |  | ||||||
|  |       "You" (or "Your") shall mean an individual or Legal Entity | ||||||
|  |       exercising permissions granted by this License. | ||||||
|  |  | ||||||
|  |       "Source" form shall mean the preferred form for making modifications, | ||||||
|  |       including but not limited to software source code, documentation | ||||||
|  |       source, and configuration files. | ||||||
|  |  | ||||||
|  |       "Object" form shall mean any form resulting from mechanical | ||||||
|  |       transformation or translation of a Source form, including but | ||||||
|  |       not limited to compiled object code, generated documentation, | ||||||
|  |       and conversions to other media types. | ||||||
|  |  | ||||||
|  |       "Work" shall mean the work of authorship, whether in Source or | ||||||
|  |       Object form, made available under the License, as indicated by a | ||||||
|  |       copyright notice that is included in or attached to the work | ||||||
|  |       (an example is provided in the Appendix below). | ||||||
|  |  | ||||||
|  |       "Derivative Works" shall mean any work, whether in Source or Object | ||||||
|  |       form, that is based on (or derived from) the Work and for which the | ||||||
|  |       editorial revisions, annotations, elaborations, or other modifications | ||||||
|  |       represent, as a whole, an original work of authorship. For the purposes | ||||||
|  |       of this License, Derivative Works shall not include works that remain | ||||||
|  |       separable from, or merely link (or bind by name) to the interfaces of, | ||||||
|  |       the Work and Derivative Works thereof. | ||||||
|  |  | ||||||
|  |       "Contribution" shall mean any work of authorship, including | ||||||
|  |       the original version of the Work and any modifications or additions | ||||||
|  |       to that Work or Derivative Works thereof, that is intentionally | ||||||
|  |       submitted to Licensor for inclusion in the Work by the copyright owner | ||||||
|  |       or by an individual or Legal Entity authorized to submit on behalf of | ||||||
|  |       the copyright owner. For the purposes of this definition, "submitted" | ||||||
|  |       means any form of electronic, verbal, or written communication sent | ||||||
|  |       to the Licensor or its representatives, including but not limited to | ||||||
|  |       communication on electronic mailing lists, source code control systems, | ||||||
|  |       and issue tracking systems that are managed by, or on behalf of, the | ||||||
|  |       Licensor for the purpose of discussing and improving the Work, but | ||||||
|  |       excluding communication that is conspicuously marked or otherwise | ||||||
|  |       designated in writing by the copyright owner as "Not a Contribution." | ||||||
|  |  | ||||||
|  |       "Contributor" shall mean Licensor and any individual or Legal Entity | ||||||
|  |       on behalf of whom a Contribution has been received by Licensor and | ||||||
|  |       subsequently incorporated within the Work. | ||||||
|  |  | ||||||
|  |    2. Grant of Copyright License. Subject to the terms and conditions of | ||||||
|  |       this License, each Contributor hereby grants to You a perpetual, | ||||||
|  |       worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||||||
|  |       copyright license to reproduce, prepare Derivative Works of, | ||||||
|  |       publicly display, publicly perform, sublicense, and distribute the | ||||||
|  |       Work and such Derivative Works in Source or Object form. | ||||||
|  |  | ||||||
|  |    3. Grant of Patent License. Subject to the terms and conditions of | ||||||
|  |       this License, each Contributor hereby grants to You a perpetual, | ||||||
|  |       worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||||||
|  |       (except as stated in this section) patent license to make, have made, | ||||||
|  |       use, offer to sell, sell, import, and otherwise transfer the Work, | ||||||
|  |       where such license applies only to those patent claims licensable | ||||||
|  |       by such Contributor that are necessarily infringed by their | ||||||
|  |       Contribution(s) alone or by combination of their Contribution(s) | ||||||
|  |       with the Work to which such Contribution(s) was submitted. If You | ||||||
|  |       institute patent litigation against any entity (including a | ||||||
|  |       cross-claim or counterclaim in a lawsuit) alleging that the Work | ||||||
|  |       or a Contribution incorporated within the Work constitutes direct | ||||||
|  |       or contributory patent infringement, then any patent licenses | ||||||
|  |       granted to You under this License for that Work shall terminate | ||||||
|  |       as of the date such litigation is filed. | ||||||
|  |  | ||||||
|  |    4. Redistribution. You may reproduce and distribute copies of the | ||||||
|  |       Work or Derivative Works thereof in any medium, with or without | ||||||
|  |       modifications, and in Source or Object form, provided that You | ||||||
|  |       meet the following conditions: | ||||||
|  |  | ||||||
|  |       (a) You must give any other recipients of the Work or | ||||||
|  |           Derivative Works a copy of this License; and | ||||||
|  |  | ||||||
|  |       (b) You must cause any modified files to carry prominent notices | ||||||
|  |           stating that You changed the files; and | ||||||
|  |  | ||||||
|  |       (c) You must retain, in the Source form of any Derivative Works | ||||||
|  |           that You distribute, all copyright, patent, trademark, and | ||||||
|  |           attribution notices from the Source form of the Work, | ||||||
|  |           excluding those notices that do not pertain to any part of | ||||||
|  |           the Derivative Works; and | ||||||
|  |  | ||||||
|  |       (d) If the Work includes a "NOTICE" text file as part of its | ||||||
|  |           distribution, then any Derivative Works that You distribute must | ||||||
|  |           include a readable copy of the attribution notices contained | ||||||
|  |           within such NOTICE file, excluding those notices that do not | ||||||
|  |           pertain to any part of the Derivative Works, in at least one | ||||||
|  |           of the following places: within a NOTICE text file distributed | ||||||
|  |           as part of the Derivative Works; within the Source form or | ||||||
|  |           documentation, if provided along with the Derivative Works; or, | ||||||
|  |           within a display generated by the Derivative Works, if and | ||||||
|  |           wherever such third-party notices normally appear. The contents | ||||||
|  |           of the NOTICE file are for informational purposes only and | ||||||
|  |           do not modify the License. You may add Your own attribution | ||||||
|  |           notices within Derivative Works that You distribute, alongside | ||||||
|  |           or as an addendum to the NOTICE text from the Work, provided | ||||||
|  |           that such additional attribution notices cannot be construed | ||||||
|  |           as modifying the License. | ||||||
|  |  | ||||||
|  |       You may add Your own copyright statement to Your modifications and | ||||||
|  |       may provide additional or different license terms and conditions | ||||||
|  |       for use, reproduction, or distribution of Your modifications, or | ||||||
|  |       for any such Derivative Works as a whole, provided Your use, | ||||||
|  |       reproduction, and distribution of the Work otherwise complies with | ||||||
|  |       the conditions stated in this License. | ||||||
|  |  | ||||||
|  |    5. Submission of Contributions. Unless You explicitly state otherwise, | ||||||
|  |       any Contribution intentionally submitted for inclusion in the Work | ||||||
|  |       by You to the Licensor shall be under the terms and conditions of | ||||||
|  |       this License, without any additional terms or conditions. | ||||||
|  |       Notwithstanding the above, nothing herein shall supersede or modify | ||||||
|  |       the terms of any separate license agreement you may have executed | ||||||
|  |       with Licensor regarding such Contributions. | ||||||
|  |  | ||||||
|  |    6. Trademarks. This License does not grant permission to use the trade | ||||||
|  |       names, trademarks, service marks, or product names of the Licensor, | ||||||
|  |       except as required for reasonable and customary use in describing the | ||||||
|  |       origin of the Work and reproducing the content of the NOTICE file. | ||||||
|  |  | ||||||
|  |    7. Disclaimer of Warranty. Unless required by applicable law or | ||||||
|  |       agreed to in writing, Licensor provides the Work (and each | ||||||
|  |       Contributor provides its Contributions) on an "AS IS" BASIS, | ||||||
|  |       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||||||
|  |       implied, including, without limitation, any warranties or conditions | ||||||
|  |       of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A | ||||||
|  |       PARTICULAR PURPOSE. You are solely responsible for determining the | ||||||
|  |       appropriateness of using or redistributing the Work and assume any | ||||||
|  |       risks associated with Your exercise of permissions under this License. | ||||||
|  |  | ||||||
|  |    8. Limitation of Liability. In no event and under no legal theory, | ||||||
|  |       whether in tort (including negligence), contract, or otherwise, | ||||||
|  |       unless required by applicable law (such as deliberate and grossly | ||||||
|  |       negligent acts) or agreed to in writing, shall any Contributor be | ||||||
|  |       liable to You for damages, including any direct, indirect, special, | ||||||
|  |       incidental, or consequential damages of any character arising as a | ||||||
|  |       result of this License or out of the use or inability to use the | ||||||
|  |       Work (including but not limited to damages for loss of goodwill, | ||||||
|  |       work stoppage, computer failure or malfunction, or any and all | ||||||
|  |       other commercial damages or losses), even if such Contributor | ||||||
|  |       has been advised of the possibility of such damages. | ||||||
|  |  | ||||||
|  |    9. Accepting Warranty or Additional Liability. While redistributing | ||||||
|  |       the Work or Derivative Works thereof, You may choose to offer, | ||||||
|  |       and charge a fee for, acceptance of support, warranty, indemnity, | ||||||
|  |       or other liability obligations and/or rights consistent with this | ||||||
|  |       License. However, in accepting such obligations, You may act only | ||||||
|  |       on Your own behalf and on Your sole responsibility, not on behalf | ||||||
|  |       of any other Contributor, and only if You agree to indemnify, | ||||||
|  |       defend, and hold each Contributor harmless for any liability | ||||||
|  |       incurred by, or claims asserted against, such Contributor by reason | ||||||
|  |       of your accepting any such warranty or additional liability. | ||||||
|  |  | ||||||
|  |    END OF TERMS AND CONDITIONS | ||||||
|  |  | ||||||
|  |    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 | ||||||
|  |  | ||||||
|  |        https://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. | ||||||
							
								
								
									
										19
									
								
								vendor/github.com/containerd/plugin/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								vendor/github.com/containerd/plugin/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | |||||||
|  | # plugin | ||||||
|  |  | ||||||
|  | A Go package providing a common plugin interface across containerd repositories. | ||||||
|  |  | ||||||
|  | This package is intended to be imported by the main containerd repository as well as plugin implementations. | ||||||
|  | By sharing a common implementations, plugins can register themselves without needing to import the main containerd repository. | ||||||
|  | This plugin is intended to provide an interface and common functionality, but is not intended to define plugin types used by containerd. | ||||||
|  | Plugins should copy plugin type strings to avoid creating unintended depdenencies. | ||||||
|  |  | ||||||
|  | ## Project details | ||||||
|  |  | ||||||
|  | **plugin** is a containerd sub-project, licensed under the [Apache 2.0 license](./LICENSE). | ||||||
|  | As a containerd sub-project, you will find the: | ||||||
|  |  * [Project governance](https://github.com/containerd/project/blob/main/GOVERNANCE.md), | ||||||
|  |  * [Maintainers](https://github.com/containerd/project/blob/main/MAINTAINERS), | ||||||
|  |  * and [Contributing guidelines](https://github.com/containerd/project/blob/main/CONTRIBUTING.md) | ||||||
|  |  | ||||||
|  | information in our [`containerd/project`](https://github.com/containerd/project) repository. | ||||||
|  |  | ||||||
							
								
								
									
										86
									
								
								plugin/context.go → vendor/github.com/containerd/plugin/context.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										86
									
								
								plugin/context.go → vendor/github.com/containerd/plugin/context.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -51,11 +51,6 @@ func NewContext(ctx context.Context, plugins *Set, properties map[string]string) | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Get returns the first plugin by its type |  | ||||||
| func (i *InitContext) Get(t Type) (interface{}, error) { |  | ||||||
| 	return i.plugins.Get(t) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Meta contains information gathered from the registration and initialization | // Meta contains information gathered from the registration and initialization | ||||||
| // process. | // process. | ||||||
| type Meta struct { | type Meta struct { | ||||||
| @@ -119,25 +114,13 @@ func (ps *Set) Add(p *Plugin) error { | |||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Get returns the first plugin by its type | // Get returns the plugin with the given type and id | ||||||
| func (ps *Set) Get(t Type) (interface{}, error) { | func (ps *Set) Get(t Type, id string) *Plugin { | ||||||
| 	for _, v := range ps.byTypeAndID[t] { | 	p, ok := ps.byTypeAndID[t] | ||||||
| 		return v.Instance() |  | ||||||
| 	} |  | ||||||
| 	return nil, fmt.Errorf("no plugins registered for %s: %w", t, ErrPluginNotFound) |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // GetByID returns the plugin of the given type and ID |  | ||||||
| func (ps *Set) GetByID(t Type, id string) (*Plugin, error) { |  | ||||||
| 	typSet, ok := ps.byTypeAndID[t] |  | ||||||
| 	if !ok || len(typSet) == 0 { |  | ||||||
| 		return nil, fmt.Errorf("no plugins registered for %s: %w", t, ErrPluginNotFound) |  | ||||||
| 	} |  | ||||||
| 	p, ok := typSet[id] |  | ||||||
| 	if !ok { | 	if !ok { | ||||||
| 		return nil, fmt.Errorf("no plugins registered for %s %q: %w", t, id, ErrPluginNotFound) | 		return nil | ||||||
| 	} | 	} | ||||||
| 	return p, nil | 	return p[id] | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // GetAll returns all initialized plugins | // GetAll returns all initialized plugins | ||||||
| @@ -145,6 +128,37 @@ func (ps *Set) GetAll() []*Plugin { | |||||||
| 	return ps.ordered | 	return ps.ordered | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // GetSingle returns a plugin instance of the given type when only a single instance | ||||||
|  | // of that type is expected. Throws an ErrPluginNotFound if no plugin is found and | ||||||
|  | // ErrPluginMultipleInstances when multiple instances are found. | ||||||
|  | // Since plugins are not ordered, if multiple instances is suported then | ||||||
|  | // GetByType should be used. If only one is expected, then to switch plugins, | ||||||
|  | // disable or remove the unused plugins of the same type. | ||||||
|  | func (i *InitContext) GetSingle(t Type) (interface{}, error) { | ||||||
|  | 	var ( | ||||||
|  | 		found    bool | ||||||
|  | 		instance interface{} | ||||||
|  | 	) | ||||||
|  | 	for _, v := range i.plugins.byTypeAndID[t] { | ||||||
|  | 		i, err := v.Instance() | ||||||
|  | 		if err != nil { | ||||||
|  | 			if IsSkipPlugin(err) { | ||||||
|  | 				continue | ||||||
|  | 			} | ||||||
|  | 			return i, err | ||||||
|  | 		} | ||||||
|  | 		if found { | ||||||
|  | 			return nil, fmt.Errorf("multiple plugins registered for %s: %w", t, ErrPluginMultipleInstances) | ||||||
|  | 		} | ||||||
|  | 		instance = i | ||||||
|  | 		found = true | ||||||
|  | 	} | ||||||
|  | 	if !found { | ||||||
|  | 		return nil, fmt.Errorf("no plugins registered for %s: %w", t, ErrPluginNotFound) | ||||||
|  | 	} | ||||||
|  | 	return instance, nil | ||||||
|  | } | ||||||
|  | 
 | ||||||
| // Plugins returns plugin set | // Plugins returns plugin set | ||||||
| func (i *InitContext) Plugins() *Set { | func (i *InitContext) Plugins() *Set { | ||||||
| 	return i.plugins | 	return i.plugins | ||||||
| @@ -157,23 +171,29 @@ func (i *InitContext) GetAll() []*Plugin { | |||||||
| 
 | 
 | ||||||
| // GetByID returns the plugin of the given type and ID | // GetByID returns the plugin of the given type and ID | ||||||
| func (i *InitContext) GetByID(t Type, id string) (interface{}, error) { | func (i *InitContext) GetByID(t Type, id string) (interface{}, error) { | ||||||
| 	ps, err := i.GetByType(t) | 	p := i.plugins.Get(t, id) | ||||||
| 	if err != nil { | 	if p == nil { | ||||||
| 		return nil, err | 		return nil, fmt.Errorf("no plugins registered for %s.%s: %w", t, id, ErrPluginNotFound) | ||||||
| 	} |  | ||||||
| 	p, ok := ps[id] |  | ||||||
| 	if !ok { |  | ||||||
| 		return nil, fmt.Errorf("no %s plugins with id %s: %w", t, id, ErrPluginNotFound) |  | ||||||
| 	} | 	} | ||||||
| 	return p.Instance() | 	return p.Instance() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // GetByType returns all plugins with the specific type. | // GetByType returns all plugins with the specific type. | ||||||
| func (i *InitContext) GetByType(t Type) (map[string]*Plugin, error) { | func (i *InitContext) GetByType(t Type) (map[string]interface{}, error) { | ||||||
| 	p, ok := i.plugins.byTypeAndID[t] | 	pi := map[string]interface{}{} | ||||||
| 	if !ok { | 	for id, p := range i.plugins.byTypeAndID[t] { | ||||||
|  | 		i, err := p.Instance() | ||||||
|  | 		if err != nil { | ||||||
|  | 			if IsSkipPlugin(err) { | ||||||
|  | 				continue | ||||||
|  | 			} | ||||||
|  | 			return nil, err | ||||||
|  | 		} | ||||||
|  | 		pi[id] = i | ||||||
|  | 	} | ||||||
|  | 	if len(pi) == 0 { | ||||||
| 		return nil, fmt.Errorf("no plugins registered for %s: %w", t, ErrPluginNotFound) | 		return nil, fmt.Errorf("no plugins registered for %s: %w", t, ErrPluginNotFound) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return p, nil | 	return pi, nil | ||||||
| } | } | ||||||
							
								
								
									
										0
									
								
								plugin/dynamic/dynamic.go → vendor/github.com/containerd/plugin/dynamic/dynamic.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										0
									
								
								plugin/dynamic/dynamic.go → vendor/github.com/containerd/plugin/dynamic/dynamic.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -25,9 +25,8 @@ import ( | |||||||
| 	"runtime" | 	"runtime" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // loadPlugins loads all plugins for the OS and Arch that containerd is built | // loadPlugins loads all plugins for the OS and Arch | ||||||
| // for inside the provided path and returns the count of successfully-loaded | // that containerd is built for inside the provided path | ||||||
| // plugins |  | ||||||
| func loadPlugins(path string) (int, error) { | func loadPlugins(path string) (int, error) { | ||||||
| 	abs, err := filepath.Abs(path) | 	abs, err := filepath.Abs(path) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
							
								
								
									
										2
									
								
								plugin/plugin.go → vendor/github.com/containerd/plugin/plugin.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								plugin/plugin.go → vendor/github.com/containerd/plugin/plugin.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -37,6 +37,8 @@ var ( | |||||||
| 	ErrPluginInitialized = errors.New("plugin: already initialized") | 	ErrPluginInitialized = errors.New("plugin: already initialized") | ||||||
| 	// ErrPluginNotFound is used when a plugin is looked up but not found | 	// ErrPluginNotFound is used when a plugin is looked up but not found | ||||||
| 	ErrPluginNotFound = errors.New("plugin: not found") | 	ErrPluginNotFound = errors.New("plugin: not found") | ||||||
|  | 	// ErrPluginMultipleInstances is used when a plugin is expected a single instance but has multiple | ||||||
|  | 	ErrPluginMultipleInstances = errors.New("plugin: multiple instances") | ||||||
| 
 | 
 | ||||||
| 	// ErrInvalidRequires will be thrown if the requirements for a plugin are | 	// ErrInvalidRequires will be thrown if the requirements for a plugin are | ||||||
| 	// defined in an invalid manner. | 	// defined in an invalid manner. | ||||||
| @@ -19,7 +19,7 @@ package registry | |||||||
| import ( | import ( | ||||||
| 	"sync" | 	"sync" | ||||||
| 
 | 
 | ||||||
| 	"github.com/containerd/containerd/v2/plugin" | 	"github.com/containerd/plugin" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| var register = struct { | var register = struct { | ||||||
							
								
								
									
										5
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							| @@ -142,6 +142,11 @@ github.com/containerd/nri/pkg/net/multiplex | |||||||
| github.com/containerd/nri/pkg/runtime-tools/generate | github.com/containerd/nri/pkg/runtime-tools/generate | ||||||
| github.com/containerd/nri/pkg/stub | github.com/containerd/nri/pkg/stub | ||||||
| github.com/containerd/nri/types/v1 | github.com/containerd/nri/types/v1 | ||||||
|  | # github.com/containerd/plugin v0.0.0-20231101173250-7ec69893e1e7 | ||||||
|  | ## explicit; go 1.20 | ||||||
|  | github.com/containerd/plugin | ||||||
|  | github.com/containerd/plugin/dynamic | ||||||
|  | github.com/containerd/plugin/registry | ||||||
| # github.com/containerd/ttrpc v1.2.2 | # github.com/containerd/ttrpc v1.2.2 | ||||||
| ## explicit; go 1.13 | ## explicit; go 1.13 | ||||||
| github.com/containerd/ttrpc | github.com/containerd/ttrpc | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Samuel Karp
					Samuel Karp