|
| 1 | +/* |
| 2 | + Copyright The containerd Authors. |
| 3 | +
|
| 4 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + you may not use this file except in compliance with the License. |
| 6 | + You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | + Unless required by applicable law or agreed to in writing, software |
| 11 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + See the License for the specific language governing permissions and |
| 14 | + limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +package deprecation |
| 18 | + |
| 19 | +type Warning string |
| 20 | + |
| 21 | +const ( |
| 22 | + // Prefix is a standard prefix for all Warnings, used for filtering plugin Exports |
| 23 | + Prefix = "io.containerd.deprecation/" |
| 24 | + // PullSchema1Image is a warning for the use of schema 1 images |
| 25 | + PullSchema1Image Warning = Prefix + "pull-schema-1-image" |
| 26 | + // GoPluginLibrary is a warning for the use of dynamic library Go plugins |
| 27 | + GoPluginLibrary Warning = Prefix + "go-plugin-library" |
| 28 | +) |
| 29 | + |
| 30 | +var messages = map[Warning]string{ |
| 31 | + PullSchema1Image: "Schema 1 images are deprecated since containerd v1.7 and removed in containerd v2.0. " + |
| 32 | + `Since containerd v1.7.8, schema 1 images are identified by the "io.containerd.image/converted-docker-schema1" label.`, |
| 33 | + GoPluginLibrary: "Dynamically-linked Go plugins as containerd runtimes will be deprecated in containerd v2.0 and removed in containerd v2.1.", |
| 34 | +} |
| 35 | + |
| 36 | +// Valid checks whether a given Warning is valid |
| 37 | +func Valid(id Warning) bool { |
| 38 | + _, ok := messages[id] |
| 39 | + return ok |
| 40 | +} |
| 41 | + |
| 42 | +// Message returns the human-readable message for a given Warning |
| 43 | +func Message(id Warning) (string, bool) { |
| 44 | + msg, ok := messages[id] |
| 45 | + return msg, ok |
| 46 | +} |
0 commit comments