OCPBUGS-97592: skip plugin execution when backup does not target HCP resources#293
OCPBUGS-97592: skip plugin execution when backup does not target HCP resources#293Alcamech wants to merge 1 commit into
Conversation
|
Skipping CI for Draft Pull Request. |
|
@Alcamech: This pull request references Jira Issue OCPBUGS-97592, 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. |
|
Warning Review limit reached
Next review available in: 52 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (6)
Walkthrough
ChangesSpec-driven execution gating
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 14 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (14 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Alcamech 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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pkg/common/utils.go (1)
212-221: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winTreat
*as a match here.Backup.Spec.IncludedResourcescan legally be["*"], but this loop only recognizes explicit HCP resource names, so those backups fall through and get skipped. Short-circuit on*(or otherwise handle the all-resources case) so HCP restores still run.🤖 Prompt for 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. In `@pkg/common/utils.go` around lines 212 - 221, The resource filter in the IncludedResources check currently only matches explicit hostedcluster, hostedcontrolplane, and nodepool names, so backups configured with "*" are incorrectly skipped. Update the logic in the loop inside the relevant utils helper to treat "*" as a valid match for all resources and short-circuit to allow the restore path, while keeping the existing explicit resource-name checks intact.
🤖 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.
Outside diff comments:
In `@pkg/common/utils.go`:
- Around line 212-221: The resource filter in the IncludedResources check
currently only matches explicit hostedcluster, hostedcontrolplane, and nodepool
names, so backups configured with "*" are incorrectly skipped. Update the logic
in the loop inside the relevant utils helper to treat "*" as a valid match for
all resources and short-circuit to allow the restore path, while keeping the
existing explicit resource-name checks intact.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 8a6b9ffa-d7bc-4df2-9ee3-9a79cf7e776d
📒 Files selected for processing (3)
pkg/common/utils.gopkg/core/backup_test.gopkg/core/restore_test.go
|
/uncc @enxebre |
|
/uncc @sjenning |
|
/cc @jparrill |
jparrill
left a comment
There was a problem hiding this comment.
Dropped some comments. Thanks!
5fccb61 to
e9e35f3
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pkg/core/restore.go (1)
171-175: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove dead code.
This block is now unreachable. The
common.ShouldEndPluginExecution(backup)check above returns early iflen(backup.Spec.IncludedNamespaces) == 0, which inherently catches the case where the slice isnil.♻️ Proposed refactor
- // if the IncludedNamespaces field is nil, return error - if backup.Spec.IncludedNamespaces == nil { - p.log.Error("IncludedNamespaces from backup object is nil") - return nil, fmt.Errorf("included namespaces from backup object is nil") - } -🤖 Prompt for 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. In `@pkg/core/restore.go` around lines 171 - 175, Remove the unreachable nil check and its associated log/error return following the common.ShouldEndPluginExecution(backup) check in the restore flow. Leave the existing early-return behavior and subsequent restore logic unchanged.
🤖 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.
Nitpick comments:
In `@pkg/core/restore.go`:
- Around line 171-175: Remove the unreachable nil check and its associated
log/error return following the common.ShouldEndPluginExecution(backup) check in
the restore flow. Leave the existing early-return behavior and subsequent
restore logic unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: cfb9d369-cf00-449a-a481-bdeff89d2d18
📒 Files selected for processing (6)
pkg/common/utils.gopkg/common/utils_test.gopkg/core/backup.gopkg/core/backup_test.gopkg/core/restore.gopkg/core/restore_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- pkg/core/restore_test.go
e9e35f3 to
ca29049
Compare
…resources Signed-off-by: Lawton Mizell <lmizell@redhat.com>
ca29049 to
e55e499
Compare
|
@jparrill ready to tag |
|
@Alcamech: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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 kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
ShouldEndPluginExecution. The plugin now requiresincludedResourcesto list HCP types (hostedcontrolplane,hostedcluster, ornodepool) to proceed.includedResources: null) are correctly skipped, eliminating ~16K spurious errors and the misleadingPartiallyFailedstatus. Backup data was never affected.Context
ShouldEndPluginExecutionfalls back to a CRD-existence check whenincludedResourcesis empty. On management clusters the HCP CRD is always present, so MC-wide backups (daily-full/weekly-full) are never skipped. The plugin runs on every item (~16K), errors on each because no HostedControlPlane can be associated, and marks the backupPartiallyFailed.Every HC backup schedule on the staging MC (240 schedules) and every example in this repo specifies
includedResourceswith HCP types. MC-wide schedules haveincludedResources: null.Open question for the team: Can we require
includedResourcesto list HCP types for the plugin to run? If an HC backup omitsincludedResources, the plugin would silently skip. All current schedules and examples already include them.Test plan
make verifypassesCompleted(notPartiallyFailed)includedResourcescontaining HCP types proceeds normallyincludedResourcesproceeds normallySummary by CodeRabbit