Skip to content
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

if run sandbox failed, clean up; deduplicate the default mounts with user defined ones #1468

Merged
merged 1 commit into from
Jun 11, 2018

Conversation

YaoZengzeng
Copy link
Contributor

Signed-off-by: YaoZengzeng yaozengzeng@zju.edu.cn

Ⅰ. Describe what this PR did

When I try to launch a pod of flannel, there are two problems:

  1. flannel pod will mount the /run in the host to the container's /run, which is duplicate with the default mounts created by pouchd and we should override the default one.

  2. When an error occurred in the process of running a sandbox (for example, network not initialized), we should delete the running sandbox container. Otherwise kubelet will list the sandboxes and to wrongly assume the error sandbox is running which is not expected.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how you did it

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

…user defined ones

Signed-off-by: YaoZengzeng <yaozengzeng@zju.edu.cn>
@codecov-io
Copy link

Codecov Report

Merging #1468 into master will decrease coverage by 0.09%.
The diff coverage is 24%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #1468     +/-   ##
=========================================
- Coverage   40.12%   40.03%   -0.1%     
=========================================
  Files         250      250             
  Lines       16352    16390     +38     
=========================================
  Hits         6561     6561             
- Misses       8949     8983     +34     
- Partials      842      846      +4
Impacted Files Coverage Δ
cri/v1alpha1/cri.go 0% <0%> (ø) ⬆️
cri/v1alpha2/cri.go 0% <0%> (ø) ⬆️
daemon/mgr/spec_mount.go 70.21% <54.54%> (-2.41%) ⬇️
daemon/mgr/container_utils.go 47.75% <0%> (-3.34%) ⬇️
ctrd/watch.go 75% <0%> (-3.13%) ⬇️
daemon/containerio/container_io.go 59.74% <0%> (-1.3%) ⬇️
daemon/mgr/network.go 68.79% <0%> (-0.5%) ⬇️
daemon/mgr/container.go 49.74% <0%> (-0.09%) ⬇️
daemon/logger/jsonfile/utils.go 71.66% <0%> (+1.66%) ⬆️

@YaoZengzeng
Copy link
Contributor Author

@allencloud PTAL

defer func() {
// If running sandbox failed, clean up the sandbox directory.
if retErr != nil {
os.RemoveAll(sandboxRootDir)
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about declaring the variable sandboxRootDir before the first defer func(), and then I think we could combine the two defers into a single one. WDYT? @YaoZengzeng

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually we can't, because sandboxRootDir := path.Join(c.SandboxBaseDir, id) and we should get the container ID first :)

@allencloud
Copy link
Collaborator

the design LGTM, tiny comments there.

@allencloud
Copy link
Collaborator

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Jun 11, 2018
@allencloud allencloud merged commit 5159116 into AliyunContainerService:master Jun 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LGTM one maintainer or community participant agrees to merge the pull reuqest. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants