OCPBUGS-36246: Improve resource merge diffs#1409
Conversation
|
@2uasimojo: This pull request references Jira Issue OCPBUGS-36246, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (13)
✅ Files skipped from review due to trivial changes (4)
🚧 Files skipped from review as they are similar to previous changes (9)
WalkthroughA new exported ChangesManifestDiff adoption across resource apply functions
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 1 warning)
✅ Passed checks (13 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/jira refresh |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 2uasimojo The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@2uasimojo: This pull request references Jira Issue OCPBUGS-36246, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@2uasimojo: This pull request references Jira Issue OCPBUGS-36246, which is valid. 3 validation(s) were run on this bug
Requesting review from QA contact: DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/resourceapply/interface.go`:
- Around line 33-36: The allow-list filter in the switch statement (checking
parts[1] against "Name", "Namespace", "Labels", "Annotations",
"OwnerReferences") fails when paths contain bracket notation or array indices
like `Labels["key"]` or `OwnerReferences[0].Name`. Extract the base field name
from parts[1] by removing any content after the first bracket character (such as
"[") before performing the switch case comparison, so that paths with bracket
notation or array indices still match the allow-listed field names and are not
incorrectly filtered out.
In `@lib/resourceapply/security.go`:
- Around line 39-41: The ManifestDiff comparison on line 40 is comparing
`original` vs `existing`, but the actual Update call on line 47 is updating with
`reconcile`. This mismatch can hide real changes in logs. Change the
ManifestDiff call to compare `&required` vs `existing` or the appropriate
objects that reflect what is actually being updated with the reconcile object,
ensuring the diff accurately shows what changes will be applied.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: c20f1549-1bc8-44a1-ae3f-7b75c3047348
📒 Files selected for processing (13)
lib/resourceapply/admissionregistration.golib/resourceapply/apiext.golib/resourceapply/apps.golib/resourceapply/batch.golib/resourceapply/core.golib/resourceapply/cv.golib/resourceapply/imagestream.golib/resourceapply/interface.golib/resourceapply/operators.golib/resourceapply/rbac.golib/resourceapply/security.gopkg/cvo/internal/generic.gopkg/cvo/internal/operatorstatus.go
c916190 to
4dbfdec
Compare
f2d8447 to
7334e8b
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/resourceapply/interface.go`:
- Line 35: In the case statement in the interface.go file, correct the two field
name typos to match the actual metav1.ObjectMeta field names. Change
"GeneratedName" to "GenerateName" and change "DeletionGracePeriodSecords" to
"DeletionGracePeriodSeconds". These typos prevent the filter from matching the
actual Kubernetes ObjectMeta fields during comparison, which causes
false-positive diffs to appear in the ManifestDiff function output.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: fbd71455-bb14-4add-a3b1-3e0c73964236
📒 Files selected for processing (13)
lib/resourceapply/admissionregistration.golib/resourceapply/apiext.golib/resourceapply/apps.golib/resourceapply/batch.golib/resourceapply/core.golib/resourceapply/cv.golib/resourceapply/imagestream.golib/resourceapply/interface.golib/resourceapply/operators.golib/resourceapply/rbac.golib/resourceapply/security.gopkg/cvo/internal/generic.gopkg/cvo/internal/operatorstatus.go
✅ Files skipped from review due to trivial changes (3)
- pkg/cvo/internal/generic.go
- lib/resourceapply/cv.go
- lib/resourceapply/core.go
🚧 Files skipped from review as they are similar to previous changes (9)
- lib/resourceapply/security.go
- lib/resourceapply/apiext.go
- pkg/cvo/internal/operatorstatus.go
- lib/resourceapply/admissionregistration.go
- lib/resourceapply/operators.go
- lib/resourceapply/batch.go
- lib/resourceapply/apps.go
- lib/resourceapply/rbac.go
- lib/resourceapply/imagestream.go
Resource merges -- where CVO asserts the shape of "owned" resources based on manifests from the release payload -- were trying to display useful information when an update was triggered. However: - In some places, we were comparing objects *after* syncing, so the output would never show the discrepancy that actually triggered the update. - We were using `cmp.Diff()` without any filters, so the diff would always show mismatches in Metadata like UID, CreationTimestamp, etc. Here we fix the instances of the former; and address the latter via a helper that filters (ignores): - All TypeMeta, since by the time we get to this code, we're already sure the GVKs are correct (but sometimes the values from the manifest side can be blank?). - Status - ObjectMeta fields not explicitly synced by EnsureObjectMeta() Signed-off-by: Eric Fried <efried@redhat.com>
7334e8b to
1382cc5
Compare
Resource merges -- where CVO asserts the shape of "owned" resources based on manifests from the release payload -- were trying to display useful information when an update was triggered. However:
cmp.Diff()without any filters, so the diff would always show mismatches in Metadata like UID, CreationTimestamp, etc.Here we fix the instances of the former; and address the latter via a helper that filters (ignores):
Summary by CodeRabbit
Refactor
ManifestDiffhelper, with filtering to ignore non-impactful fields.Bug Fixes