Skip to content

Commit a30c2d1

Browse files
committed
cri: add deprecation warning for configs
Signed-off-by: Samuel Karp <[email protected]>
1 parent 1d1a56e commit a30c2d1

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
@@ -401,6 +401,11 @@ func ValidatePluginConfig(ctx context.Context, c *PluginConfig) ([]deprecation.W
401401
log.G(ctx).Warning("`mirrors` is deprecated, please use `config_path` instead")
402402
}
403403

404+
if len(c.Registry.Configs) != 0 {
405+
warnings = append(warnings, deprecation.CRIRegistryConfigs)
406+
log.G(ctx).Warning("`configs` is deprecated, please use `config_path` instead")
407+
}
408+
404409
// Validation for deprecated auths options and mapping it to configs.
405410
if len(c.Registry.Auths) != 0 {
406411
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
@@ -147,6 +147,45 @@ func TestValidateConfig(t *testing.T) {
147147
},
148148
warnings: []deprecation.Warning{deprecation.CRIRegistryMirrors},
149149
},
150+
"deprecated configs": {
151+
config: &PluginConfig{
152+
ContainerdConfig: ContainerdConfig{
153+
DefaultRuntimeName: RuntimeDefault,
154+
Runtimes: map[string]Runtime{
155+
RuntimeDefault: {},
156+
},
157+
},
158+
Registry: Registry{
159+
Configs: map[string]RegistryConfig{
160+
"gcr.io": {
161+
Auth: &AuthConfig{
162+
Username: "test",
163+
},
164+
},
165+
},
166+
},
167+
},
168+
expected: &PluginConfig{
169+
ContainerdConfig: ContainerdConfig{
170+
DefaultRuntimeName: RuntimeDefault,
171+
Runtimes: map[string]Runtime{
172+
RuntimeDefault: {
173+
Sandboxer: string(ModePodSandbox),
174+
},
175+
},
176+
},
177+
Registry: Registry{
178+
Configs: map[string]RegistryConfig{
179+
"gcr.io": {
180+
Auth: &AuthConfig{
181+
Username: "test",
182+
},
183+
},
184+
},
185+
},
186+
},
187+
warnings: []deprecation.Warning{deprecation.CRIRegistryConfigs},
188+
},
150189
"privileged_without_host_devices_all_devices_allowed without privileged_without_host_devices": {
151190
config: &PluginConfig{
152191
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)