@@ -36,7 +36,6 @@ import (
3636 "github.com/containerd/containerd/v2/internal/cri/server/podsandbox/types"
3737 imagestore "github.com/containerd/containerd/v2/internal/cri/store/image"
3838 ctrdutil "github.com/containerd/containerd/v2/internal/cri/util"
39- "github.com/containerd/containerd/v2/pkg/oci"
4039 osinterface "github.com/containerd/containerd/v2/pkg/os"
4140 "github.com/containerd/containerd/v2/pkg/protobuf"
4241 "github.com/containerd/containerd/v2/plugins"
@@ -74,7 +73,6 @@ func init() {
7473 if err != nil {
7574 return nil , fmt .Errorf ("unable to load CRI runtime service plugin dependency: %w" , err )
7675 }
77- runtimeService := criRuntimePlugin .(RuntimeService )
7876
7977 // Get image service.
8078 criImagePlugin , err := ic .GetByID (plugins .CRIServicePlugin , "images" )
@@ -89,9 +87,9 @@ func init() {
8987
9088 c := Controller {
9189 client : client ,
92- config : runtimeService .Config (),
90+ config : criRuntimePlugin .(interface { Config () criconfig.Config }).Config (),
91+ imageConfig : criImagePlugin .(interface { Config () criconfig.ImageConfig }).Config (),
9392 os : osinterface.RealOS {},
94- runtimeService : runtimeService ,
9593 imageService : criImagePlugin .(ImageService ),
9694 warningService : warningPlugin .(warning.Service ),
9795 store : NewStore (),
@@ -111,28 +109,20 @@ func init() {
111109 })
112110}
113111
114- // RuntimeService specifies dependencies to CRI runtime service.
115- type RuntimeService interface {
116- Config () criconfig.Config
117- LoadOCISpec (string ) (* oci.Spec , error )
118- }
119-
120112// ImageService specifies dependencies to CRI image service.
121113type ImageService interface {
122114 LocalResolve (refOrID string ) (imagestore.Image , error )
123115 GetImage (id string ) (imagestore.Image , error )
124116 PullImage (ctx context.Context , name string , creds func (string ) (string , string , error ), sc * runtime.PodSandboxConfig , runtimeHandler string ) (string , error )
125- RuntimeSnapshotter (ctx context.Context , ociRuntime criconfig.Runtime ) string
126- PinnedImage (string ) string
127117}
128118
129119type Controller struct {
130120 // config contains all configurations.
131121 config criconfig.Config
122+ // imageConfig contains CRI image configuration.
123+ imageConfig criconfig.ImageConfig
132124 // client is an instance of the containerd client
133125 client * containerd.Client
134- // runtimeService is a dependency to CRI runtime service.
135- runtimeService RuntimeService
136126 // imageService is a dependency to CRI image service.
137127 imageService ImageService
138128 // warningService is used to emit deprecation warnings.
0 commit comments