-
Notifications
You must be signed in to change notification settings - Fork 949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: support containerd shim v2 #2759
feature: support containerd shim v2 #2759
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2759 +/- ##
==========================================
- Coverage 69.07% 69.05% -0.02%
==========================================
Files 285 285
Lines 17758 17803 +45
==========================================
+ Hits 12266 12294 +28
- Misses 4092 4102 +10
- Partials 1400 1407 +7
|
96e1c6d
to
72002f6
Compare
72002f6
to
e18909f
Compare
1be2091
to
af0d9d3
Compare
RuntimeRoot: ctrd.RuntimeRoot, | ||
CriuPath: o.CriuPath, | ||
SystemdCgroup: mgr.Config.UseSystemd(), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generate a brand new options according to the configuration which were passed from config file, thus, there is no data race.
we directly replace some fields here, because these fields are allowed to be configurable directly.
} | ||
|
||
r.Options = options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not correct, runtime type is different from runtime which we add in config. For runtime type, it can be pass by cri , we do not need to add them into config, and validate it.
As we get more runtime concept, we can remove the runtime validate, just add parameter here (it can be disscussed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What passed from CRI is also an alias name of actual runtime type and runtime options.
ContainerManager side should maintain a map (name -> runtime config), and CRI would use the name to choose the actual containerd runtime config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be decided by containerd, why use a alias name ?
if _, exist := mgr.Config.Runtimes[config.HostConfig.Runtime]; !exist { | ||
return nil, errors.Wrapf(errtypes.ErrInvalidParam, "unknown runtime %s", config.HostConfig.Runtime) | ||
config.HostConfig.RuntimeType, err = mgr.getRuntimeType(config.HostConfig.Runtime) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks weird to validata runtime type,
@@ -780,7 +781,7 @@ func (mgr *ContainerManager) createContainerdContainer(ctx context.Context, c *C | |||
// set container's LogPath | |||
mgr.SetContainerLogPath(c) | |||
|
|||
runtime, err := mgr.getRuntime(c.HostConfig.Runtime) | |||
runtimeOptions, err := mgr.generateRuntimeOptions(c.HostConfig.Runtime) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the real entrance to create a container. Two situation to goto this method, first, normally create a container from user interface, second, PouchContainer reload containers at restart time.
Inconvenient to store the runtimeOptions to the disk, containerd required a typed pointer, but we would get a map if we reload the value from disk(under restart and reload situation). Thus, we generate options every time.
I think pouch should less concern the runtime type information, if it is wrong, containerd will tells. |
@zhuangqh , could you describe how cri reslove these options, and how we get this from cri, it will help |
alright. On CRI side, there is only a |
af0d9d3
to
49e0ae8
Compare
49e0ae8
to
1ad2875
Compare
Signed-off-by: zhuangqh <zhuangqhc@gmail.com>
1ad2875
to
b40185a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: zhuangqh zhuangqhc@gmail.com
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
fixes #2749
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews
/run