Move plugin type definitions to containerd plugins package
The plugins packages defines the plugins used by containerd. Move all the types and properties to this package. Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
@@ -27,6 +27,7 @@ import (
|
||||
nriservice "github.com/containerd/containerd/pkg/nri"
|
||||
"github.com/containerd/containerd/platforms"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/plugins"
|
||||
"github.com/containerd/log"
|
||||
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"k8s.io/klog/v2"
|
||||
@@ -39,13 +40,13 @@ import (
|
||||
func init() {
|
||||
config := criconfig.DefaultConfig()
|
||||
plugin.Register(&plugin.Registration{
|
||||
Type: plugin.GRPCPlugin,
|
||||
Type: plugins.GRPCPlugin,
|
||||
ID: "cri",
|
||||
Config: &config,
|
||||
Requires: []plugin.Type{
|
||||
plugin.EventPlugin,
|
||||
plugin.ServicePlugin,
|
||||
plugin.NRIApiPlugin,
|
||||
plugins.EventPlugin,
|
||||
plugins.ServicePlugin,
|
||||
plugins.NRIApiPlugin,
|
||||
},
|
||||
InitFn: initCRIService,
|
||||
})
|
||||
@@ -125,7 +126,7 @@ func setGLogLevel() error {
|
||||
// Get the NRI plugin, and set up our NRI API for it.
|
||||
func getNRIAPI(ic *plugin.InitContext) *nri.API {
|
||||
const (
|
||||
pluginType = plugin.NRIApiPlugin
|
||||
pluginType = plugins.NRIApiPlugin
|
||||
pluginName = "nri"
|
||||
)
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import (
|
||||
containerstore "github.com/containerd/containerd/pkg/cri/store/container"
|
||||
imagestore "github.com/containerd/containerd/pkg/cri/store/image"
|
||||
runtimeoptions "github.com/containerd/containerd/pkg/runtimeoptions/v1"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/plugins"
|
||||
runcoptions "github.com/containerd/containerd/runtime/v2/runc/options"
|
||||
"github.com/containerd/log"
|
||||
)
|
||||
@@ -289,7 +289,7 @@ func generateRuntimeOptions(r criconfig.Runtime) (interface{}, error) {
|
||||
// getRuntimeOptionsType gets empty runtime options by the runtime type name.
|
||||
func getRuntimeOptionsType(t string) interface{} {
|
||||
switch t {
|
||||
case plugin.RuntimeRuncV2:
|
||||
case plugins.RuntimeRuncV2:
|
||||
return &runcoptions.Options{}
|
||||
case runtimeRunhcsV1:
|
||||
return &runhcsoptions.Options{}
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
"github.com/containerd/containerd/oci"
|
||||
criconfig "github.com/containerd/containerd/pkg/cri/config"
|
||||
containerstore "github.com/containerd/containerd/pkg/cri/store/container"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/plugins"
|
||||
"github.com/containerd/containerd/protobuf/types"
|
||||
runcoptions "github.com/containerd/containerd/runtime/v2/runc/options"
|
||||
"github.com/containerd/typeurl/v2"
|
||||
@@ -119,7 +119,7 @@ systemd_cgroup = true
|
||||
no_pivot = true
|
||||
default_runtime_name = "default"
|
||||
[containerd.runtimes.runcv2]
|
||||
runtime_type = "` + plugin.RuntimeRuncV2 + `"
|
||||
runtime_type = "` + plugins.RuntimeRuncV2 + `"
|
||||
`
|
||||
nonNilOpts := `
|
||||
systemd_cgroup = true
|
||||
@@ -134,7 +134,7 @@ systemd_cgroup = true
|
||||
Root = "/runc"
|
||||
NoNewKeyring = true
|
||||
[containerd.runtimes.runcv2]
|
||||
runtime_type = "` + plugin.RuntimeRuncV2 + `"
|
||||
runtime_type = "` + plugins.RuntimeRuncV2 + `"
|
||||
[containerd.runtimes.runcv2.options]
|
||||
BinaryName = "runc"
|
||||
Root = "/runcv2"
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
|
||||
criconfig "github.com/containerd/containerd/pkg/cri/config"
|
||||
"github.com/containerd/containerd/pkg/systemd"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/plugins"
|
||||
"github.com/stretchr/testify/assert"
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
|
||||
)
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
func newFakeRuntimeConfig(runcV2, systemdCgroup bool) criconfig.Runtime {
|
||||
r := criconfig.Runtime{Type: "default", Options: map[string]interface{}{}}
|
||||
if runcV2 {
|
||||
r.Type = plugin.RuntimeRuncV2
|
||||
r.Type = plugins.RuntimeRuncV2
|
||||
if systemdCgroup {
|
||||
r.Options["SystemdCgroup"] = true
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import (
|
||||
imagestore "github.com/containerd/containerd/pkg/cri/store/image"
|
||||
snapshotstore "github.com/containerd/containerd/pkg/cri/store/snapshot"
|
||||
"github.com/containerd/containerd/pkg/cri/streaming"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/plugins"
|
||||
"github.com/containerd/containerd/sandbox"
|
||||
"github.com/containerd/go-cni"
|
||||
"github.com/containerd/log"
|
||||
@@ -350,7 +350,7 @@ func (c *criService) register(s *grpc.Server) error {
|
||||
// imageFSPath returns containerd image filesystem path.
|
||||
// Note that if containerd changes directory layout, we also needs to change this.
|
||||
func imageFSPath(rootDir, snapshotter string) string {
|
||||
return filepath.Join(rootDir, plugin.SnapshotPlugin.String()+"."+snapshotter)
|
||||
return filepath.Join(rootDir, plugins.SnapshotPlugin.String()+"."+snapshotter)
|
||||
}
|
||||
|
||||
func loadOCISpec(filename string) (*oci.Spec, error) {
|
||||
|
||||
@@ -19,11 +19,12 @@ package plugin
|
||||
import (
|
||||
"github.com/containerd/containerd/pkg/nri"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/plugins"
|
||||
)
|
||||
|
||||
func init() {
|
||||
plugin.Register(&plugin.Registration{
|
||||
Type: plugin.NRIApiPlugin,
|
||||
Type: plugins.NRIApiPlugin,
|
||||
ID: "nri",
|
||||
Config: nri.DefaultConfig(),
|
||||
InitFn: initFunc,
|
||||
|
||||
Reference in New Issue
Block a user