Merge pull request #467 from Random-Liu/update-containerd
Update containerd
This commit is contained in:
commit
05bf76e05f
@ -72,12 +72,17 @@ GOPATH=${GOPATH%%:*}
|
||||
# checkout_repo checks out specified repository
|
||||
# and switch to specified version.
|
||||
# Varset:
|
||||
# 1) Repo name;
|
||||
# 1) Pkg name;
|
||||
# 2) Version.
|
||||
# 3) Repo name (optional);
|
||||
checkout_repo() {
|
||||
repo=$1
|
||||
pkg=$1
|
||||
version=$2
|
||||
path="${GOPATH}/src/${repo}"
|
||||
repo=${3:-""}
|
||||
if [ -z "${repo}" ]; then
|
||||
repo=${pkg}
|
||||
fi
|
||||
path="${GOPATH}/src/${pkg}"
|
||||
if [ ! -d ${path} ]; then
|
||||
mkdir -p ${path}
|
||||
git clone https://${repo} ${path}
|
||||
@ -130,7 +135,7 @@ EOF'
|
||||
fi
|
||||
|
||||
# Install containerd
|
||||
checkout_repo ${CONTAINERD_PKG} ${CONTAINERD_VERSION}
|
||||
checkout_repo ${CONTAINERD_PKG} ${CONTAINERD_VERSION} ${CONTAINERD_REPO}
|
||||
cd ${GOPATH}/src/${CONTAINERD_PKG}
|
||||
make
|
||||
${sudo} make install -e DESTDIR=${CONTAINERD_DIR}
|
||||
|
@ -1,5 +1,6 @@
|
||||
RUNC_VERSION=74a17296470088de3805e138d3d87c62e613dfc4
|
||||
CNI_VERSION=v0.6.0
|
||||
CONTAINERD_VERSION=53c892d796a565127899d397e43bd52edf3148b0
|
||||
CONTAINERD_VERSION=cc969fb42f427a68a8cc6870ef47f17304b83962
|
||||
CONTAINERD_REPO=
|
||||
CRITOOL_VERSION=4cd2b047a26a2ef01bbd02ee55f7d70d8825ebb5
|
||||
KUBERNETES_VERSION=164317879bcd810b97e5ebf1c8df041770f2ff1b
|
||||
|
@ -1,8 +1,7 @@
|
||||
github.com/blang/semver v3.1.0
|
||||
github.com/boltdb/bolt e9cf4fae01b5a8ff89d0ec6b32f0d9c9f79aefdd
|
||||
github.com/BurntSushi/toml a368813c5e648fee92e5f6c30e3944ff9d5e8895
|
||||
github.com/containerd/cgroups 29da22c6171a4316169f9205ab6c49f59b5b852f
|
||||
github.com/containerd/containerd 53c892d796a565127899d397e43bd52edf3148b0
|
||||
github.com/containerd/containerd cc969fb42f427a68a8cc6870ef47f17304b83962
|
||||
github.com/containerd/continuity cf279e6ac893682272b4479d4c67fd3abf878b4e
|
||||
github.com/containerd/fifo fbfb6a11ec671efbe94ad1c12c2e98773f19e1e6
|
||||
github.com/containerd/typeurl f6943554a7e7e88b3c14aad190bf05932da84788
|
||||
|
10
vendor/github.com/containerd/containerd/container_opts_unix.go
generated
vendored
10
vendor/github.com/containerd/containerd/container_opts_unix.go
generated
vendored
@ -24,7 +24,6 @@ import (
|
||||
"github.com/opencontainers/image-spec/identity"
|
||||
"github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// WithCheckpoint allows a container to be created from the checkpointed information
|
||||
@ -193,14 +192,17 @@ func remapRootFS(mounts []mount.Mount, uid, gid uint32) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer os.RemoveAll(root)
|
||||
defer os.Remove(root)
|
||||
for _, m := range mounts {
|
||||
if err := m.Mount(root); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
defer unix.Unmount(root, 0)
|
||||
return filepath.Walk(root, incrementFS(root, uid, gid))
|
||||
err = filepath.Walk(root, incrementFS(root, uid, gid))
|
||||
if uerr := mount.Unmount(root, 0); err == nil {
|
||||
err = uerr
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func incrementFS(root string, uidInc, gidInc uint32) filepath.WalkFunc {
|
||||
|
27
vendor/github.com/containerd/containerd/mount/mount_linux.go
generated
vendored
27
vendor/github.com/containerd/containerd/mount/mount_linux.go
generated
vendored
@ -2,7 +2,9 @@ package mount
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
@ -42,8 +44,27 @@ func (m *Mount) Mount(target string) error {
|
||||
}
|
||||
|
||||
// Unmount the provided mount path with the flags
|
||||
func Unmount(mount string, flags int) error {
|
||||
return unix.Unmount(mount, flags)
|
||||
func Unmount(target string, flags int) error {
|
||||
if err := unmount(target, flags); err != nil && err != unix.EINVAL {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func unmount(target string, flags int) error {
|
||||
for i := 0; i < 50; i++ {
|
||||
if err := unix.Unmount(target, flags); err != nil {
|
||||
switch err {
|
||||
case unix.EBUSY:
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
continue
|
||||
default:
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return errors.Wrapf(unix.EBUSY, "failed to unmount target %s", target)
|
||||
}
|
||||
|
||||
// UnmountAll repeatedly unmounts the given mount point until there
|
||||
@ -51,7 +72,7 @@ func Unmount(mount string, flags int) error {
|
||||
// useful for undoing a stack of mounts on the same mount point.
|
||||
func UnmountAll(mount string, flags int) error {
|
||||
for {
|
||||
if err := Unmount(mount, flags); err != nil {
|
||||
if err := unmount(mount, flags); err != nil {
|
||||
// EINVAL is returned if the target is not a
|
||||
// mount point, indicating that we are
|
||||
// done. It can also indicate a few other
|
||||
|
27
vendor/github.com/containerd/containerd/oci/spec_opts_unix.go
generated
vendored
27
vendor/github.com/containerd/containerd/oci/spec_opts_unix.go
generated
vendored
@ -12,12 +12,11 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/containerd/containerd/containers"
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/fs"
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/containerd/containerd/mount"
|
||||
"github.com/containerd/containerd/namespaces"
|
||||
"github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/opencontainers/runc/libcontainer/user"
|
||||
@ -260,7 +259,7 @@ func WithUIDGID(uid, gid uint32) SpecOpts {
|
||||
// or uid is not found in /etc/passwd, it sets gid to be the same with
|
||||
// uid, and not returns error.
|
||||
func WithUserID(uid uint32) SpecOpts {
|
||||
return func(ctx context.Context, client Client, c *containers.Container, s *specs.Spec) error {
|
||||
return func(ctx context.Context, client Client, c *containers.Container, s *specs.Spec) (err error) {
|
||||
if c.Snapshotter == "" {
|
||||
return errors.Errorf("no snapshotter set for container")
|
||||
}
|
||||
@ -276,13 +275,19 @@ func WithUserID(uid uint32) SpecOpts {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer os.RemoveAll(root)
|
||||
defer os.Remove(root)
|
||||
for _, m := range mounts {
|
||||
if err := m.Mount(root); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
defer unix.Unmount(root, 0)
|
||||
defer func() {
|
||||
if uerr := mount.Unmount(root, 0); uerr != nil {
|
||||
if err == nil {
|
||||
err = uerr
|
||||
}
|
||||
}
|
||||
}()
|
||||
ppath, err := fs.RootPath(root, "/etc/passwd")
|
||||
if err != nil {
|
||||
return err
|
||||
@ -317,7 +322,7 @@ func WithUserID(uid uint32) SpecOpts {
|
||||
// does not exist, or the username is not found in /etc/passwd,
|
||||
// it returns error.
|
||||
func WithUsername(username string) SpecOpts {
|
||||
return func(ctx context.Context, client Client, c *containers.Container, s *specs.Spec) error {
|
||||
return func(ctx context.Context, client Client, c *containers.Container, s *specs.Spec) (err error) {
|
||||
if c.Snapshotter == "" {
|
||||
return errors.Errorf("no snapshotter set for container")
|
||||
}
|
||||
@ -333,13 +338,19 @@ func WithUsername(username string) SpecOpts {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer os.RemoveAll(root)
|
||||
defer os.Remove(root)
|
||||
for _, m := range mounts {
|
||||
if err := m.Mount(root); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
defer unix.Unmount(root, 0)
|
||||
defer func() {
|
||||
if uerr := mount.Unmount(root, 0); uerr != nil {
|
||||
if err == nil {
|
||||
err = uerr
|
||||
}
|
||||
}
|
||||
}()
|
||||
ppath, err := fs.RootPath(root, "/etc/passwd")
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user