Update containerd dependencies for 1.2

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2018-07-25 14:56:41 -04:00
parent c09932fcb0
commit 5a0b040ab4
15 changed files with 729 additions and 16 deletions

View File

@@ -50,7 +50,8 @@ func NewConsoleSocket(path string) (*Socket, error) {
// NewTempConsoleSocket returns a temp console socket for use with a container
// On Close(), the socket is deleted
func NewTempConsoleSocket() (*Socket, error) {
dir, err := ioutil.TempDir("", "pty")
runtimeDir := os.Getenv("XDG_RUNTIME_DIR")
dir, err := ioutil.TempDir(runtimeDir, "pty")
if err != nil {
return nil, err
}
@@ -66,6 +67,11 @@ func NewTempConsoleSocket() (*Socket, error) {
if err != nil {
return nil, err
}
if runtimeDir != "" {
if err := os.Chmod(abs, 0755|os.ModeSticky); err != nil {
return nil, err
}
}
return &Socket{
l: l,
rmdir: true,

View File

@@ -66,6 +66,7 @@ type Runc struct {
Setpgid bool
Criu string
SystemdCgroup bool
Rootless *bool // nil stands for "auto"
}
// List returns all containers created inside the provided runc root directory
@@ -208,7 +209,7 @@ func (o *ExecOpts) args() (out []string, err error) {
// Exec executres and additional process inside the container based on a full
// OCI Process specification
func (r *Runc) Exec(context context.Context, id string, spec specs.Process, opts *ExecOpts) error {
f, err := ioutil.TempFile("", "runc-process")
f, err := ioutil.TempFile(os.Getenv("XDG_RUNTIME_DIR"), "runc-process")
if err != nil {
return err
}
@@ -411,7 +412,7 @@ func (r *Runc) Top(context context.Context, id string, psOptions string) (*TopRe
return nil, fmt.Errorf("%s: %s", err, data)
}
topResults, err := parsePSOutput(data)
topResults, err := ParsePSOutput(data)
if err != nil {
return nil, fmt.Errorf("%s: ", err)
}
@@ -655,6 +656,10 @@ func (r *Runc) args() (out []string) {
if r.SystemdCgroup {
out = append(out, "--systemd-cgroup")
}
if r.Rootless != nil {
// nil stands for "auto" (differs from explicit "false")
out = append(out, "--rootless="+strconv.FormatBool(*r.Rootless))
}
return out
}

View File

@@ -73,8 +73,8 @@ func fieldsASCII(s string) []string {
return strings.FieldsFunc(s, fn)
}
// parsePSOutput parses the runtime's ps raw output and returns a TopResults
func parsePSOutput(output []byte) (*TopResults, error) {
// ParsePSOutput parses the runtime's ps raw output and returns a TopResults
func ParsePSOutput(output []byte) (*TopResults, error) {
topResults := &TopResults{}
lines := strings.Split(string(output), "\n")