Namespace tasks via runc --root

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-06-06 16:09:22 -07:00
parent 6428b4bad0
commit 497db9ac06
6 changed files with 94 additions and 40 deletions

View File

@@ -4,6 +4,7 @@ package shim
import (
"path/filepath"
"syscall"
shimapi "github.com/containerd/containerd/api/services/shim"
"github.com/containerd/containerd/api/types/task"
@@ -15,23 +16,28 @@ import (
"google.golang.org/grpc/metadata"
)
func Client(path string) (shimapi.ShimClient, error) {
func Client(path, namespace string) (shimapi.ShimClient, error) {
pid, err := runc.ReadPidFile(filepath.Join(path, "init.pid"))
if err != nil {
return nil, err
}
cl := &client{
s: New(path),
s, err := New(path, namespace)
if err != nil {
return nil, err
}
// used when quering container status and info
cl := &client{
s: s,
}
// used when quering container status and info
cl.s.initProcess = &initProcess{
id: filepath.Base(path),
pid: pid,
runc: &runc.Runc{
Log: filepath.Join(path, "log.json"),
LogFormat: runc.JSON,
Log: filepath.Join(path, "log.json"),
LogFormat: runc.JSON,
PdeathSignal: syscall.SIGKILL,
Root: filepath.Join(RuncRoot, namespace),
},
}
return cl, nil