Skip to content

Commit 455edca

Browse files
committed
cri: add deprecation warning for mirrors
Signed-off-by: Samuel Karp <[email protected]> (cherry picked from commit d7cb25d) Signed-off-by: Samuel Karp <[email protected]>
1 parent 878823f commit 455edca

3 files changed

Lines changed: 34 additions & 0 deletions

File tree

pkg/cri/config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ func ValidatePluginConfig(ctx context.Context, c *PluginConfig) ([]deprecation.W
403403
if useConfigPath {
404404
return warnings, errors.New("`mirrors` cannot be set when `config_path` is provided")
405405
}
406+
warnings = append(warnings, deprecation.CRIRegistryMirrors)
406407
log.G(ctx).Warning("`mirrors` is deprecated, please use `config_path` instead")
407408
}
408409
var hasDeprecatedTLS bool

pkg/cri/config/config_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,35 @@ func TestValidateConfig(t *testing.T) {
363363
},
364364
expectedErr: "`configs.tls` cannot be set when `config_path` is provided",
365365
},
366+
"deprecated mirrors": {
367+
config: &PluginConfig{
368+
ContainerdConfig: ContainerdConfig{
369+
DefaultRuntimeName: RuntimeDefault,
370+
Runtimes: map[string]Runtime{
371+
RuntimeDefault: {},
372+
},
373+
},
374+
Registry: Registry{
375+
Mirrors: map[string]Mirror{
376+
"example.com": {},
377+
},
378+
},
379+
},
380+
expected: &PluginConfig{
381+
ContainerdConfig: ContainerdConfig{
382+
DefaultRuntimeName: RuntimeDefault,
383+
Runtimes: map[string]Runtime{
384+
RuntimeDefault: {},
385+
},
386+
},
387+
Registry: Registry{
388+
Mirrors: map[string]Mirror{
389+
"example.com": {},
390+
},
391+
},
392+
},
393+
warnings: []deprecation.Warning{deprecation.CRIRegistryMirrors},
394+
},
366395
} {
367396
t.Run(desc, func(t *testing.T) {
368397
w, err := ValidatePluginConfig(context.Background(), test.config)

pkg/deprecation/deprecation.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ const (
2525
PullSchema1Image Warning = Prefix + "pull-schema-1-image"
2626
// GoPluginLibrary is a warning for the use of dynamic library Go plugins
2727
GoPluginLibrary Warning = Prefix + "go-plugin-library"
28+
// CRIRegistryMirrors is a warning for the use of the `mirrors` property
29+
CRIRegistryMirrors Warning = Prefix + "cri-registry-mirrors"
2830
)
2931

3032
var messages = map[Warning]string{
3133
PullSchema1Image: "Schema 1 images will be deprecated in containerd v1.7 and removed in containerd v2.0. " +
3234
`Since containerd v1.6.25, schema 1 images are identified by the "io.containerd.image/converted-docker-schema1" label.`,
3335
GoPluginLibrary: "Dynamically-linked Go plugins as containerd runtimes are deprecated since containerd v2.0 and removed in containerd v2.1.",
36+
CRIRegistryMirrors: "The `mirrors` property of `[plugins.\"io.containerd.grpc.v1.cri\".registry]` is deprecated since containerd v1.5 and will be removed in containerd v2.0." +
37+
"Use `config_path` instead.",
3438
}
3539

3640
// Valid checks whether a given Warning is valid

0 commit comments

Comments
 (0)