libcontainerd: split client and daemon supervision#37149
libcontainerd: split client and daemon supervision#37149thaJeztah merged 1 commit intomoby:masterfrom
Conversation
e7f5ed8 to
afc7dd0
Compare
|
Build failing due to conflicts. |
|
Is there some reason you have the containerd 1.1 update in this PR? I think this is blocked on other issues. |
Which other issues? The containerd 1.1 is blocked by some issues updating grpc. I believe I also need an updated GRPC for this PR, haven't tested with older ones. I don't see a need to push for this without containerd 1.1 though. |
955f0cc to
ae24d4c
Compare
Codecov Report
@@ Coverage Diff @@
## master #37149 +/- ##
=========================================
Coverage ? 35.84%
=========================================
Files ? 606
Lines ? 44699
Branches ? 0
=========================================
Hits ? 16021
Misses ? 26469
Partials ? 2209 |
ae24d4c to
0abacdb
Compare
7f07422 to
51dffbf
Compare
|
@dmcgowan this still WIP? |
|
Removing wip, janky is at least passing now |
cmd/dockerd/daemon.go
Outdated
There was a problem hiding this comment.
This looks new; where/when was this directory created in the past?
I also see some validations steps below that may fail; is it possible to move this further down, so that we don't end up with this directory if the configuration happened to be invalid?
Finally; not sure if this directory needs special treatment (as the "daemon" root gets); also taking into account that this code is both Linux and Windows (and Windows doesn't handle permissions similar to Linux)
Lines 1136 to 1187 in 8e2f920
Lines 472 to 479 in 6cd806a
There was a problem hiding this comment.
Previously this directory was getting created as a side effect of getting a containerd client. This seemed to be an inappropriate way to create a shared directory so I just moved it here. It is still getting created with same permissions at roughly the same time though.
cmd/dockerd/daemon.go
Outdated
There was a problem hiding this comment.
Should we use cli.Config.LogLevel for this? (That's set to debug if debug is enabled, but otherwise uses what's configured by the user) see #37419
There was a problem hiding this comment.
Looks like you addressed this based on the last rebase
51dffbf to
09b899a
Compare
Adds a supervisor package for starting and monitoring containerd. Separates grpc connection allowing access from daemon. Signed-off-by: Derek McGowan <[email protected]>
09b899a to
dd2e19e
Compare
| if cli.Config.ContainerdAddr == "" && runtime.GOOS != "windows" { | ||
| opts, err := cli.getContainerdDaemonOpts() | ||
| if err != nil { | ||
| cancel() |
There was a problem hiding this comment.
It looks like if you move defer cancel() to right after context.WithCancel you won't have to call it explicitly, i.e.
ctx, cancel := context.WithCancel(context.Background())
+ defer cancel()
 if cli.Config.ContainerdAddr == "" && runtime.GOOS != "windows" {
 opts, err := cli.getContainerdDaemonOpts()
 if err != nil {
- cancel()
 return fmt.Errorf("Failed to generate containerd options: %v", err)
 }There was a problem hiding this comment.
This is actually like this on purpose, the defer ordering is important because the cancel() should run before r.WaitTimeout(10 * time.Second). I should probably note this in a comment
| return err | ||
| r, err := supervisor.Start(ctx, filepath.Join(cli.Config.Root, "containerd"), filepath.Join(cli.Config.ExecRoot, "containerd"), opts...) | ||
| if err != nil { | ||
| cancel() |
|
LGTM except for a tiny nitpick with |
|
let's merge; the defer is a nice to have; think we should be good with the code as is 👍 |
Adds a supervisor package for starting and monitoring containerd.
Moves grpc connection into daemon for use by libcontainerd and any other process.