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            │
 └─────────────────────────────────────────┘
PartWhere it runsWhat it does
Control planeYour infrastructureServes the API and the web app, receives webhooks, renders snapshots, checks guardrails, keeps the Activity log. Postgres is its only required dependency.
GatewayPart of the control planeAccepts 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.
Operatorwardn-system namespace of each clusterApplies what the control plane signed, runs jobs, watches what it applied, and reports health, drift and the cluster's inventory. It installs no CRDs.
CLIYour laptop or CIRegisters 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.

  1. 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.
  2. It fetches the files of the app's source: a directory of a git repository, or a Helm chart from an OCI registry.
  3. 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.
  4. It resolves every image tag to a digest, so the snapshot names exactly the image that runs.
  5. 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 typeRefused
KustomizeRemote bases (a URL), plugins and generator programs, Helm inflation, paths that leave the repository.
HelmCharts 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:

  1. 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.
  2. 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.
  3. The operator applies the objects with server-side apply, impersonating the service account wardn-deployer in the deployment's namespace. That account's RBAC, which you set, is the limit of what Wardn can change there.
  4. It refuses the whole snapshot if any object is outside the namespace or cluster-scoped. Create namespaces, CRDs and cluster roles yourself, once.
  5. Waves are applied in order, each waiting for the one before to become ready. Jobs run before the first wave and after the last.
  6. 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/deployment annotation, and never more than the prune limit without a person's approval.
  7. 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

FromToWhatNever
Browser, CLI, CIControl planeAPI calls over HTTPS, with a session or an API token.
Git hostControl planePush and pull request webhooks (GitHub App).
Control planeGit hostReads of the tracked commits; with the GitHub App, commit statuses and preview deployments.Pushes to your branches.
Control planeImage registriesTag-to-digest lookups when rendering, and digest checks in a restore preflight.
OperatorGatewayOne outbound connection over mutual TLS. Up it: inventory, health, drift, apply results, secret fingerprints, timeline events, heartbeats.Secret values.
GatewayOperatorDown 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.
CLIYour clusterYour kubeconfig, used once by wardn cluster connect to install the operator.The kubeconfig is never stored or sent to Wardn.
Control planeWardnA 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 downWhat happens
The connection, or the control planeClusters 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 clusterApplies 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 replicaIts clusters move to another replica within the lease time, 15 seconds by default.
A fact a guardrail needsThe 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.

Next

On this page