-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
|
||
// imageStrategy implements behavior for Images. | ||
type imageStrategy struct { | ||
runtime.ObjectTyper | ||
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more.
Ok. |
||
} | ||
|
||
// Validate validates a new image. | ||
|
@@ -127,9 +132,20 @@ func (s imageStrategy) PrepareForUpdate(ctx apirequest.Context, obj, old runtime | |
newImage.DockerImageManifest = "" | ||
newImage.DockerImageConfig = "" | ||
} | ||
|
||
removeManagedSignatureAnnotation(newImage) | ||
} | ||
|
||
// ValidateUpdate is the default update validation for an end user. | ||
func (imageStrategy) ValidateUpdate(ctx apirequest.Context, obj, old runtime.Object) field.ErrorList { | ||
return validation.ValidateImageUpdate(old.(*imageapi.Image), obj.(*imageapi.Image)) | ||
return validation.ValidateImageUpdate(obj.(*imageapi.Image), old.(*imageapi.Image)) | ||
} | ||
|
||
// removeManagedSignatureAnnotation removes deprecated annotation from image signatures. A bug in image update | ||
// logic allowed to set arbitrary annotations that would otherwise be rejected by validation. | ||
// Resolves rhbz#1557607 | ||
func removeManagedSignatureAnnotation(img *imageapi.Image) { | ||
for i := range img.Signatures { | ||
delete(img.Signatures[i].Annotations, managedSignatureAnnotation) | ||
} | ||
} |
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