-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
ResolveImageConfig: Only fetch best matching config #4311
Conversation
ff5f785
to
6636bda
Compare
Some linting failures on receiver name. Also a small typo in the commit message (ReolveImageConfig -> ResolveImageConfig |
6636bda
to
230339f
Compare
tentatively adding cherry pick label, but input welcome |
@cpuguy83 compile error;
|
230339f
to
ebeda12
Compare
ebeda12
to
24a76c2
Compare
util/imageutil/config.go
Outdated
} else { | ||
descs = append(descs, index.Manifests...) | ||
} | ||
descs = append(descs, index.Manifests...) |
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.
platform.Match
condition should still be here. LimitManifests
does not call Match
and if we skip this it could lead to wrong resolution (eg. for nested indexes).
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.
@cpuguy83 @tonistiigi I've pushed an update to add this block back in to keep the original condition.
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.
Sorry I totally missed this comment.
24a76c2
to
e17d488
Compare
Before this change, all platforms that loosely match the provided platform will be fetched even though we only care about 1 of them. As an example when linux/amd64 is requested it will also fetch linux/386 because it is a compatible architecture. This means extra round trips to the registry, potentially even for content that doesn't exist in the remote. This is especially a problem when resolve mode is prefer-local because we'll have the index locally but most likely only one manifest. In this case we'll end up reaching out to the registry to fetch the other manifests unncessarily. With this change instead of fetching all matching platforms it chooses only the best matching platform. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
e17d488
to
575cb10
Compare
Before this change, all platforms that loosely match the provided platform will be fetched even though we only care about 1 of them. As an example when linux/amd64 is requested it will also fetch linux/386 because it is a compatible architecture.
This means extra round trips to the registry, potentially even for content that doesn't exist in the remote.
This is especially a problem when resolve mode is prefer-local because we'll have the index locally but most likely only one manifest. In this case we'll end up reaching out to the registry to fetch the other manifests unncessarily.
With this change instead of fetching all matching platforms it chooses only the best matching platform.
Related: moby/moby#46584