AliyunContainerService / pouch

An Efficient Enterprise-class Container Engine
https://pouchcontainer.io
Apache License 2.0
4.64k stars 949 forks source link

fix: compatiable with legacy and newly pod when stop pod #2982

Closed zhuangqh closed 5 years ago

zhuangqh commented 5 years ago

Ⅰ. Describe what this PR did

  1. for legacy dockershim style container, lifecycle of podNetwork is bound to container using /proc/$pid/ns/net. When stopping sandbox, we first teardown the pod network, then stop the sandbox container.
  2. In newly implementation. We first create an empty netns and setup pod network inside it, which is independent from container lifecycle. When stopping sandbox, we first stop container, then teardown the pod network, which is a reverse operation of RunPodSandbox.

Signed-off-by: zhuangqh zhuangqhc@gmail.com

Ⅱ. Does this pull request fix one issue?

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

CRI test

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

codecov[bot] commented 5 years ago

Codecov Report

Merging #2982 into master will decrease coverage by 0.82%. The diff coverage is 11.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2982      +/-   ##
==========================================
- Coverage   68.19%   67.36%   -0.83%     
==========================================
  Files         291      291              
  Lines       18366    18371       +5     
==========================================
- Hits        12524    12376     -148     
- Misses       4383     4496     +113     
- Partials     1459     1499      +40
Flag Coverage Δ
#criv1alpha2_test 34.72% <11.11%> (-0.07%) :arrow_down:
#integration_test_0 36.12% <0%> (-0.04%) :arrow_down:
#integration_test_1 35.54% <0%> (-0.02%) :arrow_down:
#integration_test_2 36.1% <0%> (-0.05%) :arrow_down:
#integration_test_3 ?
#node_e2e_test 34.09% <11.11%> (-0.1%) :arrow_down:
#unittest 27.91% <0%> (-0.01%) :arrow_down:
Impacted Files Coverage Δ
cri/v1alpha2/cri.go 63.06% <11.11%> (-0.78%) :arrow_down:
daemon/logger/syslog/fmt.go 0% <0%> (-33.34%) :arrow_down:
daemon/mgr/image_load.go 41.66% <0%> (-16.67%) :arrow_down:
daemon/logger/syslog/syslog.go 59.34% <0%> (-16.49%) :arrow_down:
daemon/mgr/container_checkpoint.go 59.03% <0%> (-9.64%) :arrow_down:
cri/ocicni/netns.go 52.7% <0%> (-5.41%) :arrow_down:
ctrd/watch.go 72.97% <0%> (-5.41%) :arrow_down:
apis/server/container_bridge.go 85.83% <0%> (-4.73%) :arrow_down:
apis/server/image_bridge.go 74.26% <0%> (-4.42%) :arrow_down:
daemon/mgr/volume.go 79% <0%> (-4%) :arrow_down:
... and 17 more