Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Conversation

@Random-Liu
Copy link
Member

Register both repo tag and repo digest when pulling image.

Currently, Kubelet assumes that once image is pulled with repo tag, the repo digest also needs to be stored as existing reference.

Signed-off-by: Lantao Liu [email protected]

if r == "" {
continue
}
if err = c.imageStoreService.Put(ctx, r, desc); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: err := for the scope.

Copy link
Member Author

@Random-Liu Random-Liu Jun 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do. vetshadow check is problematic, which reports warning when we re-declare err here.

Will disable that check.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

ref, desc, err)
repoDigest, repoTag := getRepoDigestAndTag(namedRef, desc.Digest)
if ref != repoTag && ref != repoDigest {
return "", "", "", fmt.Errorf("unexpected repo tag %q and repo digest %q for %q", repoTag, repoDigest, ref)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the sanity check necessary? You pass namedRef to the function, and ref is just namedRef.String()...
If you must have this check, I think it should be in the getRepoDigestAndTag function.

Copy link
Member Author

@Random-Liu Random-Liu Jun 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because in code below, we use ref to get image metadata from the containerd image store, which is making the assumption that ref is either repoTag or repoDigest.

Initially, I thought I should add a comment here, but then I remember once I read in the toilet that sanity check is better than comment. So...

Copy link
Member Author

@Random-Liu Random-Liu Jun 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yujuhong I added the sanity check back, because it did help me catch a bug for schema 1 image.

Please take a look at the latest commit.

@yujuhong
Copy link
Member

lgtm

@Random-Liu
Copy link
Member Author

Random-Liu commented Jun 21, 2017

Will apply label and merge after squash. @yujuhong Thanks for reviewing!

Copy link
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mikebrow mikebrow added the lgtm label Jun 21, 2017
@Random-Liu Random-Liu merged commit 4b53d84 into containerd:master Jun 21, 2017
@Random-Liu Random-Liu deleted the fix-image-pull branch June 21, 2017 20:43
lanchongyizu pushed a commit to lanchongyizu/cri-containerd that referenced this pull request Sep 3, 2017
Register all possible repo tags and repo digests.
kevpar added a commit to kevpar/cri that referenced this pull request Nov 2, 2020
Update containerd vendoring to 1.4 release
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants