How it works
The control plane, the gateway and the operator, how a snapshot is rendered and applied, and exactly what crosses the network.
Wardn has two halves. The control plane decides what should run and keeps the record. The operator, one per cluster, does the work inside the cluster and reports what it sees. They talk over one connection that the operator opens. This page describes how they behave and what they exchange; it does not describe how the server is built inside.
Read Introduction first for the push-to-cluster flow in one screen.
The parts
web app · CLI · API tokens · git host webhooks
│
│ HTTPS
▼
┌─────────────────────────────────────────┐
│ Control plane Postgres │
│ API and web app │
│ rendering, in a sandbox │
│ guardrails and Activity │
│ gateway │
└─────────────────────────────────────────┘
▲
│ one connection, mutual TLS,
│ opened from inside the cluster
┌───────────────────┴─────────────────────┐
│ Your cluster │
│ operator (namespace wardn-system) │
│ applies signed snapshots as each │
│ deployment's own service account │
│ watches health and drift │
└─────────────────────────────────────────┘| Part | Where it runs | What it does |
|---|---|---|
| Control plane | Your infrastructure | Serves the API and the web app, receives webhooks, renders snapshots, checks guardrails, keeps the Activity log. Postgres is its only required dependency. |
| Gateway | Part of the control plane | Accepts the operators' connections, sends them signed commands, and receives their reports. With several replicas, each cluster is held by one gateway and moves to another if that one stops. |
| Operator | wardn-system namespace of each cluster | Applies what the control plane signed, runs jobs, watches what it applied, and reports health, drift and the cluster's inventory. It installs no CRDs. |
| CLI | Your laptop or CI | Registers clusters and installs the operator with your kubeconfig, which it never stores or sends. Answers who you are and what you may do. |
Rendering: from a commit to a snapshot
Rendering happens in the control plane, never in the cluster. The operator only ever receives finished objects.
- The control plane reads the head of the tracked branch itself, rather than trusting the webhook's payload, and skips a commit it has already rendered.
- It fetches the files of the app's source: a directory of a git repository, or a Helm chart from an OCI registry.
- It renders them in a sandbox: a separate process started for one render, with no network access at all, no way to write files, and limits on memory, processor time and output size. A chart or overlay is code written by whoever controls the repository, so it runs where it can hurt nothing.
- It resolves every image tag to a digest, so the snapshot names exactly the image that runs.
- It stores the result as a snapshot. The same commit and values always give the same snapshot.
What the sandbox refuses, because it would reach outside the source:
| Render type | Refused |
|---|---|
| Kustomize | Remote bases (a URL), plugins and generator programs, Helm inflation, paths that leave the repository. |
| Helm | Charts whose dependencies are not in their charts/ directory. Charts that render differently each time (random or time functions), since the same commit must give the same snapshot. |
Helm charts are rendered as helm template --include-crds would, with Helm's default cluster capabilities, so a template that asks the live cluster for something (lookup) gets nothing back. helm test hooks are left out. See Helm charts and Kustomize.
Applying: from a snapshot to the cluster
Before anything is sent, the snapshot passes the render guard and any guardrails. Then:
- The control plane builds an apply command: the snapshot's objects in waves, the deployment's namespace and service account, its jobs, health rules, drift-ignore rules and prune limit. It signs the command and gives it an expiry.
- The command travels down the connection the operator opened. The operator checks the signature against the key it learned when it joined, and refuses anything unsigned, altered or expired.
- The operator applies the objects with server-side apply, impersonating the service account
wardn-deployerin the deployment's namespace. That account's RBAC, which you set, is the limit of what Wardn can change there. - It refuses the whole snapshot if any object is outside the namespace or cluster-scoped. Create namespaces, CRDs and cluster roles yourself, once.
- Waves are applied in order, each waiting for the one before to become ready. Jobs run before the first wave and after the last.
- With prune on, objects that were in the previous snapshot and are not in this one are deleted, but only objects carrying this deployment's
wardn.dev/deploymentannotation, and never more than the prune limit without a person's approval. - The operator reports the result for each object, and the control plane records it.
The operator remembers what it applied in ConfigMaps in its own namespace. After a restart it neither prunes objects it forgot nor reports false drift.
Reporting: from the cluster to you
The operator watches what it applied and the cluster around it, and sends changes in small batches:
- Inventory: nodes, node pools, pods and the Kubernetes version.
- Health of each deployment, with the reason for the worst object. See Health.
- Drift: objects and fields that differ from the snapshot. See Drift.
- Secret references: whether each secret a deployment declared exists, and a fingerprint of its value.
- Cluster churn such as restarts, crash loops, evictions and node changes, which become the cluster's and the deployment's timeline.
- A heartbeat. A cluster that has sent none for two minutes is shown offline.
Reports carry sequence numbers. After a dropped connection the operator resumes where the control plane last acknowledged, or sends its full state if it can no longer fill the gap. Nothing is lost silently.
What crosses the network
| From | To | What | Never |
|---|---|---|---|
| Browser, CLI, CI | Control plane | API calls over HTTPS, with a session or an API token. | |
| Git host | Control plane | Push and pull request webhooks (GitHub App). | |
| Control plane | Git host | Reads of the tracked commits; with the GitHub App, commit statuses and preview deployments. | Pushes to your branches. |
| Control plane | Image registries | Tag-to-digest lookups when rendering, and digest checks in a restore preflight. | |
| Operator | Gateway | One outbound connection over mutual TLS. Up it: inventory, health, drift, apply results, secret fingerprints, timeline events, heartbeats. | Secret values. |
| Gateway | Operator | Down the same connection: signed commands (apply a snapshot, restart a pod), the cluster's settings, and pod logs and terminal streams when a person opens them. | An inbound connection. The cluster accepts none. |
| CLI | Your cluster | Your kubeconfig, used once by wardn cluster connect to install the operator. | The kubeconfig is never stored or sent to Wardn. |
| Control plane | Wardn | A daily count-only usage report, only if you turn telemetry on. | Names, manifests, secrets or any free text. |
The operator needs outbound access to the gateway's address and nothing else from Wardn. It never talks to git, and it never pulls manifests: everything it applies arrived in a signed command.
When a part is down
| What is down | What happens |
|---|---|
| The connection, or the control plane | Clusters keep running what they last had. The operator keeps watching, applies nothing new and prunes nothing, and reconnects on its own with backoff. Deploys wait and resume afterwards. |
| A cluster | Applies for it stay queued. A newer snapshot replaces an older queued one. An apply sent to an offline cluster is not timed out. |
| A gateway replica | Its clusters move to another replica within the lease time, 15 seconds by default. |
| A fact a guardrail needs | The change waits and is retried, and Activity shows that it is waiting. It is never let through on a guess. |
Failures and offline clusters covers this in detail for people who run Wardn.