cri: add deprecation warning for mirrors
Signed-off-by: Samuel Karp <samuelkarp@google.com>
This commit is contained in:
parent
58cc275eb8
commit
d7cb25d770
@ -397,6 +397,7 @@ func ValidatePluginConfig(ctx context.Context, c *PluginConfig) ([]deprecation.W
|
||||
if useConfigPath {
|
||||
return warnings, errors.New("`mirrors` cannot be set when `config_path` is provided")
|
||||
}
|
||||
warnings = append(warnings, deprecation.CRIRegistryMirrors)
|
||||
log.G(ctx).Warning("`mirrors` is deprecated, please use `config_path` instead")
|
||||
}
|
||||
|
||||
|
@ -115,6 +115,37 @@ func TestValidateConfig(t *testing.T) {
|
||||
},
|
||||
expectedErr: "`mirrors` cannot be set when `config_path` is provided",
|
||||
},
|
||||
"deprecated mirrors": {
|
||||
config: &PluginConfig{
|
||||
ContainerdConfig: ContainerdConfig{
|
||||
DefaultRuntimeName: RuntimeDefault,
|
||||
Runtimes: map[string]Runtime{
|
||||
RuntimeDefault: {},
|
||||
},
|
||||
},
|
||||
Registry: Registry{
|
||||
Mirrors: map[string]Mirror{
|
||||
"example.com": {},
|
||||
},
|
||||
},
|
||||
},
|
||||
expected: &PluginConfig{
|
||||
ContainerdConfig: ContainerdConfig{
|
||||
DefaultRuntimeName: RuntimeDefault,
|
||||
Runtimes: map[string]Runtime{
|
||||
RuntimeDefault: {
|
||||
Sandboxer: string(ModePodSandbox),
|
||||
},
|
||||
},
|
||||
},
|
||||
Registry: Registry{
|
||||
Mirrors: map[string]Mirror{
|
||||
"example.com": {},
|
||||
},
|
||||
},
|
||||
},
|
||||
warnings: []deprecation.Warning{deprecation.CRIRegistryMirrors},
|
||||
},
|
||||
"privileged_without_host_devices_all_devices_allowed without privileged_without_host_devices": {
|
||||
config: &PluginConfig{
|
||||
ContainerdConfig: ContainerdConfig{
|
||||
|
@ -25,12 +25,16 @@ const (
|
||||
PullSchema1Image Warning = Prefix + "pull-schema-1-image"
|
||||
// GoPluginLibrary is a warning for the use of dynamic library Go plugins
|
||||
GoPluginLibrary Warning = Prefix + "go-plugin-library"
|
||||
// CRIRegistryMirrors is a warning for the use of the `mirrors` property
|
||||
CRIRegistryMirrors Warning = Prefix + "cri-registry-mirrors"
|
||||
)
|
||||
|
||||
var messages = map[Warning]string{
|
||||
PullSchema1Image: "Schema 1 images are deprecated since containerd v1.7 and removed in containerd v2.0. " +
|
||||
`Since containerd v1.7.8, schema 1 images are identified by the "io.containerd.image/converted-docker-schema1" label.`,
|
||||
GoPluginLibrary: "Dynamically-linked Go plugins as containerd runtimes are deprecated since containerd v2.0 and removed in containerd v2.1.",
|
||||
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." +
|
||||
"Use `config_path` instead.",
|
||||
}
|
||||
|
||||
// Valid checks whether a given Warning is valid
|
||||
|
Loading…
Reference in New Issue
Block a user