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
shim: GRPC service #462
Conversation
The large diff is from the proto generation |
There was a problem hiding this 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"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: misaligned
} | ||
|
||
message ExecRequest { | ||
|
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
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>
There was a problem hiding this 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
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.