Skip to content
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

Relocate the run image to the builder repo #1533

Merged
merged 1 commit into from
Mar 4, 2024
Merged

Conversation

tomkennedy513
Copy link
Collaborator

  • Also make sure the builder is tagged with the name and kind if a tag is not provided

@tomkennedy513 tomkennedy513 requested a review from a team as a code owner February 21, 2024 20:06
@tomkennedy513 tomkennedy513 changed the title Relocate the run image to the builder tag Relocate the run image to the builder repo Feb 21, 2024
@codecov-commenter
Copy link

Codecov Report

Attention: 15 lines in your changes are missing coverage. Please review.

Comparison is base (03acfbb) 67.19% compared to head (581ec0a) 67.14%.

Files Patch % Lines
pkg/cnb/create_builder.go 55.00% 9 Missing ⚠️
pkg/reconciler/builder/builder.go 78.57% 2 Missing and 1 partial ⚠️
pkg/reconciler/clusterbuilder/clusterbuilder.go 78.57% 2 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1533      +/-   ##
==========================================
- Coverage   67.19%   67.14%   -0.06%     
==========================================
  Files         140      140              
  Lines        8827     8868      +41     
==========================================
+ Hits         5931     5954      +23     
- Misses       2389     2404      +15     
- Partials      507      510       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

pkg/cnb/create_builder.go Outdated Show resolved Hide resolved
@@ -70,7 +71,6 @@ func (bb *builderBlder) AddStack(baseImage v1.Image, clusterStack *buildapi.Clus
bb.os = file.OS
bb.baseImage = baseImage
bb.stackId = clusterStack.Status.Id
bb.runImage = clusterStack.Status.RunImage.Image
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is clusterStack.Status.RunImage.Image fully qualified?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ya it's the resolved image

Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like it just the spec runImage which is not necessarily fully qualified.

RunImage: buildapi.ClusterStackStatusImage{
LatestImage: runIdentifier,
Image: clusterStackSpec.RunImage.Image,
},

Copy link
Collaborator

@matthewmcnew matthewmcnew Feb 21, 2024

Choose a reason for hiding this comment

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

I think that was intentional. The run image shouldn't necessarily be fully qualified. (E.g if you are using the builder with pack and the run image was updated it is useful to make use of that run image)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I suppose here, it needs to be relocated by kpack so, it is not necessarily useful.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Which I guess exposes the downside with this approach. It is only really useful if the source of the stack is not available otherwise, it provides a worse experience.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ya I guess the trade off is full build reproducibility though which a floating tag doesn't guarantee

if err != nil {
return buildapi.BuilderRecord{}, err
}
runImage, _, err := r.RegistryClient.Fetch(stackKeychain, clusterStack.Status.RunImage.LatestImage)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it be possible to only save the image if it is in a different registry than the builder?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was thinking you might still run into a case where the pull rules could be different for a different repo

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fair. There is a trade-off from having the run-image be relocated everywhere, though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I'm ok with just checking the registry and saying you need to be able to pull both. Maybe putting the original image in the run image mirror would also help as a backup

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thinking more about this, i'm seeing less of an issue with always relocating. In the event that the run image is in the same registry we will just cross repo blob mount. It will also tag the run image to prevent it from being being cleaned up. If the run image is in a different repo the value is much more apparent since you don't have to worry about run image access.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I was thinking the downside is more about more confusing provenance. It is useful to see that the run image is my-registry.com/my-stack/specific-stack-name/run vs my-registry.com/some-team/custom-builder/run.

but, I agree it is not a fatal flaw.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ya that is definitely a concern, but I was hoping the tags on the relocated run image would simplify this. It also makes registry management a bit easier so you can easily see the run image associated with a particular builder

- Also make sure the builder is tagged with the name and kind if a tag is not provided

Signed-off-by: Tom Kennedy <ktom@vmware.com>
@tomkennedy513 tomkennedy513 merged commit 3b5ec5f into main Mar 4, 2024
3 checks passed
@tomkennedy513 tomkennedy513 deleted the relocated-run-image branch March 4, 2024 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants