Skip to content

Instantly share code, notes, and snippets.

@jeesmon
Created February 28, 2022 13:49
Show Gist options
  • Save jeesmon/d4231f9856c58d07b8b449b131753304 to your computer and use it in GitHub Desktop.
Save jeesmon/d4231f9856c58d07b8b449b131753304 to your computer and use it in GitHub Desktop.

Reconciliation is level-based, meaning action isn’t driven off changes in individual Events, but instead is driven by actual cluster state read from the apiserver or a local cache. For example if responding to a Pod Delete Event, the Request won’t contain that a Pod was deleted, instead the reconcile function observes this when reading the cluster state and seeing the Pod as missing.

More on what level-based means from external slack (best explanation that I have seen so far)

coderanger:

It's a bit of jargon from electronics that got carried over into computer stuff 🙂

If you want to make a reactive system there's two main approaches, you can watch for changes and then do something in response to those changes. For example when you click a button, the app does something. That is called "edge based" because in electronics you would see a rising or falling voltage change as the thing you are paying attention to

The other is to watch if the voltage is high or low, or in our case watch for the requested state of the world and reconcile it with the real one. Since this is taking action based on the voltage level rather than the change in it, we call it "level based"

An edge based system might just look at the delta of incoming API object changes, if you changed a given field then you would run the code to implement that change

That style of system is extremely brittle though, if you ever miss a delta or they get out of order or whatever, all of a sudden your tracking is out of sync

There isn't a "level" specifically, in electronics that would be talking about voltage in a wire, it's more of a metaphor here 🙂

At the start of your reconcile, you get the whole object and reconcile based on that "voltage level"

klein lee:

So it is the event that triggers a Reconcile, right?

coderanger:

Sometimes, reconciles can be activated for a lot of reasons

Events, system startup, timer expiration either from a delay request or from an error backoff.

But the point of the design is it doesn't matter, they all work exactly the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment