Skip to content

Commit 152c57e

Browse files
committed
cri: add deprecation warning for configs
Signed-off-by: Samuel Karp <[email protected]> (cherry picked from commit a596d09) Signed-off-by: Samuel Karp <[email protected]>
1 parent 689a103 commit 152c57e

3 files changed

Lines changed: 48 additions & 0 deletions

File tree

pkg/cri/config/config.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,11 @@ func ValidatePluginConfig(ctx context.Context, c *PluginConfig) ([]deprecation.W
486486
log.G(ctx).Warning("`configs.tls` is deprecated, please use `config_path` instead")
487487
}
488488

489+
if len(c.Registry.Configs) != 0 {
490+
warnings = append(warnings, deprecation.CRIRegistryConfigs)
491+
log.G(ctx).Warning("`configs` is deprecated, please use `config_path` instead")
492+
}
493+
489494
// Validation for deprecated auths options and mapping it to configs.
490495
if len(c.Registry.Auths) != 0 {
491496
if c.Registry.Configs == nil {

pkg/cri/config/config_test.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,45 @@ func TestValidateConfig(t *testing.T) {
404404
},
405405
warnings: []deprecation.Warning{deprecation.CRIRegistryMirrors},
406406
},
407+
"deprecated configs": {
408+
config: &PluginConfig{
409+
ContainerdConfig: ContainerdConfig{
410+
DefaultRuntimeName: RuntimeDefault,
411+
Runtimes: map[string]Runtime{
412+
RuntimeDefault: {},
413+
},
414+
},
415+
Registry: Registry{
416+
Configs: map[string]RegistryConfig{
417+
"gcr.io": {
418+
Auth: &AuthConfig{
419+
Username: "test",
420+
},
421+
},
422+
},
423+
},
424+
},
425+
expected: &PluginConfig{
426+
ContainerdConfig: ContainerdConfig{
427+
DefaultRuntimeName: RuntimeDefault,
428+
Runtimes: map[string]Runtime{
429+
RuntimeDefault: {
430+
SandboxMode: string(ModePodSandbox),
431+
},
432+
},
433+
},
434+
Registry: Registry{
435+
Configs: map[string]RegistryConfig{
436+
"gcr.io": {
437+
Auth: &AuthConfig{
438+
Username: "test",
439+
},
440+
},
441+
},
442+
},
443+
},
444+
warnings: []deprecation.Warning{deprecation.CRIRegistryConfigs},
445+
},
407446
"privileged_without_host_devices_all_devices_allowed without privileged_without_host_devices": {
408447
config: &PluginConfig{
409448
ContainerdConfig: ContainerdConfig{

pkg/deprecation/deprecation.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ const (
2929
CRIRegistryMirrors Warning = Prefix + "cri-registry-mirrors"
3030
// CRIRegistryAuths is a warning for the use of the `auths` property
3131
CRIRegistryAuths Warning = Prefix + "cri-registry-auths"
32+
// CRIRegistryConfigs is a warning for the use of the `configs` property
33+
CRIRegistryConfigs Warning = Prefix + "cri-registry-configs"
3234
)
3335

3436
var messages = map[Warning]string{
@@ -39,6 +41,8 @@ var messages = map[Warning]string{
3941
"Use `config_path` instead.",
4042
CRIRegistryAuths: "The `auths` property of `[plugins.\"io.containerd.grpc.v1.cri\".registry]` is deprecated since containerd v1.3 and will be removed in containerd v2.0." +
4143
"Use `ImagePullSecrets` instead.",
44+
CRIRegistryConfigs: "The `configs` property of `[plugins.\"io.containerd.grpc.v1.cri\".registry]` is deprecated since containerd v1.5 and will be removed in containerd v2.0." +
45+
"Use `config_path` instead.",
4246
}
4347

4448
// Valid checks whether a given Warning is valid

0 commit comments

Comments
 (0)