From ea00fc793bd1dca2e944bcd1fc8b576fe995c753 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Thu, 1 Feb 2018 17:18:40 -0500 Subject: [PATCH 1/3] Remove protobuf for mount in shim Signed-off-by: Michael Crosby --- linux/proc/types.go | 10 ++++++++-- linux/shim/service.go | 12 +++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/linux/proc/types.go b/linux/proc/types.go index 9055c25d1..42dae5abf 100644 --- a/linux/proc/types.go +++ b/linux/proc/types.go @@ -1,16 +1,22 @@ package proc import ( - containerd_types "github.com/containerd/containerd/api/types" google_protobuf "github.com/gogo/protobuf/types" ) +type Mount struct { + Type string + Source string + Target string + Options []string +} + // CreateConfig hold task creation configuration type CreateConfig struct { ID string Bundle string Runtime string - Rootfs []*containerd_types.Mount + Rootfs []Mount Terminal bool Stdin string Stdout string diff --git a/linux/shim/service.go b/linux/shim/service.go index a8c0b7b1f..cf5baf11d 100644 --- a/linux/shim/service.go +++ b/linux/shim/service.go @@ -95,6 +95,16 @@ type Service struct { func (s *Service) Create(ctx context.Context, r *shimapi.CreateTaskRequest) (*shimapi.CreateTaskResponse, error) { s.mu.Lock() defer s.mu.Unlock() + + var mounts []proc.Mount + for _, m := range r.Rootfs { + mounts = append(mounts, proc.Mount{ + Type: m.Type, + Source: m.Source, + Target: m.Target, + Options: m.Options, + }) + } process, err := proc.New( ctx, s.config.Path, @@ -108,7 +118,7 @@ func (s *Service) Create(ctx context.Context, r *shimapi.CreateTaskRequest) (*sh ID: r.ID, Bundle: r.Bundle, Runtime: r.Runtime, - Rootfs: r.Rootfs, + Rootfs: mounts, Terminal: r.Terminal, Stdin: r.Stdin, Stdout: r.Stdout, From db78450e8bffe046da489e670c802e57777ad329 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Thu, 1 Feb 2018 17:20:49 -0500 Subject: [PATCH 2/3] Remove grpclogger from log package Signed-off-by: Michael Crosby --- log/grpc.go | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 log/grpc.go diff --git a/log/grpc.go b/log/grpc.go deleted file mode 100644 index cb2c92182..000000000 --- a/log/grpc.go +++ /dev/null @@ -1,12 +0,0 @@ -package log - -import ( - "io/ioutil" - "log" - - "google.golang.org/grpc/grpclog" -) - -func init() { - grpclog.SetLogger(log.New(ioutil.Discard, "", log.LstdFlags)) -} From 8ee29a17e6117e1907836e7e53c0dfeccb8a21fb Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Fri, 2 Feb 2018 10:51:59 -0500 Subject: [PATCH 3/3] Bump gc threshold to 40% Doing tests, this is a better balance for the threshold in reguards to memory and cpu usage. Signed-off-by: Michael Crosby --- cmd/containerd-shim/main_unix.go | 2 +- linux/proc/types.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/containerd-shim/main_unix.go b/cmd/containerd-shim/main_unix.go index 307d44899..f59a96270 100644 --- a/cmd/containerd-shim/main_unix.go +++ b/cmd/containerd-shim/main_unix.go @@ -60,7 +60,7 @@ func init() { } func main() { - debug.SetGCPercent(10) + debug.SetGCPercent(40) go func() { for range time.Tick(30 * time.Second) { debug.FreeOSMemory() diff --git a/linux/proc/types.go b/linux/proc/types.go index 42dae5abf..17c78fe9d 100644 --- a/linux/proc/types.go +++ b/linux/proc/types.go @@ -4,6 +4,7 @@ import ( google_protobuf "github.com/gogo/protobuf/types" ) +// Mount holds filesystem mount configuration type Mount struct { Type string Source string