AliyunContainerService / pouch

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

wait until all the on going requests go to a stable state before shuti… #2985

Closed yyb196 closed 5 years ago

yyb196 commented 5 years ago

…ng down daemon

Signed-off-by: shenling.yyb shenling.yyb@alibaba-inc.com

Ⅰ. Describe what this PR did

We must make http requests finish their job or rollback before shutdown pouch daemon, or we will leave container or other object in unpredictable status.

Ⅱ. Does this pull request fix one issue?

none

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

No, I have test inside our environment.

Ⅳ. Describe how to verify it

StartContainer -> CreateEndpoint -> (shutdown)

If we can shutdown daemon at the exact time after CreateEndpoint, it will leave a veth network link on the host before applying this patch.

Ⅴ. Special notes for reviews

codecov[bot] commented 5 years ago

Codecov Report

Merging #2985 into master will decrease coverage by 0.02%. The diff coverage is 76.92%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2985      +/-   ##
==========================================
- Coverage   68.19%   68.17%   -0.03%     
==========================================
  Files         291      291              
  Lines       18366    18379      +13     
==========================================
+ Hits        12524    12529       +5     
- Misses       4383     4394      +11     
+ Partials     1459     1456       -3
Flag Coverage Δ
#criv1alpha2_test 34.79% <76.92%> (-0.01%) :arrow_down:
#integration_test_0 36.15% <76.92%> (-0.01%) :arrow_down:
#integration_test_1 35.55% <76.92%> (-0.01%) :arrow_down:
#integration_test_2 36.15% <76.92%> (ø) :arrow_up:
#integration_test_3 35.51% <15.38%> (-0.11%) :arrow_down:
#node_e2e_test 34.19% <76.92%> (ø) :arrow_up:
#unittest 27.89% <0%> (-0.03%) :arrow_down:
Impacted Files Coverage Δ
apis/server/router.go 91.61% <100%> (+0.1%) :arrow_up:
apis/server/server.go 61.4% <72.72%> (+2.7%) :arrow_up:
hookplugins/daemonplugin/daemon_hook.go 66.66% <0%> (-33.34%) :arrow_down:
daemon/daemon.go 67.82% <0%> (-1.99%) :arrow_down:
ctrd/supervisord/daemon.go 49.32% <0%> (-1.36%) :arrow_down:
cri/v1alpha2/cri.go 64.09% <0%> (+0.25%) :arrow_up:
ctrd/container.go 53.55% <0%> (+0.37%) :arrow_up: