You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `CustomResourceEventSource` event source is a special one, responsible for handling events
48
-
pertaining to changes affecting our primary resources. This `EventSource` is always registered
49
-
for every controller automatically by the SDK. It is important to note that events always relate
50
-
to a given primary resource. Concurrency is still handled for you, even in the presence of
51
-
`EventSource` implementations, and the SDK still guarantees that there is no concurrent execution of
52
-
the controller for any given primary resource (though, of course, concurrent/parallel executions
53
-
of events pertaining to other primary resources still occur as expected).
46
+
A few things worth highlighting about the diagram above.
47
+
- The `ControllerEventSource` is a special, internal event source responsible for handling events
48
+
pertaining to changes affecting the primary resource. The SDK registers it automatically for every
49
+
controller and you never instantiate it yourself.
50
+
- Every controller also gets a dedicated `TimerEventSource` (named
51
+
`RetryAndRescheduleTimerEventSource`) that the SDK uses to drive retry attempts after a failed
52
+
reconciliation, `UpdateControl.rescheduleAfter(...)` requests, and the periodic max-interval
53
+
failsafe trigger. The `EventProcessor` is the sole caller into this timer, scheduling delayed
54
+
events back to itself via `scheduleOnce(...)`. Like the controller event source, this one is
55
+
wired internally and is not something you register or interact with directly.
56
+
- Once an event reaches the `EventProcessor`, dispatch is delegated to the
57
+
`ReconciliationDispatcher`, which prepares the execution context, handles finalizers and other
58
+
framework concerns, and ultimately invokes `reconcile(...)` on the internal `Controller` wrapper,
59
+
which in turn calls the user-implemented `Reconciler`.
60
+
61
+
Events always relate to a given primary resource, and the SDK guarantees that there is no
62
+
concurrent execution of the reconciler for any given primary resource, even in the presence of
63
+
additional `EventSource` implementations. Events pertaining to other primary resources are still
64
+
processed in parallel as expected.
54
65
55
66
### Caching and Event Sources
56
67
@@ -69,34 +80,30 @@ is processed for the `InformerEventSource` implementation. However, this does no
69
80
hold true for all event source implementations (`PerResourceEventSource` for example). The SDK
70
81
provides methods to handle this situation elegantly, allowing you to check if an object is
71
82
cached, retrieving it from a provided supplier if not. See
72
-
related [method](https://github.com/java-operator-sdk/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/polling/PerResourcePollingEventSource.java#L146)
83
+
related [method](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/polling/PerResourcePollingEventSource.java#L160-L180)
73
84
.
74
85
75
86
### Registering Event Sources
76
87
77
-
To register event sources, your `Reconciler` has to override the `prepareEventSources` and return
78
-
list of event sources to register. One way to see this in action is
79
-
to look at the
88
+
To register event sources, your `Reconciler` overrides the `prepareEventSources` default method
89
+
and returns the list of event sources to register. One way to see this in action is to look at the
See [MySQL Schema sample](https://github.com/java-operator-sdk/java-operator-sdk/blob/main/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/MySQLSchemaReconciler.java)
210
+
See [MySQL Schema sample](https://github.com/operator-framework/java-operator-sdk/blob/main/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/MySQLSchemaReconciler.java)
@@ -244,7 +289,7 @@ To turn off this feature, set `generationAwareEventProcessing` to `false` for th
244
289
245
290
When informers / event sources are properly set up, and the `Reconciler` implementation is
246
291
correct, no additional reconciliation triggers should be needed. However, it's
247
-
a [common practice](https://github.com/java-operator-sdk/java-operator-sdk/issues/848#issuecomment-1016419966)
292
+
a [common practice](https://github.com/operator-framework/java-operator-sdk/issues/848#issuecomment-1016419966)
248
293
to have a failsafe periodic trigger in place, just to make sure resources are nevertheless
249
294
reconciled after a certain amount of time. This functionality is in place by default, with a
250
295
rather high time interval (currently 10 hours) after which a reconciliation will be
@@ -262,7 +307,7 @@ The event is not propagated at a fixed rate, rather it's scheduled after each re
262
307
next reconciliation will occur at most within the specified interval after the last reconciliation.
263
308
264
309
This feature can be turned off by setting `maxReconciliationInterval`
265
-
to [`Constants.NO_MAX_RECONCILIATION_INTERVAL`](https://github.com/java-operator-sdk/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Constants.java#L20-L20)
310
+
to [`Constants.NO_MAX_RECONCILIATION_INTERVAL`](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Constants.java#L20-L20)
266
311
or any non-positive number.
267
312
268
313
The automatic retries are not affected by this feature so a reconciliation will be re-triggered
@@ -292,8 +337,8 @@ evict cold resources than try to limit cache sizes.
292
337
293
338
See usage of the related implementation using [Caffeine](https://github.com/ben-manes/caffeine) cache in integration
294
339
tests
295
-
for [primary resources](https://github.com/java-operator-sdk/java-operator-sdk/blob/main/caffeine-bounded-cache-support/src/test/java/io/javaoperatorsdk/operator/processing/event/source/cache/sample/AbstractTestReconciler.java).
340
+
for [primary resources](https://github.com/operator-framework/java-operator-sdk/blob/main/caffeine-bounded-cache-support/src/test/java/io/javaoperatorsdk/operator/processing/event/source/cache/sample/AbstractTestReconciler.java).
296
341
297
342
See
298
-
also [CaffeineBoundedItemStores](https://github.com/java-operator-sdk/java-operator-sdk/blob/main/caffeine-bounded-cache-support/src/main/java/io/javaoperatorsdk/operator/processing/event/source/cache/CaffeineBoundedItemStores.java)
343
+
also [CaffeineBoundedItemStores](https://github.com/operator-framework/java-operator-sdk/blob/main/caffeine-bounded-cache-support/src/main/java/io/javaoperatorsdk/operator/processing/event/source/cache/CaffeineBoundedItemStores.java)
0 commit comments