OCPBUGS-59197: Fix MOSB image deletion race during MOSC removal - #6348
OCPBUGS-59197: Fix MOSB image deletion race during MOSC removal#6348umohnani8 wants to merge 1 commit into
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@umohnani8: This pull request references Jira Issue OCPBUGS-59197, 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: 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. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: umohnani8 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 |
Walkthrough
ChangesMachineOSBuild image deletion
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 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 |
|
/pipeline required |
|
Scheduling tests matching the |
|
@umohnani8: This pull request references Jira Issue OCPBUGS-59197, 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: 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 `@pkg/controller/build/reconciler.go`:
- Around line 949-950: Update deleteMOSBImage to validate mosb.ObjectMeta.Labels
and TargetMachineConfigPoolLabelKey before calling machineConfigPoolLister.Get;
when the label is nil, missing, or empty, fail closed and do not enter the
deleted-pool handling or delete the image. Preserve that behavior only for a
non-empty pool name whose lookup returns NotFound.
🪄 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: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 63dd120b-8c74-4506-8562-cc61bdb1af21
📒 Files selected for processing (1)
pkg/controller/build/reconciler.go
|
/test tls-pqc-readiness Ignore this test, I'm just trying to show it's stable across PRs before making it required. |
a5b4d12 to
eaa8a7c
Compare
When a MachineOSConfig is deleted while nodes are actively rebasing, the node annotation safety check in deleteMOSBImage was gated on moscExists. Since the MOSC is already gone in this code path, moscExists is always false and the check is skipped entirely, allowing the image to be deleted from the registry while nodes are still using it. Remove the moscExists gate and look up the pool directly from the MOSB's labels. If the pool exists, check node annotations before deleting. If the pool is also gone, proceed with deletion since no nodes could be using the image. Signed-off-by: Urvashi <umohnani@redhat.com>
eaa8a7c to
b5f69a5
Compare
|
@umohnani8: The following tests failed, say
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. |
|
/pipeline required |
|
Scheduling tests matching the |
Closes https://redhat.atlassian.net/browse/OCPBUGS-59197
- What I did
When a MachineOSConfig is deleted while nodes are actively rebasing, the node annotation safety check in deleteMOSBImage was gated on moscExists. Since the MOSC is already gone in this code path, moscExists is always false and the check is skipped entirely, allowing the image to be deleted from the registry while nodes are still using it.
Remove the moscExists gate and look up the pool directly from the MOSB's labels. If the pool exists, check node annotations before deleting. If the pool is also gone, proceed with deletion since no nodes could be using the image.
- How to verify it
Follow the steps in https://redhat.atlassian.net/browse/OCPBUGS-59197 and the race should no longer happen
- Description for the changelog
Fix MOSB image deletion race during MOSC removal
Summary by CodeRabbit