|
| 1 | +--- |
| 2 | +title: Welcome read-cache-after-write consistency!!! |
| 3 | +# todo issue with this? |
| 4 | +#date: 2026-03-25 |
| 5 | +author: >- |
| 6 | + [Attila Mészáros](https://github.com/csviri) |
| 7 | +--- |
| 8 | + |
| 9 | +**TL;DR:** |
| 10 | +In version 5.3.0 we introduced strong consistency guarantees for updates. |
| 11 | +You can now update resources (both your custom resoure and managed resource) |
| 12 | +and the framwork will guaratee that these updates will be instantly visible, |
| 13 | +thus when accessing resources from caches; |
| 14 | +and naturally also for subsequent reconciliations. |
| 15 | + |
| 16 | +```java |
| 17 | + |
| 18 | +public UpdateControl<WebPage> reconcile(WebPage webPage, Context<WebPage> context) { |
| 19 | + |
| 20 | + ConfigMap managedConfigMap = prepareConfigMap(webPage); |
| 21 | + // apply the resource with new API |
| 22 | + context.resourceOperations().serverSideApply(managedConfigMap); |
| 23 | + |
| 24 | + // fresh resource instantly available from our update in the caches |
| 25 | + var upToDateResource = context.getSecondaryResource(ConfigMap.class); |
| 26 | + |
| 27 | + // from now on built in update methods by default use this feature; |
| 28 | + // it is guaranteed that resource changes will be visible for next reconciliation |
| 29 | + return UpdateControl.patchStatus(alterStatusObject(webPage)); |
| 30 | +} |
| 31 | +``` |
| 32 | + |
| 33 | +In addition to that framework will automatically filter events for your updates, thus those |
| 34 | +which are result of our own updates. |
| 35 | + |
| 36 | +{{% alert color=success %}} |
| 37 | +**These should significantly simplify controller development, and will make reconciliation |
| 38 | +much simpler to reason about!** |
| 39 | +{{% /alert %}} |
| 40 | + |
| 41 | +This post will deep dive in this topic, and explain all the rational and background behind this topic. |
| 42 | + |
| 43 | +## Informers and eventual consistency |
| 44 | + |
| 45 | + |
| 46 | + |
0 commit comments