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

shim: GRPC service #462

Merged
merged 17 commits into from Jan 27, 2017
Merged

shim: GRPC service #462

merged 17 commits into from Jan 27, 2017

Conversation

crosbymichael
Copy link
Member

This makes the shim work over grpc and allows one shim per container. Before it was one shim per process with each exec having its own.

Please take a look and let me know what you think of this new model. I implemented the new runc logic for terminal creation and hid some of the nasty io handling in the runc lib.

I still need to implement exec fully and do some testing but opening this for an early review.

@crosbymichael
Copy link
Member Author

The large diff is from the proto generation

Copy link
Contributor

@mlaventure mlaventure left a comment

Choose a reason for hiding this comment

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

A few nits, but it looks pretty good otherwise

}

message PtyRequest {
message CreateRequest {
string id = 1 [(gogoproto.customname) = "ID"];
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: misaligned

}

message ExecRequest {

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: extra newline

}

message PtyRequest {
uint32 pid = 1;
uint32 width = 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: alignment

return nil, err
}
runtime := &runc.Runc{
Command: r.Runtime,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we get runtimeArgs too?

console *runc.Console
io runc.IO
runc *runc.Runc
status int
Copy link
Contributor

Choose a reason for hiding this comment

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

ExitStatus/ExitCode?

if err := p.runc.Create(context, r.ID, r.Bundle, opts); err != nil {
return nil, err
}
if socket != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd if r.Terminal for consistency with the above. If the socket is nil at the point with r.Terminal = true, then there's an issue with go-runc or runc

IO: io,
NoPivot: r.NoPivot,
}
if err := p.runc.Create(context, r.ID, r.Bundle, opts); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

need a defer to kill the process on subsequent errors

)
if r.Terminal {
if socket, err = runc.NewConsoleSocket(filepath.Join(cwd, "pty.sock")); err != nil {
return nil, err
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use the errors package since go-runc doesn't?

}

func (p *initProcess) Delete(context context.Context) error {
p.killAll(context)
Copy link
Contributor

Choose a reason for hiding this comment

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

Return here on error? so containerd doesn't delete the state directory?

go func() {
defer l.Close()
if err := server.Serve(l); err != nil {
l.Close()
Copy link
Contributor

Choose a reason for hiding this comment

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

there's already a defer above for it

@@ -6,14 +6,49 @@ import "google/protobuf/empty.proto";
import "gogoproto/gogo.proto";

service ShimService {
Copy link
Member

Choose a reason for hiding this comment

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

No need to repeat Service. Generated code will call this service.

@stevvooe
Copy link
Member

LGTM after vendor fix.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This also finishes the service implementation of the shim behind GRPC

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Copy link
Contributor

@mlaventure mlaventure left a comment

Choose a reason for hiding this comment

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

LGTM

The service will need to be updated next though

@mlaventure mlaventure merged commit 24c2810 into containerd:master Jan 27, 2017
@crosbymichael crosbymichael deleted the shim branch January 27, 2017 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants