fix: deletion not reconciled when merged into eventFilteringUpdate response#3394
Open
xstefank wants to merge 1 commit into
Open
fix: deletion not reconciled when merged into eventFilteringUpdate response#3394xstefank wants to merge 1 commit into
xstefank wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a regression where a resource deletion could be missed when it races with a status update performed via eventFilteringUpdateAndCacheResource, causing finalizer cleanup not to be triggered (ref: quarkiverse/quarkus-operator-sdk#1353).
Changes:
- Add a fallback path in
ManagedInformerEventSource#eventFilteringUpdateAndCacheResourceto trigger reconciliation when the update response is marked for deletion but no new event is emitted after filtering. - Introduce a new regression integration test scenario that reproduces the “delete during status patch” race and asserts that
cleanup()is invoked. - Add minimal test CR + status model classes to support the new regression test.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/ManagedInformerEventSource.java | Adds fallback reconciliation trigger when deletion is merged into an update response but the corresponding delete event is filtered/dropped. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/deletionduringstatusupdate/DeletionDuringStatusUpdateIT.java | New regression IT validating cleanup is triggered when delete races with a status update. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/deletionduringstatusupdate/DeletionDuringStatusUpdateReconciler.java | Test reconciler that blocks inside a status patch to widen the race window and exposes latches to the test. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/deletionduringstatusupdate/DeletionDuringStatusUpdateCustomResource.java | Test custom resource model used by the regression IT. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/deletionduringstatusupdate/DeletionDuringStatusUpdateStatus.java | Test status POJO used by the regression IT. |
Comment on lines
+146
to
+159
| // If the resource was marked for deletion concurrently with this update, the deletion | ||
| // event arrived at a lower RV than the update result and was deferred then dropped by | ||
| // doneEventFilterModify (deferred RV < lastOwnUpdatedRV). The API server merges the | ||
| // deletionTimestamp into the update response, so updatedForLambda already carries it, | ||
| // but no event was propagated to the reconciler. Trigger one now so the finalizer can | ||
| // be removed. | ||
| if (updatedForLambda != null | ||
| && updatedForLambda.isMarkedForDeletion() | ||
| && !resourceToUpdate.isMarkedForDeletion()) { | ||
| log.debug( | ||
| "Resource {} was marked for deletion during update, triggering reconciliation", | ||
| id); | ||
| handleEvent(ResourceAction.UPDATED, updatedForLambda, resourceToUpdate, null); | ||
| } |
825b4ef to
6b1785b
Compare
…sponse Signed-off-by: xstefank <xstefank122@gmail.com>
6b1785b to
0d7c35d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Should fix quarkiverse/quarkus-operator-sdk#1353.