Port over supervisor to use grpc shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
e1eeb40d1d
commit
f187da9485
13 changed files with 811 additions and 497 deletions
|
@ -54,7 +54,7 @@ func main() {
|
|||
}
|
||||
var (
|
||||
server = grpc.NewServer()
|
||||
sv = shim.NewService()
|
||||
sv = shim.New()
|
||||
)
|
||||
logrus.Debug("registering grpc server")
|
||||
apishim.RegisterShimServer(server, sv)
|
||||
|
|
|
@ -22,9 +22,8 @@ import (
|
|||
"github.com/docker/containerd"
|
||||
api "github.com/docker/containerd/api/execution"
|
||||
"github.com/docker/containerd/events"
|
||||
"github.com/docker/containerd/execution"
|
||||
"github.com/docker/containerd/execution/executors/shim"
|
||||
"github.com/docker/containerd/log"
|
||||
"github.com/docker/containerd/supervisor"
|
||||
"github.com/docker/containerd/utils"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/urfave/cli"
|
||||
|
@ -58,11 +57,6 @@ func main() {
|
|||
Usage: "containerd state directory",
|
||||
Value: "/run/containerd",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "runtime",
|
||||
Usage: "runtime for execution",
|
||||
Value: "shim",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "socket, s",
|
||||
Usage: "socket path for containerd's GRPC server",
|
||||
|
@ -139,29 +133,14 @@ func main() {
|
|||
}
|
||||
defer nec.Close()
|
||||
|
||||
var (
|
||||
executor execution.Executor
|
||||
runtime = context.GlobalString("runtime")
|
||||
)
|
||||
log.G(ctx).WithField("runtime", runtime).Info("run with runtime executor")
|
||||
execCtx := log.WithModule(ctx, "execution")
|
||||
execCtx = events.WithPoster(execCtx, events.GetNATSPoster(nec))
|
||||
switch runtime {
|
||||
case "shim":
|
||||
root := filepath.Join(context.GlobalString("root"), "shim")
|
||||
err = os.MkdirAll(root, 0700)
|
||||
if err != nil && !os.IsExist(err) {
|
||||
return err
|
||||
}
|
||||
executor, err = shim.New(log.WithModule(execCtx, "shim"), root, "containerd-shim", "runc", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
default:
|
||||
return fmt.Errorf("oci: runtime %q not implemented", runtime)
|
||||
root := filepath.Join(context.GlobalString("root"), "shim")
|
||||
err = os.Mkdir(root, 0700)
|
||||
if err != nil && !os.IsExist(err) {
|
||||
return err
|
||||
}
|
||||
|
||||
execService, err := execution.New(execCtx, executor)
|
||||
execService, err := supervisor.New(execCtx, context.GlobalString("root"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ var listCommand = cli.Command{
|
|||
c.ID,
|
||||
c.Status,
|
||||
len(listProcResponse.Processes),
|
||||
c.BundlePath,
|
||||
c.Bundle,
|
||||
)
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -292,5 +292,4 @@ func getShimService() (shim.ShimClient, error) {
|
|||
return nil, err
|
||||
}
|
||||
return shim.NewShimClient(conn), nil
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue