@@ -84,6 +84,11 @@ const (
8484var (
8585 runSociCmd = []string {"nerdctl" , "run" , "--pull" , "never" , "--net" , "none" , "--snapshotter" , "soci" }
8686 imagePullCmd = []string {"nerdctl" , "pull" , "-q" , "--snapshotter" , "soci" }
87+ crictlCmd = []string {
88+ "crictl" ,
89+ "--runtime-endpoint" , "unix:///run/containerd/containerd.sock" ,
90+ "--image-endpoint" , "unix:///run/soci-snapshotter-grpc/soci-snapshotter-grpc.sock" ,
91+ }
8792)
8893
8994// These are images that we use in our integration tests
@@ -140,6 +145,44 @@ level = "{{.LogLevel}}"
140145{{.AdditionalConfig}}
141146`
142147
148+ // criContainerdConfigTemplate is the CRI counterpart to `containerdConfigTemplate`: it
149+ // leaves the containerd CRI plugin enabled and points it at the SOCI snapshotter.
150+ const criContainerdConfigTemplate = `
151+ version = 2
152+
153+ disabled_plugins = [
154+ "io.containerd.snapshotter.v1.aufs",
155+ "io.containerd.snapshotter.v1.btrfs",
156+ "io.containerd.snapshotter.v1.devmapper",
157+ "io.containerd.snapshotter.v1.zfs",
158+ "io.containerd.tracing.processor.v1.otlp",
159+ "io.containerd.internal.v1.tracing",
160+ ]
161+
162+ # containerd 1.7.x
163+ [plugins."io.containerd.grpc.v1.cri".containerd]
164+ snapshotter = "soci"
165+ disable_snapshot_annotations = false
166+
167+ # containerd 2.x
168+ [plugins."io.containerd.cri.v1.images"]
169+ snapshotter = "soci"
170+ disable_snapshot_annotations = false
171+
172+ [plugins."io.containerd.snapshotter.v1.soci"]
173+ root_path = "/var/lib/soci-snapshotter-grpc/"
174+ disable_verification = {{.DisableVerification}}
175+
176+ [plugins."io.containerd.snapshotter.v1.soci".blob]
177+ check_always = true
178+
179+ [debug]
180+ format = "json"
181+ level = "{{.LogLevel}}"
182+
183+ {{.AdditionalConfig}}
184+ `
185+
143186type composeDefaultTemplateArgs struct {
144187 Entrypoint string
145188 ImageContextDir string
@@ -314,6 +357,27 @@ func getContainerdConfigToml(t *testing.T, disableVerification bool, additionalC
314357 return s
315358}
316359
360+ // getCRIContainerdConfigToml is the CRI counterpart to `getContainerdConfigToml`,
361+ // rendering `criContainerdConfigTemplate` instead.
362+ func getCRIContainerdConfigToml (t * testing.T , disableVerification bool , additionalConfigs ... string ) string {
363+ if ! isTestingBuiltinSnapshotter () {
364+ additionalConfigs = append (additionalConfigs , proxySnapshotterConfig )
365+ }
366+ s , err := testutil .ApplyTextTemplate (criContainerdConfigTemplate , struct {
367+ LogLevel string
368+ DisableVerification bool
369+ AdditionalConfig string
370+ }{
371+ LogLevel : containerdLogLevel ,
372+ DisableVerification : disableVerification ,
373+ AdditionalConfig : strings .Join (additionalConfigs , "\n " ),
374+ })
375+ if err != nil {
376+ t .Fatal (err )
377+ }
378+ return s
379+ }
380+
317381type snapshotterConfigOpt func (* config.Config )
318382
319383func withTCPMetrics (cfg * config.Config ) {
@@ -335,6 +399,10 @@ func withDisableBgFetcher(cfg *config.Config) {
335399 cfg .ServiceConfig .FSConfig .BackgroundFetchConfig .Disable = true
336400}
337401
402+ func withCRIKeychain (cfg * config.Config ) {
403+ cfg .ServiceConfig .CRIKeychainConfig .EnableKeychain = true
404+ }
405+
338406func withMinLayerSizeConfig (minLayerSize int64 ) snapshotterConfigOpt {
339407 return func (c * config.Config ) {
340408 c .ServiceConfig .SnapshotterConfig .MinLayerSize = minLayerSize
0 commit comments