-
Notifications
You must be signed in to change notification settings - Fork 618
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
Fix duplicate image entries in k8s.io namespaces #3744
base: main
Are you sure you want to change the base?
Conversation
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.
This should be opt-in via a config entry like --kube-hide-dupe
:
https://github.com/containerd/nerdctl/blob/main/docs/config.md
Okay, I'll try to implement it. Initially, I wanted to implement it separately, but this is a preliminary version for the sake of testing and discussion. |
bf3dfaa
to
9851575
Compare
d5c7e2f
to
086f530
Compare
7adb2e8
to
ef8e002
Compare
3c93355
to
57b1f61
Compare
63d6499
to
8da215c
Compare
@@ -351,3 +351,110 @@ func TestIssue3016(t *testing.T) { | |||
|
|||
testCase.Run(t) | |||
} | |||
|
|||
func TestRemoveKubeWithKubeHideDupe(t *testing.T) { |
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.
@apostasie Could you take a look?
Is this correct?
The test doesn't seem to involve with Kube
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.
Looking.
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.
This is correct.
Repro locally:
# This creates the kind / kube cluster and configure what needs be
./hack/build-integration-kubernetes.sh
# Jump into the control plane to gain access to the created cluster
nerdctl exec -ti nerdctl-test-control-plane bash
This ^ is exactly what the CI is doing
Now that you are in the control plane, use nerdctl against the kind cluster:
nerdctl --namespace k8s.io images
nerdctl --namespace k8s.io pull busybox
nerdctl --namespace k8s.io images
^ now, 2919d0172f75
(in my case, on arm) appears as busybox and none/none
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.
This is correct.
What I mean is: the test is actually doing what it says, and does interact with Kube, as nerdctl is interacting with the kind cluster and the k8s.io namespace
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.
Thanks a lot @fengwei0328
I left a few comments.
if err != nil { | ||
continue | ||
} | ||
if _, ok := parsed.(reference.Tagged); ok { |
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.
#3744 (comment) @apostasie
Here, I need to obtain the interface corresponding to the image name, and then use interface.type to distinguish whether it's a standard tag( reference.Tagged) or a non-standard tag().
I simply expected standard implementation, but referenceutil.Parse works too.
dbd059c
to
7173cb6
Compare
The same imageId underk8s.io is showing multiple results: repo:tag, repo:digest, configID. We expect to display only repo:tag, consistent with other namespaces and CRI. e.g. nerdctl -n k8s.io images REPOSITORY TAG IMAGE ID CREATED PLATFORM SIZE BLOB SIZE centos 7 be65f488b776 3 hours ago linux/amd64 211.5 MiB 72.6 MiB centos <none> be65f488b776 3 hours ago linux/amd64 211.5 MiB 72.6 MiB <none> <none> be65f488b776 3 hours ago linux/amd64 211.5 MiB 72.6 MiB expect: nerdctl --kube-hide-dupe -n k8s.io images REPOSITORY TAG IMAGE ID CREATED PLATFORM SIZE BLOB SIZE centos 7 be65f488b776 3 hours ago linux/amd64 211.5 MiB 72.6 MiB Of course, even after deduplicating the images displayed, there are still issues with deleting the images. It is necessary to distinguish between repo:tag and configId, as well as repoDigest. Considering the situation with tags, we need to ensure that all repo:tags under the same imageId are cleaned up before proceeding to clean up the configId and repoDigest. see: containerd#3702 Signed-off-by: fengwei0328 <[email protected]>
fix3702