Skip to content

Filtering ONLY own events in read-after-write-consitency #3398

Closed

Description

@csviri

When doing updates with read-after-write-consistency we are now filtering events that happened before our update. This is causing mainly now a practical issue only for primary resource:

quarkiverse/quarkus-operator-sdk#1353

however, for primary resource it could happen that while we update the status some changes the spec, and that we would like to reconcile. So for primary we should just filter only changes for our updates. But similar issue(s) scenarios might happen for the secondary resources see below.

At the end we will be on safe side to propagate intermediate events for changes that happen during our update. Thus only filter the event for our resource change, where the new resource version is the same as the resource version received after our update request.
Note that this is a bit harder than it seems, since relist might happen in informer for that we might need a small patch to fabric8 client, if that happens we need to propagate events also for our update since an event might be lost.

The problematic cases:

Primary resource spec update during status update

When we update the status at the end of the reconciliation, we might receive an update just before for the spec, that spec change now will be filtered out, so reconciliation won't be triggered for it.

Workaround

For now users can simply use the client to patch the status of the primary resource or update update secondary resources:

context.getClient().resource(webPage).patchStatus();

That will not filter our the events.

Or downgrade to v 5.2.x

Dependency between managed resources

Let's say we have a primary P that manages a resource A and there are other controllers on the cluster, that patches that resource A also. Assuming that in the controller we reconcile the resource A and that we should take into account properties of A that are managed by an other controller (think SSA). So in this case we have similar situation as with primary resource (above), that if we do an update on resource A and before that it just get updated (but after we calculated the target state) we don't get triggered by again for that update, however that is needed to get into desired state.

Edge case with re-list

Note that if a a 3rd party did an update on the resource just before our update but informer was down and had to re-list we might not see that event. To fix this we would need and additional callback before re-list and propagate events for all changed resources since the web socket if informer was down until the most recent resource version from list.

Notes

  • Note that both of these scenarios might be handled currently by the user with some (if user uses the the caching and filtering update directly not using UpdateControl) since user sees the up-to-date resource after updates. But for that user might require to check the resource after the update; what is quite strong requirement and it goes against the current mindset in the operator pattern.

Activity

  1. self-assigned this
    on Jun 6, 2026
  2. csviri commented on Jun 7, 2026

    @csviri
    CollaboratorAuthor

    cc @shawkins (if you are available please join the community meeting tomorrow)

  3. robobario commented on Jun 8, 2026

    @robobario
    Contributor

    Hi, just chiming in to say I think we're experience this in our Operator using v5.3.4, we observe that some primary reconciliations aren't triggered when we patch the status of our resource with SSA, while concurrently some third party is updating the resource. We end up with the latest generation not triggering a reconciliation.

    Pinning down to 5.2.4 looks like it should prevent this in the meanwhile, is that correct? edit: nope test still failing at 5.2.4.

  4. csviri commented on Jun 8, 2026

    @csviri
    CollaboratorAuthor

    @robobario a workaround for now would be to use the kubernetes client directly to update the resource not UpdateControl.patchStatus or downgrade to 5.2.x. But will provide a fix for this soon, that will solve the issue, some edge case will require a tweak to fabric8 client too, will let you know on updated on this issue.

  5. metacosm commented on Jun 8, 2026

    @metacosm
    Collaborator

    Maybe we're trying to be too smart for our own good…

  6. csviri commented on Jun 8, 2026

    @csviri
    CollaboratorAuthor
  7. csviri commented on Jun 8, 2026

    @csviri
    CollaboratorAuthor

    Maybe we're trying to be too smart for our own good…

    During the initial design actually we discussed this briefly with @shawkins, but we failed to see this scenario. An alternative would be to simply turn off the event filtering; However this way it could be solved relatively nicely, and IMO this is otherwise a great performance optimization.

  8. csviri commented on Jun 8, 2026

    @csviri
    CollaboratorAuthor

    @robobario regarding:

    Pinning down to 5.2.4 looks like it should prevent this in the meanwhile, is that correct? edit: nope test still failing at 5.2.4.

    That is probably a different issue, since this feature was released in 5.3.0. Could you please provide some more information regarding that?

  9. robobario commented on Jun 8, 2026

    @robobario
    Contributor

    Yep I'll continue debugging and update if I find out more. A bit tricky to share something minimal/reproducible as it's happening in our heaviest system tests with multiple reconcilers and resources playing together.

  10. robobario commented on Jun 9, 2026

    @robobario
    Contributor

    okay on that, I noticed that when I downgraded to 5.2.4 the build succeeded even though I didn't revert operator-framework-junit-5 to operator-framework-junit (or whichever way it changed, I might have that mixed up), a bit suspicious since it looks like there was only a single class modification in 5.2.4

    I'm wondering if something has happened like 5.2.4 got released off main? Looking at the core jar I can see classes that aren't in the v5.2.4 tag

    curl -s https://repo1.maven.org/maven2/io/javaoperatorsdk/operator-framework-core/5.2.4/operator-framework-core-5.2.4.jar -o /tmp/j.jar && jar tf /tmp/j.jar | grep -E 'EventFilterDetails|ExtendedResourceEvent|EventHandling|ReconcilerUtilsInternal' && rm /tmp/j.jar
    io/javaoperatorsdk/operator/ReconcilerUtilsInternal.class
    io/javaoperatorsdk/operator/processing/event/source/informer/TemporaryResourceCache$EventHandling.class
    io/javaoperatorsdk/operator/processing/event/source/informer/ExtendedResourceEvent.class
    io/javaoperatorsdk/operator/processing/event/source/informer/EventFilterDetails.class
    

    edit: I'll lift to a new issue, #3402

  11. csviri commented on Jun 9, 2026

    @csviri
    CollaboratorAuthor

    okay on that, I noticed that when I downgraded to 5.2.4 the build succeeded even though I didn't revert operator-framework-junit-5 to operator-framework-junit (or whichever way it changed, I might have that mixed up), a bit suspicious since it looks like there was only a single class modification in 5.2.4

    I'm wondering if something has happened like 5.2.4 got released off main? Looking at the core jar I can see classes that aren't in the v5.2.4 tag

    curl -s https://repo1.maven.org/maven2/io/javaoperatorsdk/operator-framework-core/5.2.4/operator-framework-core-5.2.4.jar -o /tmp/j.jar && jar tf /tmp/j.jar | grep -E 'EventFilterDetails|ExtendedResourceEvent|EventHandling|ReconcilerUtilsInternal' && rm /tmp/j.jar
    io/javaoperatorsdk/operator/ReconcilerUtilsInternal.class
    io/javaoperatorsdk/operator/processing/event/source/informer/TemporaryResourceCache$EventHandling.class
    io/javaoperatorsdk/operator/processing/event/source/informer/ExtendedResourceEvent.class
    io/javaoperatorsdk/operator/processing/event/source/informer/EventFilterDetails.class
    

    edit: I'll lift to a new issue, #3402

    Yes, there was I PR backported on top of 5.2.3 (health check improvements) that resulted in 5.2.4 off the main release. @metacosm can tell more in case.

    I didn't revert operator-framework-junit-5 to operator-framework-junit

    it does not matter that much imo, it was renamed because of forward compatibility naming wise for junit framework versions.

  12. csviri commented on Jun 9, 2026

    @csviri
    CollaboratorAuthor

    We are further discussing the new algorithm from here: #3399 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions