Skip to content

Get from the Context if there is already a next reconciliation scheduled #2268

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

Closed
csviri opened this issue Mar 7, 2024 · 1 comment · Fixed by #2272
Closed

Get from the Context if there is already a next reconciliation scheduled #2268

csviri opened this issue Mar 7, 2024 · 1 comment · Fixed by #2272
Labels
feature needs-discussion Issue needs to be discussed more before working on it
Milestone

Comments

@csviri
Copy link
Collaborator

csviri commented Mar 7, 2024

This is just an idea that will allow certain optimizations in the reconciler implementation.

The feature would be to check if there is already a next reconciliation scheduled:

context.isNextReconciliationImminent()

If there is a next reconciliation scheduled means, there was an event regarding a change in the primary resource or some secondary resources. That means that some resources changed since the reconciliation started. Based on this user could decide to skip some possibly heavy operations, like even small things like calling the API server to update the status since there will be a new reconciliation shortly that will do it anyways - so this will reduce the number of K8S API Calls.

On the other hand, now there is no such thing that would be similar to "snapshot isolation" (except for the primary resource), thus when reconciliation happens always the actual resources are accessed in the cache. So unless the event/change arrived after a target secondary resource was reconciled, the reconciliation already happened on the actual resource.

@csviri csviri added feature needs-discussion Issue needs to be discussed more before working on it labels Mar 7, 2024
@gyfora
Copy link

gyfora commented Mar 7, 2024

I think this is a good improvement that would allow controllers to optimise the reconciliations. We could also use it in Flink probably to eliminate some codepaths

@csviri csviri added this to the 5.0 milestone Mar 7, 2024
@csviri csviri linked a pull request Mar 7, 2024 that will close this issue
@csviri csviri closed this as completed Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature needs-discussion Issue needs to be discussed more before working on it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants