-
Notifications
You must be signed in to change notification settings - Fork 219
fix: do not update cache if the execution failed #319
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
Conversation
ac82207
to
716399e
Compare
@metacosm I have tested this running the if (retry != null && postExecutionControl.exceptionDuringExecution()) {
handleRetryOnException(executionScope);
return;
} It seems to be right because in the end due to an exception, the operator sdk has to retry. |
The problem is that we add the finalizer to the cached object, and even if the update fails the object itself remains changed. |
#321 |
@csviri I'd like to revisit with you the decision to use a cache because I'm still not convinced we need one and I'm afraid it might cause more issues than it will solve… |
At the beginning I thought that the cache was need for handling events for resources with newer generation only then I saw that this kind of skip is made by using this |
@ppatierno @metacosm we can organize a call, happy to discuss the details. Its needed also for the generation aware processing also, since we are doing optimistic version control, but that is a details. The main idea is: If we execute the controller, the custom resource is always received as a parameter in the controller, this naturally needed, since we would like to update its status, but mainly we always reconcile based on specs of a custom resource. Since we are not just listening to the changes of the custom resource itself, but we can have other event sources ( where we execute the controller if we receive event from different source - and want to provide the CR also in this case ), for this case we use the cache with the latest resource, since we are already watching for he changes for that resource its quite natural to cache it (not to call always the K8S Api for a fresh one). |
@ppatierno does the last PR fix your issue? I would say we should merge that in case does. Event if we want to change the behavior with caches that is something for a long term. |
@csviri yes I tested it yesterday and it fixed this case. |
Should fix #310