Move CRI image service into a separate plugin
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com> Signed-off-by: Abel Feng <fshb1988@gmail.com>
This commit is contained in:
committed by
Abel Feng
parent
349c8d12c8
commit
e15c246550
@@ -1,46 +0,0 @@
|
||||
//go:build gofuzz
|
||||
|
||||
/*
|
||||
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 fuzz
|
||||
|
||||
import (
|
||||
fuzz "github.com/AdaLogics/go-fuzz-headers"
|
||||
|
||||
containerd "github.com/containerd/containerd/v2/client"
|
||||
criconfig "github.com/containerd/containerd/v2/pkg/cri/config"
|
||||
"github.com/containerd/containerd/v2/pkg/cri/server"
|
||||
)
|
||||
|
||||
func FuzzCRISandboxServer(data []byte) int {
|
||||
initDaemon.Do(startDaemon)
|
||||
|
||||
f := fuzz.NewConsumer(data)
|
||||
|
||||
client, err := containerd.New(defaultAddress)
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
defer client.Close()
|
||||
|
||||
c, err := server.NewCRIService(criconfig.Config{}, client, nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return fuzzCRI(f, c)
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
containerd "github.com/containerd/containerd/v2/client"
|
||||
criconfig "github.com/containerd/containerd/v2/pkg/cri/config"
|
||||
"github.com/containerd/containerd/v2/pkg/cri/server"
|
||||
"github.com/containerd/containerd/v2/pkg/cri/server/images"
|
||||
)
|
||||
|
||||
func FuzzCRIServer(data []byte) int {
|
||||
@@ -37,7 +38,12 @@ func FuzzCRIServer(data []byte) int {
|
||||
}
|
||||
defer client.Close()
|
||||
|
||||
c, err := server.NewCRIService(criconfig.Config{}, client, nil)
|
||||
imageService, err := images.NewService(criconfig.Config{}, client)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
c, err := server.NewCRIService(criconfig.Config{}, imageService, client, nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user