Peat gives settings changes their own rollout

2026-11-29来源 dev.toEnglish
Peat gives settings changes their own rollout

Peat now routes restart-causing settings changes through its ordered upgrade machinery even when the release and image stay the same. That is a useful operational change: raising a memory limit can restart a storage process just as surely as replacing its binary. [1]

Peat is a fork of Neon’s serverless Postgres code with its own control layer and Kubernetes operator. The project labels its API alpha. [2] I am looking at a specific operator change here, rather than evaluating the database as a production replacement.

Preview what the API server would apply

For an already-ready platform, the new reconciliation path previews a server-side apply with dryRun=All. It compares the resulting pod template with the live template. [1] The point is to compare the object the API server would produce, including its defaults and field handling, rather than compare only the handwritten configuration.

If a template would change, the operator holds that workload back until its own step. The change follows the established order, with checks around each affected piece and a pageserver drained before its pod is replaced. The state remains in status.upgrade; the source distinguishes a settings change by equal releases and images at both ends. [1][3]

A rollout swimlane keeps the image unchanged. The old pod is ready on template A while the desired template is B, so it waits. A replacement pod on B still waits while unready; only B and ready advances. Drain and restart belong inside the current piece's ordered step.

Original pod-state illustration. The revision names are invented, not observed cluster values. Image by Shivam Dwivedi.

Ready on which template?

The runtime check needs another distinction. A pod can be ready and run the target image while still carrying the previous template revision. The patch checks the pageserver pod’s controller-revision-hash against the StatefulSet’s status.updateRevision, when both revision values are present, as well as checking its image. A stale pod is replaced in that step; the operator then waits for the intended pod to be ready. [1]

Here is a deliberately stricter local fixture: both revision values are always supplied and must match. Save it as demo.py and run python3 demo.py.

target = {"image": "storage@sha256:example", "revision": "template-B"} old_ready = {"image": target["image"], "revision": "template-A", "ready": True} new_waiting = {"image": target["image"], "revision": "template-B", "ready": False} new_ready = {**new_waiting, "ready": True} def caught_up(pod): return (pod["image"] == target["image"] and pod["revision"] == target["revision"] and pod["ready"]) assert old_ready["image"] == target["image"] and old_ready["ready"] assert not caught_up(old_ready) assert not caught_up(new_waiting) assert caught_up(new_ready) for name, pod in (("old-ready", old_ready), ("new-waiting", new_waiting), ("new-ready", new_ready)): print(name, "advance:", caught_up(pod)) 
old-ready advance: False new-waiting advance: False new-ready advance: True 

The first state passes a check that asks only “target image and ready?” It fails the fixture’s actual question: “target image, target revision and ready?” The second has the right revision but has not reached readiness. The third can advance.

This is a truth-table illustration, not a running controller. It does not implement Peat’s treatment of missing revision labels, pod deletion, drain completion or storage checks. The upstream tests exercise the ordered settings path with a fake Kubernetes API; I inspected the patch, rather than running those tests or starting a cluster. [1]

Put the disruption inside the step

Kubernetes documents that an OnDelete StatefulSet does not automatically replace pods when its template changes; replacement is needed to pick up that template. It separately records template history through ControllerRevisions. [4] An operator that controls replacement therefore needs to track both desired configuration and the pod that actually exists.

In Peat’s change, a settings update is not permission to rewrite every workload template at once and merely observe the restarts afterward. The apply itself is held until the corresponding step has passed its precheck and, where required, drain. [1][3] That is the central design choice.

The boundary is narrower than “every config change is an upgrade.” The documentation excludes changes that do not restart a piece, such as certain service, network-rule and ConfigMap updates; a platform that has never been ready also follows installation behavior. A settings halt waits for an explicit retry, and settings can be re-read between steps. [1][3]

For anyone inspecting a similar operator, I would trace when it changes a template, when it replaces the old pod, and what evidence allows the next step. Keeping the image fixed does not make those transitions disappear.

References

  1. Zabaca and Peat contributors, ordered settings change, implementation and tests.

  2. Peat contributors, project overview and alpha status.

  3. Peat contributors, upgrade and settings contract.

  4. Kubernetes documentation, StatefulSet update strategies and revision history.

Asset credits

Original explanatory figure and example, CC BY 4.0. Credit: Shivam Dwivedi. No third-party image assets.

AI disclosure

AI was used to draft the article.

原文:https://www.a8q9.cn/en/article/peat-gives-settings-changes-their-own-rollout-dd9bd3.html

相关文章