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

fix: return error if it fails to tear down network in stopsandbox #2836

Merged
merged 2 commits into from
May 13, 2019

Conversation

zhuangqh
Copy link
Contributor

Ⅰ. Describe what this PR did

  1. fix: return error if it fails to tear down network in stopsandbox

treat it as success if the the netns dont exists, otherwise, return error
kubelet will retry the StopPodSandbox method, avoiding cni leaking

  1. buildNetworkRelatedPath in netns network mode

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

Signed-off-by: zhuangqh <zhuangqhc@gmail.com>
treat it as success if the the netns dont exists, otherwise, return error
kubelet will retry the StopPodSandbox method, avoiding cni leaking

Signed-off-by: zhuangqh <zhuangqhc@gmail.com>
@codecov
Copy link

codecov bot commented May 13, 2019

Codecov Report

Merging #2836 into master will increase coverage by <.01%.
The diff coverage is 75%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2836      +/-   ##
=========================================
+ Coverage   69.09%   69.1%   +<.01%     
=========================================
  Files         285     285              
  Lines       17779   17780       +1     
=========================================
+ Hits        12285   12287       +2     
+ Misses       4097    4095       -2     
- Partials     1397    1398       +1
Flag Coverage Δ
#criv1alpha2_test 39.02% <75%> (ø) ⬆️
#integration_test_0 36.59% <0%> (ø) ⬆️
#integration_test_1 35.33% <0%> (+0.01%) ⬆️
#integration_test_2 36.52% <0%> (-0.01%) ⬇️
#integration_test_3 35.39% <0%> (+0.01%) ⬆️
#node_e2e_test 34.75% <75%> (-0.01%) ⬇️
#unittest 28.57% <0%> (ø) ⬆️
Impacted Files Coverage Δ
cri/v1alpha2/cri.go 69.06% <0%> (-0.26%) ⬇️
cri/ocicni/cni_manager.go 61.11% <100%> (+0.73%) ⬆️
daemon/mgr/container.go 60.18% <100%> (+0.31%) ⬆️
cri/ocicni/netns.go 58.1% <0%> (-2.71%) ⬇️
pkg/meta/store.go 67.44% <0%> (-1.56%) ⬇️
daemon/mgr/container_utils.go 82.38% <0%> (-1.14%) ⬇️
ctrd/container.go 53.88% <0%> (-0.38%) ⬇️
ctrd/supervisord/daemon.go 50.67% <0%> (+1.35%) ⬆️
... and 2 more

@pouchrobot pouchrobot added areas/network kind/bug This is bug report for project size/S labels May 13, 2019
@@ -473,7 +473,7 @@ func (c *CriManager) StopPodSandbox(ctx context.Context, r *runtime.StopPodSandb
// Teardown network of the pod, if it is not in host network mode.
if sandboxNetworkMode(sandboxMeta.Config) != runtime.NamespaceMode_NODE {
if err = c.teardownNetwork(podSandboxID, sandboxMeta.NetNS, sandboxMeta.Config); err != nil {
logrus.Warnf("failed to find network namespace file %s of sandbox %s which may have been already stopped", sandboxMeta.NetNS, podSandboxID)
return nil, fmt.Errorf("failed to teardown network of sandbox %s, ns path: %v", podSandboxID, sandboxMeta.NetNS)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not output the detailed err?

if _, err = os.Stat(podNetwork.NetNS); err != nil {
if os.IsNotExist(err) {
logrus.Warnf("failed to find network namespace file %s of sandbox %s", podNetwork.NetNS, podNetwork.ID)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not output the detailed error?

@rudyfly
Copy link
Collaborator

rudyfly commented May 13, 2019

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label May 13, 2019
@rudyfly rudyfly merged commit 2596dc7 into AliyunContainerService:master May 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
areas/network kind/bug This is bug report for project LGTM one maintainer or community participant agrees to merge the pull reuqest. size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants