-
Notifications
You must be signed in to change notification settings - Fork 944
feature: make runtime choosing supported in CRI managers for Kubernetes #1593
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
Conversation
c84d56a to
a0f3373
Compare
Codecov Report
@@ Coverage Diff @@
## master #1593 +/- ##
==========================================
- Coverage 41.97% 40.82% -1.16%
==========================================
Files 270 270
Lines 17609 18106 +497
==========================================
Hits 7392 7392
- Misses 9307 9806 +499
+ Partials 910 908 -2
|
daemon/mgr/container.go
Outdated
| if err != nil { | ||
| return nil, err | ||
| id := "" | ||
| if id = config.ContainerID; id == "" { |
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.
Why not code like this:
id := config.ContainerID
if id == "" {
...
}It seems more concise. 😄
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.
Done.
cri/v1alpha2/cri_utils.go
Outdated
|
|
||
| // makeSandboxPouchConfig returns apitypes.ContainerCreateConfig based on runtime.PodSandboxConfig. | ||
| func makeSandboxPouchConfig(config *runtime.PodSandboxConfig, image string) (*apitypes.ContainerCreateConfig, error) { | ||
| func makeSandboxPouchConfig(config *runtime.PodSandboxConfig, sandboxID string, image string) (*apitypes.ContainerCreateConfig, error) { |
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.
sandboxID, image string
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.
Done.
| @@ -0,0 +1,19 @@ | |||
| package annotations | |||
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.
maybe we should put the annotations into cri package
cri/v1alpha1/cri.go
Outdated
| return nil, err | ||
| } | ||
|
|
||
| id, err := c.ContainerMgr.GenerateID() |
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's the purpose of generating ContainerID in CRI?
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.
It will be used before sandbox has been created.
cb2eebf to
6f67f23
Compare
dca0326 to
364bf2b
Compare
apis/types/container_config.go
Outdated
| Cmd []string `json:"Cmd"` | ||
|
|
||
| // The ID of the container | ||
| ContainerID string `json:"ContainerID,omitempty"` |
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.
ContainerID is used to be as SandboxID? I think it's a little confusing in the API level. Could we use annotation to handle this part?
cc @YaoZengzeng @starnop
cri/v1alpha2/cri_utils.go
Outdated
| func (c *CriManager) updateCreateConfig(createConfig *apitypes.ContainerCreateConfig, config *runtime.ContainerConfig, sandboxConfig *runtime.PodSandboxConfig, podSandboxID string) error { | ||
| // Apply runtime options. | ||
| if annotations := config.GetAnnotations(); annotations != nil { | ||
| createConfig.HostConfig.Runtime = annotations[anno.KubernetesRuntime] |
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.
if the annotations[anno.KubernetesRuntime] is emtpy?
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.
createConfig.HostConfig.Runtime will be "", and then PouchContainer will use the DefaultRuntime,which is runc.
// set container runtime
if config.HostConfig.Runtime == "" {
config.HostConfig.Runtime = mgr.Config.DefaultRuntime
}
Signed-off-by: Starnop <[email protected]>
|
LGTM @YaoZengzeng please take a look |
Signed-off-by: Starnop [email protected]
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
fixes part of #1580
Ⅲ. Describe how you did it
Ⅳ. Describe how to verify it
pouch psto observe the runtime of the container.Ⅴ. Special notes for reviews