-
Notifications
You must be signed in to change notification settings - Fork 53
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
Enable caching imgpkg #178
Conversation
richgo provides a better UX while running tests in the command line Signed-off-by: Joao Pereira <[email protected]>
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 have left you a sort of incomplete code review but i think that's all i can give you at the moment. thanks for letting me take a look.
// Enabled implements dockerConfigProvider | ||
func (d *defaultDockerConfigProvider) Enabled() bool { | ||
- return true | ||
+ return false |
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 like forking an open source project but sneakier. is this a long-term plan?
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.
we tried to give provide a fix to the upstream repository but they told us that they wanted to keep the repository as a copy-paste from Kubernetes authentication libraries.
This is a temporary solution until we fix the issue carvel-dev/imgpkg#397
pkg/vendir/fetch/cache/cache.go
Outdated
|
||
// Hit checks if a particular entry in the cache is present | ||
// Returns the path to the entry and a flag information if the entry was found or not | ||
func (c FolderCache) Hit(id string) (string, bool) { |
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.
nit: but to my mind "Hit" sounds more like a command than a query. of course "Present" has the same issues and is a longer word. idk, for 3 letter words, ... "Has" ?
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 was trying to use the caching more common terms like hit/miss to provide describe the behavior, but I think this can be an easy change
@@ -0,0 +1,302 @@ | |||
// Copyright 2022 VMware, Inc. |
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.
what does it mean to stick our copyright above something that has a different copyright?
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.
we do add our copyright to all the files with cod in the project and we have been told that this is what we should be doing
@@ -135,3 +238,29 @@ func (t *Imgpkg) addDangerousArgs(args []string) []string { | |||
} | |||
return args | |||
} | |||
|
|||
// Logger provided to the imgpkg API calls | |||
type Logger struct { |
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.
ok i'll admit, i'm confused why, in a PR about caching, there's a logger that looks like it has levels but actually they're hardcoded and you'll never know which level something was logged at, especially if it was a debug log bc those don't even log at all?
My guess is you needed an interface to pass to something else, but maybe some more elaborate hint in the comments would be helpful
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 guess in general -- i like log messages. like being able to get debug output. i have some dreams w.r.t . being able to trigger all the tools in kapp-controller into debug at the same time, for the sake of figuring out what's going on.
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.
The logger created in this particular instance is a bit peculiar because it needs to conform to the requirements from the imgpkg API.
Because of that, it is only present in the image
package. In the future when we are using our tools and can provide directives to activate different logging levels we should definitely revisit all these instances to ensure that we are doing the correct thing.
In the meanwhile, I will update the logger struct comment to inform the user that not all the logs will be present
Starts using imgpkg as a library do pull images and bundles Signed-off-by: Joao Pereira <[email protected]>
Due to the inclusion of imgpkg as a library we need to ensure that the change made in carvel-dev/imgpkg#255 stays in effect. This will behavior can be removed when we complete the issue carvel-dev/imgpkg#397 Signed-off-by: Joao Pereira <[email protected]>
89c3df8
to
3714f5b
Compare
i just realized that by merging this, it would make vendir block in environments where ambient creds endpoints are present but blocked (same problem that imgpkg has). this is especially nasty if user is not even using imgpkg fetcher (previously this was not a problem because imgpkg's dependencies are not executed when vendir itself starts). id like us to see ambient cred blocking problem fixed before we release vendir to avoid this backwards compat breaking behaviour. |
@cppforlife what do you mean by ambient credentials blocking problem? |
Signed-off-by: Joao Pereira <[email protected]>
Signed-off-by: Joao Pereira <[email protected]>
Signed-off-by: Joao Pereira <[email protected]>
3714f5b
to
1c049fb
Compare
Are you talking about selectively choose the auth keychains? |
yup, im getting a little lost with one of the PRs closed and the other merged. looks like it the feature that we needed got merged. it seems that those changes were introduced in imgpkg v0.32.0. im ok merging this PR as is assuming we make another PR with bump to imgpkg v0.32.0 before we cut a next vendir release. (or feel free to revise this PR to do the bump). |
Signed-off-by: Joao Pereira <[email protected]>
With imgpkg 0.32.0 there is not need for this hack script anymore This reverts commit 0b6d143.
Signed-off-by: Joao Pereira <[email protected]>
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.
left one comment before merge
pkg/vendir/fetch/cache/cache.go
Outdated
} | ||
|
||
func (c FolderCache) idToFolder(artifactType string, id string) string { | ||
normalizedID := strings.ReplaceAll(id, ":", "-") |
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 turn id into a base64 or sha to avoid having to "try to sanitize" it?
Signed-off-by: Joao Pereira <[email protected]>
This PR includes the following changes:
VENDIR_CACHE_DIR
andVENDIR_MAX_CACHE_SIZE
respectively.Fixes #160