Merge pull request #441 from Random-Liu/update-containerd

Update containerd and add synchronous image deletion.
This commit is contained in:
Lantao Liu 2017-11-28 15:26:30 -08:00 committed by GitHub
commit d4ee7aacc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,5 @@
RUNC_VERSION=74a17296470088de3805e138d3d87c62e613dfc4 RUNC_VERSION=74a17296470088de3805e138d3d87c62e613dfc4
CNI_VERSION=v0.6.0 CNI_VERSION=v0.6.0
CONTAINERD_VERSION=9e04cff8e9e3a1bf13c088cb3db1c368e93b33ea CONTAINERD_VERSION=118c0a279eaf600f6021178427df14345aef4177
CRITOOL_VERSION=4cd2b047a26a2ef01bbd02ee55f7d70d8825ebb5 CRITOOL_VERSION=4cd2b047a26a2ef01bbd02ee55f7d70d8825ebb5
KUBERNETES_VERSION=164317879bcd810b97e5ebf1c8df041770f2ff1b KUBERNETES_VERSION=164317879bcd810b97e5ebf1c8df041770f2ff1b

View File

@ -20,6 +20,7 @@ import (
"fmt" "fmt"
"github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/images"
"github.com/golang/glog" "github.com/golang/glog"
"golang.org/x/net/context" "golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime" "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
@ -63,15 +64,18 @@ func (c *criContainerdService) RemoveImage(ctx context.Context, r *runtime.Remov
} }
// Include all image references, including RepoTag, RepoDigest and id. // Include all image references, including RepoTag, RepoDigest and id.
for _, ref := range append(append(image.RepoTags, image.RepoDigests...), image.ID) { for _, ref := range append(image.RepoTags, image.RepoDigests...) {
// TODO(random-liu): Containerd should schedule a garbage collection immediately,
// and we may want to wait for the garbage collection to be over here.
err = c.imageStoreService.Delete(ctx, ref) err = c.imageStoreService.Delete(ctx, ref)
if err == nil || errdefs.IsNotFound(err) { if err == nil || errdefs.IsNotFound(err) {
continue continue
} }
return nil, fmt.Errorf("failed to delete image reference %q for image %q: %v", ref, image.ID, err) return nil, fmt.Errorf("failed to delete image reference %q for image %q: %v", ref, image.ID, err)
} }
// Delete image id synchronously to trigger garbage collection.
err = c.imageStoreService.Delete(ctx, image.ID, images.SynchronousDelete())
if err != nil && !errdefs.IsNotFound(err) {
return nil, fmt.Errorf("failed to delete image id %q: %v", image.ID, err)
}
c.imageStore.Delete(image.ID) c.imageStore.Delete(image.ID)
return &runtime.RemoveImageResponse{}, nil return &runtime.RemoveImageResponse{}, nil
} }

View File

@ -2,7 +2,7 @@ github.com/blang/semver v3.1.0
github.com/boltdb/bolt e9cf4fae01b5a8ff89d0ec6b32f0d9c9f79aefdd github.com/boltdb/bolt e9cf4fae01b5a8ff89d0ec6b32f0d9c9f79aefdd
github.com/BurntSushi/toml a368813c5e648fee92e5f6c30e3944ff9d5e8895 github.com/BurntSushi/toml a368813c5e648fee92e5f6c30e3944ff9d5e8895
github.com/containerd/cgroups f7dd103d3e4e696aa67152f6b4ddd1779a3455a9 github.com/containerd/cgroups f7dd103d3e4e696aa67152f6b4ddd1779a3455a9
github.com/containerd/containerd 9e04cff8e9e3a1bf13c088cb3db1c368e93b33ea github.com/containerd/containerd 118c0a279eaf600f6021178427df14345aef4177
github.com/containerd/continuity cf279e6ac893682272b4479d4c67fd3abf878b4e github.com/containerd/continuity cf279e6ac893682272b4479d4c67fd3abf878b4e
github.com/containerd/fifo fbfb6a11ec671efbe94ad1c12c2e98773f19e1e6 github.com/containerd/fifo fbfb6a11ec671efbe94ad1c12c2e98773f19e1e6
github.com/containerd/typeurl f6943554a7e7e88b3c14aad190bf05932da84788 github.com/containerd/typeurl f6943554a7e7e88b3c14aad190bf05932da84788

View File

@ -41,3 +41,4 @@ github.com/boltdb/bolt e9cf4fae01b5a8ff89d0ec6b32f0d9c9f79aefdd
google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944 google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944
golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4 golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4
github.com/dmcgowan/go-tar 2e2c51242e8993c50445dab7c03c8e7febddd0cf github.com/dmcgowan/go-tar 2e2c51242e8993c50445dab7c03c8e7febddd0cf
github.com/stevvooe/ttrpc bdb2ab7a8169e485e39421e666e15a505e575fd2