Skip to content

Commit b68204e

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 ae8c583 commit b68204e

3 files changed

Lines changed: 46 additions & 0 deletions

File tree

pkg/cri/config/config.go

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

423+
if len(c.Registry.Configs) != 0 {
424+
warnings = append(warnings, deprecation.CRIRegistryConfigs)
425+
log.G(ctx).Warning("`configs` is deprecated, please use `config_path` instead")
426+
}
427+
423428
// Validation for deprecated auths options and mapping it to configs.
424429
if len(c.Registry.Auths) != 0 {
425430
if c.Registry.Configs == nil {

pkg/cri/config/config_test.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,43 @@ func TestValidateConfig(t *testing.T) {
393393
},
394394
warnings: []deprecation.Warning{deprecation.CRIRegistryMirrors},
395395
},
396+
"deprecated configs": {
397+
config: &PluginConfig{
398+
ContainerdConfig: ContainerdConfig{
399+
DefaultRuntimeName: RuntimeDefault,
400+
Runtimes: map[string]Runtime{
401+
RuntimeDefault: {},
402+
},
403+
},
404+
Registry: Registry{
405+
Configs: map[string]RegistryConfig{
406+
"gcr.io": {
407+
Auth: &AuthConfig{
408+
Username: "test",
409+
},
410+
},
411+
},
412+
},
413+
},
414+
expected: &PluginConfig{
415+
ContainerdConfig: ContainerdConfig{
416+
DefaultRuntimeName: RuntimeDefault,
417+
Runtimes: map[string]Runtime{
418+
RuntimeDefault: {},
419+
},
420+
},
421+
Registry: Registry{
422+
Configs: map[string]RegistryConfig{
423+
"gcr.io": {
424+
Auth: &AuthConfig{
425+
Username: "test",
426+
},
427+
},
428+
},
429+
},
430+
},
431+
warnings: []deprecation.Warning{deprecation.CRIRegistryConfigs},
432+
},
396433
} {
397434
t.Run(desc, func(t *testing.T) {
398435
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
@@ -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)