Skip to content

Commit 942ef64

Browse files
committed
wip
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent f465579 commit 942ef64

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

docs/content/en/blog/news/read-after-write-consistency.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,40 @@ which are result of our own updates.
3838
much simpler to reason about!**
3939
{{% /alert %}}
4040

41-
This post will deep dive in this topic, and explain all the rational and background behind this topic.
41+
This post will deep dive in this topic, explore the details and rationale behind it.
42+
43+
I briefly [talked about this](https://www.youtube.com/watch?v=HrwHh5Yh6AM&t=1387s) topic at KubeCon last year.
4244

4345
## Informers and eventual consistency
4446

47+
First we have to understand a fundamental building block of Kubernetes operators, called Informers.
48+
Since there is plentiful accessible information about this topic, just in a nutshell, we have to know,
49+
that these components:
50+
51+
1. Watches Kubernetes resources - K8S API sends events if a resource changes to the client
52+
though a websocket. An usually contains the whole resource. (There are some exceptions, see Bookmarks).
53+
See details about watch as K8S API concept in the [official docs](https://kubernetes.io/docs/reference/using-api/api-concepts/#semantics-for-watch).
54+
2. Caches the actual latest state of the resource.
55+
3. If an informer receives and event in which the `metadata.resourceVersion` is different from the version
56+
in the cached resource it propagates and event further, in our case triggering the reconiliation.
57+
58+
A controller is usually composed of multiple informers, one is tracking the primary resources, and
59+
there are also informers registered for each (secondary) resource we manage.
60+
Informers are great since we don't have to poll the Kubernetes API, it is push based; and they provide
61+
a cache, so reconciliations are very fast since they work on top of cached resources.
62+
63+
Now let's take a look on the flow when we do an update to a resources. Let's say we manage a Pod from our
64+
controller:
65+
66+
67+
68+
69+
70+
TODO
71+
- we do not cover deletes
72+
- thank to shaw
73+
74+
75+
4576

4677

0 commit comments

Comments
 (0)