-
Notifications
You must be signed in to change notification settings - Fork 2.8k
push/manifest-push: add support for --force-compression
to prevent reusing other blobs
#19640
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
push/manifest-push: add support for --force-compression
to prevent reusing other blobs
#19640
Conversation
@containers/podman-maintainers PTAL |
Validate fails because of my |
@@ -42,6 +42,10 @@ the list or index itself. (Default true) | |||
|
|||
@@option digestfile | |||
|
|||
#### **--force-compression** | |||
|
|||
Use the specified compression algorithm even if the destination contains a differently-compressed variant already. |
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 think we need to make this less abstract. Why do I need that instead of --compression
? What's the use case?
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.
Same applies to other locations where the functionality is described.
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.
Sure, lets decide a text then I will amend it. How about if i add a text like this ?
Use the --force-compression option to force re-compressing layers imported from a previous image, if the requested compression algorithm is different from the previous compression algorithm
Text from: https://docs.docker.com/build/exporters/#compression
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.
But shouldn't --compression just imply the force part? If I say --compression zstd
it should do that and not reuse gzip blobs IMO. I cannot think of anyone actually wanting the current behaviour, to me this is a bug and does not need yet another compression option!
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.
@Luap99 This is one of the behavior which is already there in docker
and afaik c/image
follows it. --add-compression
does it internally but I think changing behavior of --compression
is breaking. I think following behavior can be changed but I am not aware of all the use-case which could break because of changing behaviour of --compression
, @mtrmac can provide better explanation about this question.
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.
@Luap99 @vrothberg WDYT about: #19640
I don't understand the question. Can you clarify where you're pointing at?
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.
@vrothberg I am trying to find a good text for man-page in order to resolve your request here: #19640
So before I amend the doc, my intention was to finalize the text here:
Use the --force-compression option to force re-compressing layers imported from a previous image which was pushed using a default compression format or via --compression, if the requested compression algorithm is different from the previous compression algorithm
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.
@flouthoc can you do a PS in today's meeting on the issue of --compression-format
maybe including --force-compression
?
@rhatdan @giuseppe PTAL
I think we can change that later on as well and don't need to block the PR on it.
So before I amend the doc, my intention was to finalize the text here:
@flouthoc, I think we need to use very simple words. In the end it breaks down to the fact that --compression
may not compress if a matching layer exists on the registry. --force...
will force compression.`
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 can argue about backward compatibility, but ignoring the value passed to --compression-format
seems like a bug to me and not intuitive. If a user expects the layer to be compressed and ignores the compression format, it is already possible to use --compress
. I don't see the value in having three different knobs just to customize the compression format to use.
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.
@giuseppe Yes two issues I see are backward compatibility and docker compat, other than these two there are no strong reasons which prevents us to automatically include --force-compression
on every --compression-format
.
6da759a
to
07a3ac0
Compare
07a3ac0
to
bf87748
Compare
I will rebase after this no-rush. |
7c462e4
to
b674370
Compare
bd4dc1b
to
b8f4e5b
Compare
@@ -42,6 +42,12 @@ the list or index itself. (Default true) | |||
|
|||
@@option digestfile | |||
|
|||
#### **--force-compression** |
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.
Note please do not duplicate the same text in two man pages, put it in markdown/options and use the @@option
import syntax like the other flags for push and manifest push.
I still think we are over thinking and making the UI way to complex. My head explodes when I think of how a user will build one of these and the confusion between --compression and --force-compression. I think we should dedicate a meeting to discuss what is the UI for a user creating these optimized images, and discuss why we are making this so complex. |
@rhatdan We already discussed in above threads and decided to merge |
b8f4e5b
to
231dec4
Compare
Adds support for --force-compression which allows end-users to force push blobs with the selected compresison in --compression option, in order to make sure that blobs of other compression on registry are not reused. Is equivalent to: force-compression here: https://docs.docker.com/build/exporters/#compression Closes: containers#18660 Signed-off-by: Aditya R <arajan@redhat.com>
Adds support for --force-compression which allows end-users to force push blobs with the selected compresison in --compression option, in order to make sure that blobs of other compression on registry are not reused. Signed-off-by: Aditya R <arajan@redhat.com>
231dec4
to
387e99e
Compare
@containers/podman-maintainers @mtrmac PTAL now Practically now this flag is never gonna be used manually by users unless they want to fallback to old behavior for compat reason. |
pkg/api/server/register_images.go
Outdated
@@ -726,6 +726,11 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error { | |||
// type: string | |||
// description: Allows for pushing the image to a different destination than the image refers to. | |||
// - in: query | |||
// name: forceCompressionFormat | |||
// description: Use the specified compression algorithm if the destination contains a differently-compressed variant already. |
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 still have issues reading this sentence. I can be interpreted that we'll only compress "if the destination contains a differently-compressed variant already". So we won't compress if there's no variant at all on the registry?
I suggest "Enforce compressing the layers with the specified --compression and do not reuse differently compressed blobs on the registry." I find that easier to read/understand.
If set uses the specified compression algorithm even if the destination contains a differently-compressed variant already, use this in order | ||
to make sure that podman does not reuses the blobs of differently-compressed variant present on the remote registry. | ||
|
||
Note: This is by default set to `true` if `push` is being performed with `--compression-format` in order to make sure that | ||
podman does not reuses the blobs of differently-compressed variant present on remote registry, manually set this to `false` | ||
in order to opt-out of this behaviour. |
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.
If set uses the specified compression algorithm even if the destination contains a differently-compressed variant already, use this in order | |
to make sure that podman does not reuses the blobs of differently-compressed variant present on the remote registry. | |
Note: This is by default set to `true` if `push` is being performed with `--compression-format` in order to make sure that | |
podman does not reuses the blobs of differently-compressed variant present on remote registry, manually set this to `false` | |
in order to opt-out of this behaviour. | |
If set uses the specified compression algorithm even if the destination contains a differently-compressed variant already. | |
Use this in order to make sure that podman does not reuse the blobs of a differently-compressed variant present on the remote registry. | |
Note: This is by default set to `true` if `push` is being performed with `--compression-format`. Manually set it to `false` in order to opt-out of this behavior. |
387e99e
to
c96c923
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.
(Don’t let me review UIs and comments…)
Username: username, | ||
} | ||
|
||
if _, found := r.URL.Query()["compressionFormat"]; found { |
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.
Why does the API layer need to make this conditional as well? Doing that at just one layer seems clearer to me, in particular it rules out questions whether the common/config.EngineConfig.CompressionFormat
value applies (but it seems that it doesn’t, so we are actually fine.)
Also applies to the other copy.
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.
Podman REST API can be used without CLI
layer directly as well, hence its needed.
c96c923
to
a42431a
Compare
Addressed all the comments, expect the last one. |
@containers/podman-maintainers PTAL |
cmd/podman/images/push.go
Outdated
@@ -102,6 +102,8 @@ func pushFlags(cmd *cobra.Command) { | |||
flags.StringVar(&pushOptions.DigestFile, digestfileFlagName, "", "Write the digest of the pushed image to the specified file") | |||
_ = cmd.RegisterFlagCompletionFunc(digestfileFlagName, completion.AutocompleteDefault) | |||
|
|||
flags.BoolVar(&pushOptions.ForceCompressionFormat, "force-compression", false, "Use the specified compression algorithm if the destination contains a differently-compressed variant already") |
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.
flags.BoolVar(&pushOptions.ForceCompressionFormat, "force-compression", false, "Use the specified compression algorithm if the destination contains a differently-compressed variant already") | |
flags.BoolVar(&pushOptions.ForceCompressionFormat, "force-compression", false, "Use the specified compression algorithm even if the destination contains a differently-compressed variant already") |
The if
would otherwise turn it into a pre-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.
Same for all other occurrences of this sentence
…ion-format Value of `--force-compression` should be already `true` is `--compression-format` is selected otherwise let users decide. Signed-off-by: Aditya R <arajan@redhat.com>
a42431a
to
0938ee1
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; I’ll let Podman maintainers decide on whether the API should make that kind of decision, or whether it should be CLI-only.
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: flouthoc, 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 |
With discussion from here: containers/podman#19640, it was decided that `--force-compression` must be automatically `true` in case when `--compression-format` is set. Signed-off-by: Aditya R <arajan@redhat.com>
With discussion from here: containers/podman#19640, it was decided that `--force-compression` must be automatically `true` in case when `--compression-format` is set. Signed-off-by: Aditya R <arajan@redhat.com>
Adds support for --force-compression which allows end-users to force
push blobs with the selected compression in --compression option, in
order to make sure that blobs of other compression on registry are not
reused.
Is equivalent to: force-compression here: https://docs.docker.com/build/exporters/#compression
Closes: #18660
Similar to Buildah's: containers/buildah#4973