@@ -30,6 +30,7 @@ import (
30
30
"github.com/containerd/containerd/v2/pkg/cri/server/images"
31
31
"github.com/containerd/containerd/v2/pkg/events"
32
32
"github.com/containerd/containerd/v2/plugins"
33
+ "github.com/containerd/containerd/v2/plugins/services/warning"
33
34
"github.com/containerd/log"
34
35
"github.com/containerd/platforms"
35
36
"github.com/containerd/plugin"
@@ -50,6 +51,7 @@ func init() {
50
51
plugins .SandboxStorePlugin ,
51
52
plugins .ServicePlugin , // For client
52
53
plugins .SnapshotPlugin , // For root directory properties
54
+ plugins .WarningPlugin ,
53
55
},
54
56
InitFn : func (ic * plugin.InitContext ) (interface {}, error ) {
55
57
m , err := ic .GetSingle (plugins .MetadataPlugin )
@@ -63,6 +65,19 @@ func init() {
63
65
return nil , err
64
66
}
65
67
68
+ if warnings , err := criconfig .ValidateImageConfig (ic .Context , & config ); err != nil {
69
+ return nil , fmt .Errorf ("invalid cri image config: %w" , err )
70
+ } else if len (warnings ) > 0 {
71
+ ws , err := ic .GetSingle (plugins .WarningPlugin )
72
+ if err != nil {
73
+ return nil , err
74
+ }
75
+ warn := ws .(warning.Service )
76
+ for _ , w := range warnings {
77
+ warn .Emit (ic .Context , w )
78
+ }
79
+ }
80
+
66
81
options := & images.CRIImageServiceOptions {
67
82
Content : mdb .ContentStore (),
68
83
Images : metadata .NewImageStore (mdb ),
0 commit comments