Add support for required plugins.#3197
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3197 +/- ##
==========================================
- Coverage 45.19% 45.14% -0.06%
==========================================
Files 111 111
Lines 12009 12024 +15
==========================================
Hits 5428 5428
- Misses 5746 5761 +15
Partials 835 835
Continue to review full report at Codecov.
|
|
Add required plugins to |
|
@Ace-Tang What do you mean? You mean adding |
I am not mean to put cri as a required plugins by default. I mean we can put required_plugins field (empty or not) in example config, |
fdc4f25 to
689d70f
Compare
|
@Ace-Tang You mean this? Updated the PR. |
|
@Random-Liu , yes 👍 |
|
Looks good to me |
There was a problem hiding this comment.
Why not convert this into a map at the beginning of load and handle the error after result.Instance()?
There was a problem hiding this comment.
I remember what I thought.
A required plugin may not be included in the plugin list at all, in that case, we should also return error.
So even if we did #3197 (comment), we still need a loop at the end to check whether all required plugins are loaded.
In this case, do you still prefer that? If yes, I'll make the change. :)
There was a problem hiding this comment.
Why not just delete from the map as plugins are loaded, and then at the end of the load loop, if anything is left in the map you exit containerd start with a "required plugin(s) not included" list.
There was a problem hiding this comment.
When required plugin failed to be loaded:
containerd: load required plugin io.containerd.grpc.v1.cri: invalid config: conflicting definitions: configuration includes untrusted_workload_runtime and runtimes['untrusted']
# containerd exit
When required plugin is not included:
containerd: required plugin [abc] not included
# containerd exit
Signed-off-by: Lantao Liu <[email protected]>
689d70f to
4b3b99e
Compare
By default, containerd keeps running when a plugin fails to be initialized. However, some users may require some plugins for their use case, e.g. the
criplugin is critical for Kubernetes users.This is even worse when we add more and more config validations in the CRI plugin, e.g. containerd/cri#1125. If a bad CRI config is given, containerd will continue running without the CRI plugin, which makes it very hard to figure out what is wrong.
This PR added the
required_pluginsconfig. If a required plugin is missing or fails to be loaded/started, containerd will exit directly.Signed-off-by: Lantao Liu [email protected]