Put containerd-shim into pod cgroup

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
This commit is contained in:
Yanqiang Miao
2017-10-09 16:11:13 +08:00
parent a7c48f2f3f
commit e9cf1d5909
3 changed files with 35 additions and 2 deletions

22
pkg/opts/task.go Normal file
View File

@@ -0,0 +1,22 @@
package opts
import (
"context"
"github.com/containerd/containerd"
"github.com/containerd/containerd/linux/runcopts"
)
// WithContainerdShimCgroup returns function that sets the containerd
// shim cgroup path
func WithContainerdShimCgroup(path string) containerd.NewTaskOpts {
return func(_ context.Context, _ *containerd.Client, r *containerd.TaskInfo) error {
r.Options = &runcopts.CreateOptions{
ShimCgroup: path,
}
return nil
}
}
//TODO: Since Options is an interface different WithXXX will be needed to set different
// combinations of CreateOptions.