Do we really require the difference between created and updated (and requeue in)? #281
Replies: 5 comments 13 replies
-
What are your opinions? Remove the difference between created/updated? Remove the requeue in feature? Or improve it to handle the watcher timeout? /cc @tillig @tomkerkhove @erin-allison @anekdoti among others :-) |
Beta Was this translation helpful? Give feedback.
-
I personally wire up "created", "updated" and "notmodified" all to the same handler and treat it as if they were just triggering a reconciliation loop; I don't care what calls it, when or why, just know that at that time, the state of the relevant resources should be verified/adjusted. As far as the requeue function, I don't have any issues with how it works right now, though I would agree with adding in some sort of deduplication (albeit I personally have zero clue how one would do so given that Reactive still looks like magic to me) |
Beta Was this translation helpful? Give feedback.
-
Another related observation: it seems that the operator triggers a created event the first time it sees a resource - which is not the actual creation of the resource, for example, when you restart an operator. This also might be misleading for someone, and a reason to drop it. |
Beta Was this translation helpful? Give feedback.
-
I'll admit I'm somewhat new to controller territory, trying to write an updated SMI adapter for Istio, so most of what I have to go on is what's already there and how it works in Go. From what I can tell, the Go controller-runtime basically does just boil it all down to a reconciliation handler to apply desired state. I haven't found any examples of controllers that somehow differentiate between, say, new and updated. I'm not sure if there is such a use case. That said, from a general API standpoint, I've always found it nice when a framework or SDK has the ability to be very granular in the various events that are available but also provides a nice glossy facade for me to use when I don't need them. I find that when the more granular events aren't present, that's when I suddenly somehow find a need for them. For example, maybe my security department wants to audit "new" vs. "update" events differently - having the ability to do that if I need to is huge. Definitely a contrived example, but... well, I've seen crazier requirements. |
Beta Was this translation helpful? Give feedback.
-
What I understand from the above thread is that now CreatedAsync, UpdateAsync,NotModifiedAsync are not required in controller and only one ReconcileAsync method is enough, right? If my understanding is correct, then Is there is a reason that templates mentioned here are still generating 3 different methods? Since, I am new to this, I am just trying to make sure, I start in the right direction :) Please advise on the right or suggested approach :) |
Beta Was this translation helpful? Give feedback.
-
A question that rose from #279.
Is it required, that one can differentiate between "created" and "updated" during reconciliation?
When I first started the project, I thought it is required to tell those events apart. But then considering the intended way and operator works, then the difference does not matter. In "all" cases (created, updated, and not-modified), the operator should check the current state and compare it to the desired state in the entity. If something changes, the operator should apply changes to ensure the desired state again.
Furthermore, I'd like to question the usefulness of the "requeue in" feature when returning a result in a reconciliation function. When the requeue time-delay is bigger than the watcher timeout (currently 60s), then it could lead to piled up events (like described in #280). Maybe, there should be a check if the returned timespan is bigger than the configured watcher timeout. Because when the watcher terminates and recreates, all entities trigger an event again (most likely, a not modified one).
Beta Was this translation helpful? Give feedback.
All reactions