Skip to content

Commit 64b4778

Browse files
committed
Add deprecation warnings to CRI image server configuration
Signed-off-by: Derek McGowan <[email protected]>
1 parent 65b3922 commit 64b4778

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

plugins/cri/images/plugin.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"github.com/containerd/containerd/v2/pkg/cri/server/images"
3131
"github.com/containerd/containerd/v2/pkg/events"
3232
"github.com/containerd/containerd/v2/plugins"
33+
"github.com/containerd/containerd/v2/plugins/services/warning"
3334
"github.com/containerd/log"
3435
"github.com/containerd/platforms"
3536
"github.com/containerd/plugin"
@@ -50,6 +51,7 @@ func init() {
5051
plugins.SandboxStorePlugin,
5152
plugins.ServicePlugin, // For client
5253
plugins.SnapshotPlugin, // For root directory properties
54+
plugins.WarningPlugin,
5355
},
5456
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
5557
m, err := ic.GetSingle(plugins.MetadataPlugin)
@@ -63,6 +65,19 @@ func init() {
6365
return nil, err
6466
}
6567

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+
6681
options := &images.CRIImageServiceOptions{
6782
Content: mdb.ContentStore(),
6883
Images: metadata.NewImageStore(mdb),

0 commit comments

Comments
 (0)