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 desired state to the actual (cached) state; if they already match, skip the write entirely,
210
+
otherwise write and filter the own event. This is the **default** for the `ResourceOperations`
211
+
update/patch methods, and generally the most efficient option: it filters the own event *and*
212
+
avoids a request to the API server when nothing changed. Default matchers are provided for every
213
+
operation type, but they are heuristics — a workflow relying on them should be tested against the
214
+
concrete resources it manages, or a custom matcher supplied.
215
+
-`Options.filterIfOptimisticLocking()` — filter the own event only when the write uses optimistic
216
+
locking, otherwise just cache the response.
217
+
-`Options.cacheOnly()` — only cache the response (read-cache-after-write consistency), no own-event
218
+
filtering.
219
+
-`Options.forceFilterEvents()` — always filter, regardless of optimistic locking. Only safe when
220
+
correctness is otherwise guaranteed (mostly for internal usage); a concurrent external update in
221
+
the filter window may otherwise be missed until the next resync.
222
+
223
+
See the [`ResourceOperations`](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/ResourceOperations.java)
224
+
and `ResourceOperations.Options` documentation for details.
225
+
195
226
196
227
In order to benefit from these stronger guarantees, use [`ResourceOperations`](https://github.com/operator-framework/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/ResourceOperations.java)
197
228
from the context of the reconciliation:
@@ -208,20 +239,26 @@ public UpdateControl<WebPage> reconcile(WebPage webPage, Context<WebPage> contex
208
239
var upToDateResource = context.getSecondaryResource(ConfigMap.class);
209
240
210
241
makeStatusChanges(webPage);
211
-
212
-
// built in update methods by default use this feature
242
+
// patches the status and caches the response (does not filter the own event by default, see below)
213
243
returnUpdateControl.patchStatus(webPage);
214
244
}
215
245
```
216
246
217
-
`UpdateControl` and `ErrorStatusUpdateControl` by default use this functionality, but you can also update your primary resource at any time during the reconciliation using `ResourceOperations`:
247
+
{{% alert title="UpdateControl and event filtering" %}}
248
+
Since v5.5, returning an `UpdateControl` (or `ErrorStatusUpdateControl`) updates the resource and
249
+
keeps the cache read-after-write consistent, but by default it **no longer filters the own event** —
250
+
the resulting update may cause an additional (idempotent) reconciliation. To also filter the own
251
+
event, perform the update through `ResourceOperations` instead and return `UpdateControl.noUpdate()`.
252
+
{{% /alert %}}
253
+
254
+
You can update your primary resource at any time during the reconciliation using `ResourceOperations`:
0 commit comments