Containerd client integration

This commit:
1) Replaces the usage of containerd GRPC APIs with the containerd client for all operations related to containerd.
2) Updated containerd to v1.0alpha4+
3) Updated runc to v1.0.0

Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
This commit is contained in:
Abhinandan Prativadi
2017-08-04 09:55:36 -07:00
parent 2427d332f0
commit 32e0313418
170 changed files with 5819 additions and 7262 deletions

View File

@@ -19,6 +19,8 @@ package container
import (
"sync"
"github.com/containerd/containerd"
"github.com/kubernetes-incubator/cri-containerd/pkg/store"
)
@@ -29,20 +31,35 @@ type Container struct {
Metadata
// Status stores the status of the container.
Status StatusStorage
// TODO(random-liu): Add containerd container client.
// TODO(random-liu): Add stop channel to get rid of stop poll waiting.
// Containerd container
Container containerd.Container
}
// Opts sets specific information to newly created Container.
type Opts func(*Container)
// WithContainer adds the containerd Container to the internal data store.
func WithContainer(cntr containerd.Container) Opts {
return func(c *Container) {
c.Container = cntr
}
}
// NewContainer creates an internally used container type.
func NewContainer(metadata Metadata, status Status) (Container, error) {
func NewContainer(metadata Metadata, status Status, opts ...Opts) (Container, error) {
s, err := StoreStatus(metadata.ID, status)
if err != nil {
return Container{}, err
}
return Container{
c := Container{
Metadata: metadata,
Status: s,
}, nil
}
for _, o := range opts {
o(&c)
}
return c, nil
}
// Delete deletes checkpoint for the container.