-
Notifications
You must be signed in to change notification settings - Fork 428
OCPBUGS-62496: fix: delete old profile during replacement #7089
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
OCPBUGS-62496: fix: delete old profile during replacement #7089
Conversation
|
@Tal-or: This pull request references Jira Issue OCPBUGS-62496, which is valid. 3 validation(s) were run on this bug
No GitHub users were found matching the public email listed for the QA contact in Jira (liqcui@redhat.com), skipping review request. 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. |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jparrill, Tal-or 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 |
|
Verify is failing due to: Check the commit follows the conventional commits (Doc here) |
|
@coderabitai review |
91b0340 to
eb473ef
Compare
|
@Tal-or: No Jira issue is referenced in the title of this pull request. 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. |
WalkthroughntoReconcile now lists PerformanceProfile ConfigMaps for the NodePool, deletes any that don't match the newly computed ConfigMap name, then proceeds to create or update the target PerformanceProfile ConfigMap with existing error handling and logging. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (1)
hypershift-operator/controllers/nodepool/nto.go(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Red Hat Konflux / hypershift-operator-main-on-pull-request
🔇 Additional comments (2)
hypershift-operator/controllers/nodepool/nto.go (2)
526-549: The cleanup logic correctly addresses the PR objective.The implementation properly handles deletion of old PerformanceProfile ConfigMaps when a profile is replaced:
- Lists existing ConfigMaps for the NodePool
- Deletes any that don't match the current desired name
- Creates or updates the desired ConfigMap
This ensures only the relevant PerformanceProfile ConfigMap remains for the NodePool.
526-534: Verify the intentionality of theIsNotFoundcheck in List operations.The pattern
err != nil && !apierrors.IsNotFound(err)is used consistently across the codebase (found in at least hostedcluster_controller.go:3107 and nto.go:57-58). While List operations typically return empty lists rather than NotFound errors per Kubernetes API conventions, this defensive check appears to be intentional—either as a safety measure or legacy pattern. Confirm whether this is deliberate defensive programming or can be simplified to justerr != nil.
When a PerformanceProfile is being replaced for a NodePool, hypershift controller lack the logic to delete the old profile from the HCP namespace. This commit resolve this gap. A dedicated e2e test coverage was added on NTO repo: openshift/cluster-node-tuning-operator#1413 Signed-off-by: Talor Itzhak <titzhak@redhat.com>
eb473ef to
ed3c3cc
Compare
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
hypershift-operator/controllers/nodepool/nto.go (1)
536-543: Consider adding a log message when deleting old ConfigMaps.Adding a log entry when deleting mismatched ConfigMaps would improve debuggability and provide better visibility into the cleanup operation.
Apply this diff to add logging:
for i := range existingPerformanceProfileConfigMapList.Items { ppConfigMap := &existingPerformanceProfileConfigMapList.Items[i] if ppConfigMap.Name != performanceProfileConfigMap.Name { + log.Info("Deleting old PerformanceProfile ConfigMap", "name", ppConfigMap.Name) if _, err := supportutil.DeleteIfNeeded(ctx, r.Client, ppConfigMap); err != nil { return fmt.Errorf("failed to delete performanceProfile ConfigMap: %w", err) } } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (1)
hypershift-operator/controllers/nodepool/nto.go(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Red Hat Konflux / hypershift-operator-main-on-pull-request
🔇 Additional comments (3)
hypershift-operator/controllers/nodepool/nto.go (3)
526-534: LGTM! Proper scoping and error handling for listing ConfigMaps.The List operation correctly filters for PerformanceProfile ConfigMaps belonging to the current NodePool, and error handling appropriately ignores NotFound while returning other errors.
536-543: LGTM! Correctly implements cleanup of old PerformanceProfile ConfigMaps.The loop correctly addresses the previous review concern by using
for i := rangeand taking the address of the slice element directly. The logic properly deletes any existing ConfigMaps that don't match the target name, which resolves OCPBUGS-62496.
544-550: LGTM! Proper reconciliation with error handling and logging.The CreateOrUpdate operation correctly reconciles the target PerformanceProfile ConfigMap after cleanup, with appropriate error handling and logging.
|
/retest-required |
|
/retitle OCPBUGS-62496: fix: delete old profile during replacement |
|
@Tal-or: This pull request references Jira Issue OCPBUGS-62496, which is valid. 3 validation(s) were run on this bug
No GitHub users were found matching the public email listed for the QA contact in Jira (liqcui@redhat.com), skipping review request. 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. |
|
/lgtm |
|
/retest |
|
@jparrill @bryan-cox Thank you for the approval folks, who should add the verified label? |
|
/verified by @mrniranjan |
|
@mrniranjan: This PR has been marked as verified by 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. |
|
/retest |
1 similar comment
|
/retest |
|
@Tal-or: 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. |
|
@Tal-or: Jira Issue OCPBUGS-62496: Some pull requests linked via external trackers have merged: The following pull request, linked via external tracker, has not merged: All associated pull requests must be merged or unlinked from the Jira bug in order for it to move to the next state. Once unlinked, request a bug refresh with Jira Issue OCPBUGS-62496 has not been moved to the MODIFIED state. This PR is marked as verified. If the remaining PRs listed above are marked as verified before merging, the issue will automatically be moved to VERIFIED after all of the changes from the PRs are available in an accepted nightly payload. 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. |
|
/cherry-pick release-4.20, release-4.19 |
|
@Tal-or: cannot checkout 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 kubernetes-sigs/prow repository. |
|
/cherry-pick release-4.20 release-4.19 |
|
@Tal-or: new pull request created: #7428 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 kubernetes-sigs/prow repository. |
What this PR does / why we need it:
When a PerformanceProfile is being replaced for a NodePool, hypershift controller lack the logic to delete the old profile from the HCP namespace.
This commit resolve this gap.
A dedicated e2e test coverage was added on NTO repo: openshift/cluster-node-tuning-operator#1413
Which issue(s) this PR fixes:
Fixes
OCPBUGS-62496
Special notes for your reviewer:
Checklist: