Move cri base plugin to CRI runtime service
Create new plugin type for CRI runtime and image services. Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
_ "github.com/containerd/containerd/v2/pkg/events/plugin"
|
||||
_ "github.com/containerd/containerd/v2/pkg/nri/plugin"
|
||||
_ "github.com/containerd/containerd/v2/plugins/cri/images"
|
||||
_ "github.com/containerd/containerd/v2/plugins/cri/runtime"
|
||||
_ "github.com/containerd/containerd/v2/plugins/diff/walking/plugin"
|
||||
_ "github.com/containerd/containerd/v2/plugins/gc"
|
||||
_ "github.com/containerd/containerd/v2/plugins/imageverifier"
|
||||
|
||||
@@ -29,6 +29,7 @@ import (
|
||||
"github.com/containerd/containerd/v2/pkg/cri/server"
|
||||
"github.com/containerd/containerd/v2/pkg/cri/server/images"
|
||||
"github.com/containerd/containerd/v2/pkg/oci"
|
||||
"github.com/containerd/errdefs"
|
||||
)
|
||||
|
||||
func FuzzCRIServer(data []byte) int {
|
||||
@@ -42,7 +43,6 @@ func FuzzCRIServer(data []byte) int {
|
||||
}
|
||||
defer client.Close()
|
||||
|
||||
config := criconfig.Config{}
|
||||
imageConfig := criconfig.ImageConfig{}
|
||||
|
||||
imageService, err := images.NewService(imageConfig, &images.CRIImageServiceOptions{
|
||||
@@ -52,10 +52,10 @@ func FuzzCRIServer(data []byte) int {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
c, rs, err := server.NewCRIService(config, &server.CRIServiceOptions{
|
||||
ImageService: imageService,
|
||||
Client: client,
|
||||
BaseOCISpecs: map[string]*oci.Spec{},
|
||||
c, rs, err := server.NewCRIService(&server.CRIServiceOptions{
|
||||
RuntimeService: &fakeRuntimeService{},
|
||||
ImageService: imageService,
|
||||
Client: client,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -68,6 +68,16 @@ func FuzzCRIServer(data []byte) int {
|
||||
})
|
||||
}
|
||||
|
||||
type fakeRuntimeService struct{}
|
||||
|
||||
func (fakeRuntimeService) Config() criconfig.Config {
|
||||
return criconfig.Config{}
|
||||
}
|
||||
|
||||
func (fakeRuntimeService) LoadOCISpec(string) (*oci.Spec, error) {
|
||||
return nil, errdefs.ErrNotFound
|
||||
}
|
||||
|
||||
type service struct {
|
||||
server.CRIService
|
||||
runtime.RuntimeServiceServer
|
||||
|
||||
Reference in New Issue
Block a user