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
CFE-977: Implementation of a blob gatherer for images in the local cache #732
Conversation
@sherine-k: This pull request references CFE-977 which is a valid jira issue. In response to this:
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. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sherine-k 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 |
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.
@sherine-k - some minor changes, other than that great work, lets take the WIP off once you have updated and then we can merge
return blobs, err | ||
} | ||
|
||
// policyContext, err := o.opts.Global.GetPolicyContext() |
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.
Are we going to ignore signature verification ?
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.
I'm not sure it is important to verify signatures when collecting the blobs for images that we are mirroring.
That said, I think you bring up a good point for the signatures: do signatures need to be transported in the archives? I have no idea.
WDYT?
v2/pkg/image/image.go
Outdated
if strings.Contains(imgRef, "://") { | ||
imgSpec.ReferenceWithTransport = imgRef | ||
imgSplit := strings.Split(imgRef, "://") | ||
imgSpec.Transport = imgSplit[0] + "://" |
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.
Should we do a len check here - just to avoid ugly panics ?
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 fenced behind the strings.Contains
. Do you think we should add another if ?
} | ||
if strings.Contains(imgSpec.Name, "@") { | ||
imgSplit := strings.Split(imgSpec.Name, "@") | ||
if len(imgSplit) > 1 { |
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.
+1
hash = strings.Split(imgSplit[1], ":")[1] | ||
if imgSpec.Transport == "docker://" { | ||
imageNameComponents := strings.Split(imgSpec.Name, "/") | ||
if len(imageNameComponents) > 2 { |
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.
+1
dest = strings.Join([]string{o.Opts.Destination, pathWithoutDNS}, "/") | ||
src = img.Image | ||
transportAndPath := strings.Split(img.Image, "://") | ||
dest = dockerProtocol + strings.Join([]string{o.Opts.Destination, transportAndPath[1]}, "/") |
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.
Are we sure this is going to to have index 1 , ie should we check len
Hi @sherine-k, Everything is working fine. I compared the output of the main branch with the one from this PR and both are identical. My image set config was the one below:
After doing mirrorToDisk and diskToMirror I got the following output in my destination registry:
|
@sherine-k: all tests passed! Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
/label acknowledge-critical-fixes-only |
/lgtm |
[ART PR BUILD NOTIFIER] This PR has been included in build oc-mirror-plugin-container-v4.15.0-202311201709.p0.gd1fa811.assembly.stream for distgit oc-mirror-plugin. |
Description
This PR is part of a larger user story CFE-977 - Generate smaller archives
In this PR, we focus on identifying those blobs (both layers, config and manifests of various formats (docker-v2 or oci), both single arch and multi arch) that form a container image that is saved to oc-mirror's local cache.
The implementation relies on interacting directly with the local cache registry using
containers/image/v5
api.This PR replaces #730
For the moment, the use of BlobGatherer is not fully integrated with the MirrorToDisk workflow. Following PRs will be in charge of that.
Fixes # CFE-979
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Expected Outcome
Please describe the outcome expected from the tests