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

enhance: split the containerd daamon control from ctrd #2318

Merged
merged 1 commit into from
Oct 17, 2018
Merged

enhance: split the containerd daamon control from ctrd #2318

merged 1 commit into from
Oct 17, 2018

Conversation

fuweid
Copy link
Contributor

@fuweid fuweid commented Oct 16, 2018

Signed-off-by: Wei Fu [email protected]

Ⅰ. Describe what this PR did

prepare for containerdV1.2

  1. make ctrd client package simple
  2. add health post check to containerd
  3. the default config of containerdV1.2 is different from V1.0.3. The
    supervisord package can help us to use configuration file to setup
    containerd. It's easy to maintain.

Ⅱ. Does this pull request fix one issue?

NONE

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

No need

Ⅳ. Describe how to verify it

When pouchd starts, it should connect to containerd.
When pouchd exits, it should shutdown the containerd.

Ⅴ. Special notes for reviews

@codecov
Copy link

codecov bot commented Oct 16, 2018

Codecov Report

Merging #2318 into master will decrease coverage by 0.03%.
The diff coverage is 60.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2318      +/-   ##
==========================================
- Coverage   67.33%   67.29%   -0.04%     
==========================================
  Files         213      215       +2     
  Lines       17517    17574      +57     
==========================================
+ Hits        11795    11827      +32     
- Misses       4327     4348      +21     
- Partials     1395     1399       +4
Flag Coverage Δ
#criv1alpha1test 32.35% <56.17%> (+0.12%) ⬆️
#criv1alpha2test 36.41% <56.17%> (+0.09%) ⬆️
#integrationtest 40.26% <60.11%> (+0.11%) ⬆️
#nodee2etest 33.67% <56.17%> (+0.01%) ⬆️
#unittest 23.34% <0%> (+0.14%) ⬆️
Impacted Files Coverage Δ
ctrd/client_opts.go 36.36% <ø> (-13.64%) ⬇️
ctrd/client.go 65.87% <100%> (+8.79%) ⬆️
ctrd/supervisord/daemon.go 57.24% <57.24%> (ø)
ctrd/supervisord/option.go 60% <60%> (ø)
daemon/daemon.go 56.15% <77.77%> (-0.1%) ⬇️
daemon/mgr/snapshot.go 89.85% <0%> (-4.35%) ⬇️
cri/v1alpha2/cri_wrapper.go 60% <0%> (-2.4%) ⬇️
pkg/utils/utils.go 82.44% <0%> (-2.13%) ⬇️
cri/v1alpha2/cri.go 68.61% <0%> (-0.25%) ⬇️
... and 3 more

return err
}

// reap the contaienrd process when it has been killed
Copy link
Contributor

Choose a reason for hiding this comment

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

%s/contaienrd/containerd

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch!

)
if err != nil {
logrus.Errorf("failed to start containerd: %v", err)
return nil
Copy link
Contributor

@HusterWan HusterWan Oct 17, 2018

Choose a reason for hiding this comment

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

Why return nil ?

I think we should return an error when NewDaemon got an error, Maybe we should fix this in later PR

@HusterWan
Copy link
Contributor

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Oct 17, 2018
Copy link
Collaborator

@allencloud allencloud left a comment

Choose a reason for hiding this comment

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

I add some comments, please take a look. @fuweid

@@ -3,30 +3,15 @@ package ctrd
import "fmt"

type clientOpts struct {
startDaemon bool
debugLog bool
rpcAddr string
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you help to add more illustration for all these fields in clientOpts.

Copy link
Contributor Author

@fuweid fuweid Oct 17, 2018

Choose a reason for hiding this comment

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

this part will be updated in the following pr because the ctrd will be updated. thanks

ctrd/supervisord/daemon.go Show resolved Hide resolved
func WithOOMScore(score int) Opt {
return func(d *Daemon) error {
if score > 1000 || score < -1000 {
return fmt.Errorf("oom-score range should be (-1000, 1000)")
Copy link
Collaborator

Choose a reason for hiding this comment

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

should it be [-1000, 1000], rather than (-1000,1000)?

daemon/daemon.go Outdated
@@ -31,7 +33,8 @@ import (
type Daemon struct {
config *config.Config
containerStore *meta.Store
containerd ctrd.APIClient
ctrdDaemon *supervisord.Daemon
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add more details about the fields here?


if err := d.containerd.Cleanup(); err != nil {
if err := d.ctrdDaemon.Stop(); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If d.ctrdClient.Cleanup() returns non-nil as well, here we will overwrite the errMsg. I think this has some potential possibility to miss information. How about using string append way to still keep the message? @fuweid

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. There is some issues about handing error. basically, I will update this part in following PR, not in this pr.

1. make ctrd client package simple
2. the default config of containerdV1.2 is different from V1.0.3. The
supervisord package can help us to use configuration file to setup
containerd. It's easy to maintain.

Signed-off-by: Wei Fu <[email protected]>
@allencloud
Copy link
Collaborator

LGTM and will merge this until the CI passes.

@allencloud allencloud merged commit 1f7dbf6 into AliyunContainerService:master Oct 17, 2018
@fuweid fuweid deleted the enhance_split_start_containerd_from_ctrd branch February 21, 2019 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
containerd-related LGTM one maintainer or community participant agrees to merge the pull reuqest. size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants