-
Notifications
You must be signed in to change notification settings - Fork 202
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
libimage: refine pull-policy enforcement for custom platforms #880
libimage: refine pull-policy enforcement for custom platforms #880
Conversation
@rhatdan PTAL. This is much simpler now. |
de06263
to
ee879f4
Compare
LGTM |
When pulling down an image with a user-specified custom platform, we try to make sure that user gets what they are asking for. An inherent issue with multi-arch images is that there are many images in the wild which do not get the platform right (see containers/podman/issues/10682). That means we need to pessimistically assume that the local image is wrong and pull the "correct" one down from the registry; in the worst case that is redundant work but we have a guarantee of correctness. Motivated by containers/podman/issues/12707 I had another look at the code and found some space for optimizations. Previously, we enforced the pull policy to "always" but that may be too aggressive since we may be running in an airgapped environment and the local image is correct. With this change, we enforce the pull policy to "newer" which makes errors non-fatal in case a local image has been found; this seems like a good middleground between making sure we are serving the "correct" image and user friendliness. Signed-off-by: Valentin Rothberg <[email protected]>
ee879f4
to
6b3823c
Compare
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: giuseppe, vrothberg 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 |
/hold |
} | ||
// NOTE that this is will even override --pull={false,never}. | ||
pullPolicy = config.PullPolicyNewer | ||
logrus.Debugf("Enforcing pull policy to %q to pull custom platform (arch: %q, os: %q, variant: %q) - local image may mistakenly specify wrong platform", pullPolicy, options.Architecture, options.OS, options.Variant) |
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.
Adding the image in message would aid when reading logs.
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.
In this specific log, we don't know if there's a local image or not. My intention was just to add some more context/explanation on why we're enforcing it.
/hold cancel |
When pulling down an image with a user-specified custom platform, we
try to make sure that user gets what they are asking for. An inherent
issue with multi-arch images is that there are many images in the wild
which do not get the platform right (see containers/podman/issues/10682).
That means we need to pessimistically assume that the local image is
wrong and pull the "correct" one down from the registry; in the worst case
that is redundant work but we have a guarantee of correctness.
Motivated by containers/podman/issues/12707 I had another look at the
code and found some space for optimizations. Previously, we enforced
the pull policy to "always" but that may be too aggressive since we may
be running in an airgapped environment and the local image is correct.
With this change, we enforce the pull policy to "newer" which makes
errors non-fatal in case a local image has been found; this seems like a
good middleground between making sure we are serving the "correct" image
and user friendliness.
Signed-off-by: Valentin Rothberg [email protected]