Skip to content

Add support for required plugins.#3197

Merged
estesp merged 1 commit intocontainerd:masterfrom
Random-Liu:add-required-plugins
Apr 11, 2019
Merged

Add support for required plugins.#3197
estesp merged 1 commit intocontainerd:masterfrom
Random-Liu:add-required-plugins

Conversation

@Random-Liu
Copy link
Copy Markdown
Member

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 cri plugin 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_plugins config. If a required plugin is missing or fails to be loaded/started, containerd will exit directly.

Signed-off-by: Lantao Liu [email protected]

@Random-Liu Random-Liu added this to the 1.3 milestone Apr 9, 2019
@codecov-io
Copy link
Copy Markdown

codecov-io commented Apr 9, 2019

Codecov Report

Merging #3197 into master will decrease coverage by 0.05%.
The diff coverage is 0%.

Impacted file tree graph

@@            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
Flag Coverage Δ
#linux 49.23% <0%> (-0.06%) ⬇️
#windows 40.4% <0%> (-0.07%) ⬇️
Impacted Files Coverage Δ
services/server/server.go 1.35% <0%> (-0.08%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 475619c...4b3b99e. Read the comment docs.

@Ace-Tang
Copy link
Copy Markdown
Contributor

Ace-Tang commented Apr 9, 2019

Add required plugins to containerd config default command ?

@Random-Liu
Copy link
Copy Markdown
Member Author

@Ace-Tang What do you mean? You mean adding cri as required plugins by default?

@Ace-Tang
Copy link
Copy Markdown
Contributor

Ace-Tang commented Apr 9, 2019

@Ace-Tang What do you mean? You mean adding cri as required plugins by default?

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, containerd config default shows a good example config for users

@Random-Liu Random-Liu force-pushed the add-required-plugins branch from fdc4f25 to 689d70f Compare April 9, 2019 07:18
@Random-Liu
Copy link
Copy Markdown
Member Author

Random-Liu commented Apr 9, 2019

@Ace-Tang You mean this? Updated the PR.

$ ./bin/containerd config default
root = "/var/lib/containerd"
state = "/run/containerd"
plugin_dir = ""
disabled_plugins = []
required_plugins = []
oom_score = 0
...

@Ace-Tang
Copy link
Copy Markdown
Contributor

Ace-Tang commented Apr 9, 2019

@Random-Liu , yes 👍

@Ace-Tang
Copy link
Copy Markdown
Contributor

Ace-Tang commented Apr 9, 2019

Looks good to me

Comment thread services/server/server.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not convert this into a map at the beginning of load and handle the error after result.Instance()?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Copy Markdown
Member Author

@Random-Liu Random-Liu Apr 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Random-Liu Random-Liu force-pushed the add-required-plugins branch from 689d70f to 4b3b99e Compare April 10, 2019 18:32
Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@estesp estesp merged commit 5703f41 into containerd:master Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants