-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Drop image signature annotations #19037
Drop image signature annotations #19037
Conversation
@openshift/api-review |
/retest |
pkg/image/registry/image/strategy.go
Outdated
// validation; resolves rhbz#1557607 | ||
for i := range newImage.Signatures { | ||
newImage.Signatures[i].Annotations = map[string]string{} | ||
} |
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 only need this on prepare for update right?
on a create i think we want to reject the creation w/ the validation failure reason, rather than silently drop the user's metadata.
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 agree. that is consistent with existing behavior
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 if somebody wants to import backed up images?
@@ -62,9 +62,6 @@ func (s *containerImageSignatureDownloader) DownloadImageSignatures(image *image | |||
// signature. | |||
sig.Name = imageapi.JoinImageStreamImage(image.Name, fmt.Sprintf("%x", sha256.Sum256(blob))) | |||
sig.Content = blob | |||
sig.Annotations = map[string]string{ | |||
SignatureManagedAnnotation: "true", |
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.
@mfojtik does the controller do something with this annotation later?
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.
No, there's no other reference to the annotation apart those referenced here.
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.
no and I don't remember adding this
pkg/image/registry/image/strategy.go
Outdated
// bug in image update logic allowed to set arbitrary annotations that would otherwise be rejected by | ||
// validation; resolves rhbz#1557607 | ||
for i := range newImage.Signatures { | ||
newImage.Signatures[i].Annotations = map[string]string{} |
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 would only drop the old controller annotation.
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.
yeah i guess that makes sense. for any other annotation they'll run into the validation rule.
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.
Fixed.
27cb3bb
to
136a32b
Compare
136a32b
to
3718037
Compare
@@ -49,6 +52,8 @@ func (s imageStrategy) PrepareForCreate(ctx apirequest.Context, obj runtime.Obje | |||
newImage.DockerImageManifest = "" | |||
newImage.DockerImageConfig = "" | |||
} | |||
|
|||
removeManagedSignatureAnnotation(newImage) |
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.
since it's now only going to drop the one annotation, i think i'm ok w/ doing this on create, for the (unlikely) backup/restore use case. @deads2k ?
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.
since it's now only going to drop the one annotation, i think i'm ok w/ doing this on create, for the (unlikely) backup/restore use case. @deads2k ?
Ok.
pkg/image/registry/image/strategy.go
Outdated
@@ -16,6 +16,9 @@ import ( | |||
"github.com/openshift/origin/pkg/image/util" | |||
) | |||
|
|||
// ManagedSignatureAnnotation used to be set by image signature import controller as a signature annotation. | |||
const ManagedSignatureAnnotation = "image.openshift.io/managed-signature" |
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: private, right?
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.
good catch, fixed
I think this is our best route forward. @smarterclayton @liggitt any alternative ideas? We'll have to pick this fairly far back. |
back to 3.7, no further right? |
ed6c117
to
0a9bec8
Compare
I see now, the validation check itself (the swap args) needs to be backported further to ensure users don't update image objects w/ invalid content. |
@mfojtik and that's what we think of your annotation! :) |
/lgtm |
/retest Please review the full test history for this PR and help us cut down flakes. |
4 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
Signed-off-by: Michal Minář <[email protected]>
Signed-off-by: Michal Minář <[email protected]>
Made it compilable again. |
0a9bec8
to
6feafaf
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bparees, mfojtik, miminar 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 |
Automatic merge from submit-queue (batch tested with PRs 18905, 18968, 19016, 19037, 19056). |
@miminar can you start queuing up backports of the validation fix? Needs to go back to at least v3.3 i'd say. (and the removal of the signature annotation logic would need to go back to at least 3.7 where it was introduced) |
Because they were never meant to be allowed.
Includes and superseds #19030 (kudos to @deads2k)
Closes #19011
Resolves: rhbz#1557607
/assign @bparees @deads2k
/cc @mfojtik