-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GIT-2663: optimized image load with re-tag support #2786
GIT-2663: optimized image load with re-tag support #2786
Conversation
Welcome @harshanarayana! |
Hi @harshanarayana. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
e029852
to
29634dc
Compare
Thanks for the PR 😄
1.3.0 is older than I thought, we've had 1.3.0+ for a very long time, let's drop the check.
Trying to imagine a scenario where this makes sense 🤔
This is going to be common, we should handle this translation. We need to take care to remember that while containerd does this, in podman on the host side the default registry is actually configurable, so we should only perform this normalization when interacting with containerd. |
@BenTheElder Thanks for the quick review and feedbacks.
All righty. Let me take care of that.
Thinking about worst or the worst cases such as containerd getting restarted causing re-tag to fail or some other docker issue causing the command invocation on the container to fail. Just a precaution. Instead of returning an error, I am doing the next best thing of reloading again. Or do you think it is enough to return an error? Since we use the
Sure. Let me take care of it. So, all we need to do is when the ID to repoTag match is being done, in the image if the registry part is missing, we default to |
Refactored a bit of code that |
@BenTheElder PTAL when you can. Changes have been addressed |
/cc @BenTheElder |
Sorry, I've been out and mostly unavailable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one major nit, thanks for working on this
cc @aojea to help keep after reviews
3bc6249
to
a911f33
Compare
@BenTheElder @aojea PTAL at this PR when time permits. I've updated the changes as suggested by @BenTheElder |
71340aa
to
e93e714
Compare
e93e714
to
d0fe0ad
Compare
/test pull-kind-build |
@@ -37,6 +38,10 @@ import ( | |||
"sigs.k8s.io/kind/pkg/internal/runtime" | |||
) | |||
|
|||
var ( | |||
imageTagFetcher = nodeutils.ImageTags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of a global, we can pass the function, or split the function under test into two and pass the results of calling this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me refactor is to pass the function across and use that instead. Would make it cleaner.
3cdda28
to
3921058
Compare
❯ ./kind load docker-image --name test-cluster ubuntu:18.04
Image: "ubuntu:18.04" with ID "sha256:c6ad7e71ba7d4969784c76f57c4cc9083aa96bb969d802f2ea38f4aaed90ff93" not yet present on node "test-cluster-control-plane", loading...
❯ ./kind load docker-image --name test-cluster kind/test-ubuntu:1.2.3
Image with ID: sha256:c6ad7e71ba7d4969784c76f57c4cc9083aa96bb969d802f2ea38f4aaed90ff93 already present on the node test-cluster-control-plane but is missing the tag kind/test-ubuntu:1.2.3. re-tagging...
❯ ./kind load docker-image --name test-cluster different-repo-ubuntu
ERROR: image: "different-repo-ubuntu" not present locally
❯ ./kind load docker-image --name test-cluster different-repo-ubuntu:18.04
Image with ID: sha256:c6ad7e71ba7d4969784c76f57c4cc9083aa96bb969d802f2ea38f4aaed90ff93 already present on the node test-cluster-control-plane but is missing the tag different-repo-ubuntu:18.04. re-tagging...
root@test-cluster-control-plane:/# crictl images | grep ubun
docker.io/library/ubuntu 18.04 c6ad7e71ba7d4 65.5MB
root@test-cluster-control-plane:/# crictl images | grep ubun
docker.io/kind/test-ubuntu 1.2.3 c6ad7e71ba7d4 65.5MB
docker.io/library/ubuntu 18.04 c6ad7e71ba7d4 65.5MB
root@test-cluster-control-plane:/# crictl images | grep ubun
docker.io/kind/test-ubuntu 1.2.3 c6ad7e71ba7d4 65.5MB
docker.io/library/different-repo-ubuntu 18.04 c6ad7e71ba7d4 65.5MB
docker.io/library/ubuntu 18.04 c6ad7e71ba7d4 65.5MB
root@test-cluster-control-plane:/# |
Thank you for working on this, very sorry I've been so unavailable at the moment and not getting back to this reasonably. I will be on vacation for a few weeks and then my work situation will change a bit. antonio can hopefully pick up remaining review / bikeshed :-) |
3921058
to
1e12339
Compare
GIT-2663: sanitizeImage function to help generate fully qualified image names GIT-2663: sanitizeImage function to help generate fully qualified image names GIT-2663: add comments for sanitizeImage function and add UTs GIT-2663: add comments for sanitizeImage function and add UTs GIT-2663: add comments for sanitizeImage function and add UTs GIT-2663: add comments for sanitizeImage function and add UTs GIT-2663: add comments for sanitizeImage function and add UTs GIT-2663: add comments for sanitizeImage function and add UTs GIT-2663: cleanup image retag required check GIT-2663: cleanup image retag required check
1e12339
to
d1c2a79
Compare
/test pull-kind-e2e-kubernetes-1-20 |
/test pull-kind-e2e-kubernetes |
@aojea @BenTheElder PTAL when time permits. The suggested changes have been addressed. |
/test pull-kind-e2e-kubernetes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: BenTheElder, harshanarayana The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test pull-kind-e2e-kubernetes |
Currently, the way the
kind load docker-image
works is by detecting if there is an image with a matching image name and tab already exists in the cluster. However it is possible that the same image might be already present in the cluster with a different tag.With
ctr
1.3.0+ supportingctr image tag
feature, we can avoid loading the images by just re-tagging the image hash with the new name.Current changes fallback to using the default mode it currently has on following cases to retain compatibility.
ctr
in the kind image is not supportingctr images tag
commandCloses #2663
Missing Image
Image Exists with Different Tag and Name
No image re-tag or load required
Sanitizing Registry Images
❯ kind load docker-image --name upstream-k8s kind/test-ubuntu:1.2.3 Image with ID: sha256:c6ad7e71ba7d4969784c76f57c4cc9083aa96bb969d802f2ea38f4aaed90ff93 already present on the node upstream-k8s-control-plane but is missing the tag kind/test-ubuntu:1.2.3. re-tagging... root@upstream-k8s-control-plane:/# crictl images | grep ubun | grep kind docker.io/kind/test-ubuntu 1.2.3 c6ad7e71ba7d4 65.5MB