Merge pull request #4570 from ktock/vendor-cri

vendor: update containerd/cri 210a86ca5b
This commit is contained in:
Phil Estes 2020-09-17 09:28:56 -04:00 committed by GitHub
commit d6774b6392
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 18 deletions

View File

@ -58,7 +58,7 @@ gotest.tools/v3 v3.0.2
github.com/cilium/ebpf 1c8d4c9ef7759622653a1d319284a44652333b28 github.com/cilium/ebpf 1c8d4c9ef7759622653a1d319284a44652333b28
# cri dependencies # cri dependencies
github.com/containerd/cri 35e623e6bf7512e8c82b8ac6052cb1d720189f28 # master github.com/containerd/cri 210a86ca5bf6c8ca5f2553272d72c774b21fdec2 # master
github.com/davecgh/go-spew v1.1.1 github.com/davecgh/go-spew v1.1.1
github.com/docker/docker 4634ce647cf2ce2c6031129ccd109e557244986f github.com/docker/docker 4634ce647cf2ce2c6031129ccd109e557244986f
github.com/docker/spdystream 449fdfce4d962303d702fec724ef0ad181c92528 github.com/docker/spdystream 449fdfce4d962303d702fec724ef0ad181c92528

View File

@ -151,11 +151,10 @@ For async communication and long running discussions please use issues and pull
requests on this github repo. This will be the best place to discuss design and requests on this github repo. This will be the best place to discuss design and
implementation. implementation.
For sync communication we have a community slack with a #containerd channel that For sync communication catch us in the `#containerd` and `#containerd-dev` slack
everyone is welcome to join and chat about development. channels on Cloud Native Computing Foundation's (CNCF) slack -
`cloud-native.slack.com`. Everyone is welcome to join and chat.
**Slack:** Catch us in the #containerd and #containerd-dev channels on dockercommunity.slack.com. [Get Invite to CNCF slack.](https://slack.cncf.io)
[Click here for an invite to docker community slack.](https://dockr.ly/slack)
## Other Communications ## Other Communications
As this project is tightly coupled to CRI and CRI-Tools and they are Kubernetes As this project is tightly coupled to CRI and CRI-Tools and they are Kubernetes

View File

@ -31,6 +31,7 @@ import (
"github.com/containerd/containerd" "github.com/containerd/containerd"
"github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/errdefs"
containerdimages "github.com/containerd/containerd/images" containerdimages "github.com/containerd/containerd/images"
"github.com/containerd/containerd/labels"
"github.com/containerd/containerd/log" "github.com/containerd/containerd/log"
distribution "github.com/containerd/containerd/reference/docker" distribution "github.com/containerd/containerd/reference/docker"
"github.com/containerd/containerd/remotes/docker" "github.com/containerd/containerd/remotes/docker"
@ -460,7 +461,7 @@ const (
targetDigestLabel = "containerd.io/snapshot/cri.layer-digest" targetDigestLabel = "containerd.io/snapshot/cri.layer-digest"
// targetImageLayersLabel is a label which contains layer digests contained in // targetImageLayersLabel is a label which contains layer digests contained in
// the target image and will be passed to snapshotters for preparing layers in // the target image and will be passed to snapshotters for preparing layers in
// parallel. // parallel. Skipping some layers is allowed and only affects performance.
targetImageLayersLabel = "containerd.io/snapshot/cri.image-layers" targetImageLayersLabel = "containerd.io/snapshot/cri.image-layers"
) )
@ -478,15 +479,6 @@ func appendInfoHandlerWrapper(ref string) func(f containerdimages.Handler) conta
} }
switch desc.MediaType { switch desc.MediaType {
case imagespec.MediaTypeImageManifest, containerdimages.MediaTypeDockerSchema2Manifest: case imagespec.MediaTypeImageManifest, containerdimages.MediaTypeDockerSchema2Manifest:
var layers string
for _, c := range children {
if containerdimages.IsLayerType(c.MediaType) {
layers += fmt.Sprintf("%s,", c.Digest.String())
}
}
if len(layers) >= 1 {
layers = layers[:len(layers)-1]
}
for i := range children { for i := range children {
c := &children[i] c := &children[i]
if containerdimages.IsLayerType(c.MediaType) { if containerdimages.IsLayerType(c.MediaType) {
@ -495,7 +487,7 @@ func appendInfoHandlerWrapper(ref string) func(f containerdimages.Handler) conta
} }
c.Annotations[targetRefLabel] = ref c.Annotations[targetRefLabel] = ref
c.Annotations[targetDigestLabel] = c.Digest.String() c.Annotations[targetDigestLabel] = c.Digest.String()
c.Annotations[targetImageLayersLabel] = layers c.Annotations[targetImageLayersLabel] = getLayers(ctx, targetImageLayersLabel, children[i:], labels.Validate)
} }
} }
} }
@ -503,3 +495,25 @@ func appendInfoHandlerWrapper(ref string) func(f containerdimages.Handler) conta
}) })
} }
} }
// getLayers returns comma-separated digests based on the passed list of
// descriptors. The returned list contains as many digests as possible as well
// as meets the label validation.
func getLayers(ctx context.Context, key string, descs []imagespec.Descriptor, validate func(k, v string) error) (layers string) {
var item string
for _, l := range descs {
if containerdimages.IsLayerType(l.MediaType) {
item = l.Digest.String()
if layers != "" {
item = "," + item
}
// This avoids the label hits the size limitation.
if err := validate(key, layers+item); err != nil {
log.G(ctx).WithError(err).WithField("label", key).Debugf("%q is omitted in the layers list", l.Digest.String())
break
}
layers += item
}
}
return
}

View File

@ -2,7 +2,7 @@
github.com/docker/docker 4634ce647cf2ce2c6031129ccd109e557244986f github.com/docker/docker 4634ce647cf2ce2c6031129ccd109e557244986f
github.com/opencontainers/selinux v1.6.0 github.com/opencontainers/selinux v1.6.0
github.com/tchap/go-patricia v2.2.6 github.com/tchap/go-patricia v2.2.6
github.com/willf/bitset d5bec3311243426a3c6d1b7a795f24b17c686dbb # 1.1.10+ used by selinux pkg github.com/willf/bitset v1.1.11
# containerd dependencies # containerd dependencies
github.com/beorn7/perks v1.0.1 github.com/beorn7/perks v1.0.1