-
Notifications
You must be signed in to change notification settings - Fork 220
Integration of expectations #2750
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
Comments
What I could imaging is to have an API that looks something like this: UpdateControl reconcile(Primary primary, Context<Primary> context) {
// omit reconcile details
return UpdateControl.expect((context,primary)-> {
var resources = context.getSecondaryResources(MyResource.class)
return checkIfResourcesInexpectedState(resources)
},Duration.ofSeconds(5))
} In other words, that the reconcile could return an expectation with a timeout, and the reconciliation would not be triggered until that expectation predicate is true or it timeouts. While this sounds nice, and might provide a benefit for the users, execution, we won't have too much space to optimize it, so in terms of execution, it would have to be done anyway in the executor service thread that we use now for reconciliation. So this can be directly transformed to something like this: UpdateControl reconcile(Primary primary, Context<Primary> context) {
var resources = context.getSecondaryResources(MyResource.class)
if (!checkIfResourcesInexpectedState(resources)) {
return UpdateControl.noUpdate()
}
} Except the timeout for which user might have to track hat in a ConcurrentHashMap or such. It would be a completely different story if this worked as a cross-cutting filter, where all the event source caches are available. It would worth to make a prototype, how that would look like, but for that we would need a new abstraction, probably a subset of Context to access secondary resources from the cache and directly event sources in case. |
Uh oh!
There was an error while loading. Please reload this page.
See references and description of expectations here:
https://ahmet.im/blog/controller-pitfalls/#expectations-pattern
This does not seems to be supported in controller runtime either:
kubernetes-sigs/controller-runtime#644
We should investigate how we could support this in different layers of the framework.
The text was updated successfully, but these errors were encountered: