-
Notifications
You must be signed in to change notification settings - Fork 70
🌱 Revision manifest sanitization #2319
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
🌱 Revision manifest sanitization #2319
Conversation
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2319 +/- ##
==========================================
+ Coverage 74.23% 74.27% +0.03%
==========================================
Files 91 91
Lines 7057 7083 +26
==========================================
+ Hits 5239 5261 +22
- Misses 1403 1406 +3
- Partials 415 416 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| return r.buildClusterExtensionRevision(objs, ext, revisionAnnotations), nil | ||
| } | ||
|
|
||
| var restrictedMetadata = []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.
There was a suggestion by Predrag on the ticket to maybe do it as an allow list instead, i.e. just allow:
.spec, .metadata.name, .metadata.namespace, .metadata.annotations, and .metadata.labels. Wdyt?
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.
Ooooh I didn't understand that message at first, I didn't realize he meant a "white" list 😆 But yes, I can do that and that would be simpler.
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.
On second thought this might make it more difficult to give high-granularity warnings when we find a field to remove, but I'll think about it some more.
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.
Ooooh I didn't understand that message at first, I didn't realize he meant a "white" list 😆 But yes, I can do that and that would be simpler.
The terms "white" and "black" lists are problematic; the preferred terms are "allow" and "block" lists.
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.
Thanks Todd - I avoid them myself but only mentioned it here because the original suggestion used that terminology.
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.
Thanks for working on this! I really appreciate the effort to make things cleaner.
Just a small thought — I don’t think we should get in the middle of how the Kubernetes API manages its own fields.
We should let the API do its job and handle those values as it’s designed to.
If we start stripping or modifying them ourselves, we might cause unexpected behavior, ownership issues, or race conditions later on.
- 🆗 It’s totally fine to clean up our testdata for readability — that’s helpful and safe.
- 🚫 But in the controller or reconciler, it’s best to let k8s manage those fields naturally.
Letting k8s handle its own fields keeps our controller simple, predictable, and safe. 🌿
Thanks Camila! But TBH, I'm not sure what you're referring to here WRT "getting in the middle of things". What we're doing here is removing fields controlled/modified/etc. by the kube API server from the bundle manifests before we add them to the CER phases. Bundle creators should not be setting these fields. If they do, and we don't clear them, the reconciler will see that a field was modified from the original revision and may infinitely create new revisions - see here. |
…applied by revisions. Assisted-by: Gemini+Claude Signed-off-by: Daniel Franz <dfranz@redhat.com>
e237a5d to
64dfcf7
Compare
Which is something (infinitely create new revisions) I'm seeing in another bug. So, this is likely a case where we do want to intervene in the processing of these fields. |
|
So, I think now I understand it, the goal here is to make sure that when we create new revisions (e.g., v2, v3, v4), they’re based on the latest revision object — which makes total sense. I agree that we shouldn’t carry over all the existing fields as-is into the new revision. However, instead of stripping those fields out, what do you think about defining a new struct (or helper) that explicitly copies only the fields that make sense for the revision? This way, if Kubernetes adds new fields in the future, our code will still behave correctly without needing manual updates. Maybe something like a NewRevisionFrom() function that builds a new revision object and only fills in the fields we need — that might make the intent clearer and the logic more robust. |
64dfcf7 to
0dc0a28
Compare
|
Branch updated; as suggested, we now filter the |
Signed-off-by: Daniel Franz <dfranz@redhat.com>
0dc0a28 to
4e49490
Compare
|
/approve |
rashmigottipati
left a comment
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: rashmigottipati, tmshort The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
c95fc24
into
operator-framework:main
Description
Removes metadata fields used by the kube api to avoid situations like #2295
Reviewer Checklist