Failures and offline clusters

What keeps working, what waits and what to do when a cluster, a replica, the database or the whole control plane is down.

Wardn is built so that losing the control plane never stops your workloads. Your clusters run what they were last given, and Wardn catches up when the parts come back. This page goes through each failure: what you see, what keeps working and what to do. How it works explains the parts.

At a glance

What is downYour workloadsDeploysWhat you see
One cluster's connectionKeep runningWait for that clusterThe cluster is offline
One server replicaKeep runningContinue; its clusters move within 15 secondsBrief reconnects
The whole control planeKeep runningStop, and resume when it is backThe web app and API are unavailable
The databaseKeep runningStop/api/v1/ready fails; the API answers errors
The web app onlyKeep runningContinueThe interface is unavailable, and so is the API at the public address, because the web app forwards /api/v1 to the server

A cluster loses its connection

The operator dials out and holds one long-lived connection to the gateway. When the connection breaks, because of the network, the gateway or the cluster:

  • The operator keeps working. It keeps its last settings and everything it applied keeps running. It goes on watching the cluster and keeps what it sees in a bounded local buffer: 50,000 changes or 32 MiB, whichever comes first.
  • It reconnects by itself, with jittered backoff, and resumes from the last batch Wardn acknowledged. If the buffer no longer holds the gap, or it overflowed, the operator sends the full state instead. Nothing is lost silently: a forced full resync is recorded in Activity as cluster.resync.
  • The cluster shows as offline when it is not connected or has not sent a heartbeat for two minutes.
  • Applies wait. A snapshot for an offline cluster stays queued, and a newer snapshot replaces an older queued one, so the cluster gets the latest when it is back. A command that was sent but not answered is not timed out while the cluster is offline; it is sent again when the cluster reconnects.
  • Commands expire. Every command Wardn sends carries an expiry and a signature. An expired command is not applied, so an old instruction never runs late.

When the cluster is online but its operator does not answer an apply within WARDN_APPLY_TIMEOUT (10 minutes by default), the apply is marked failed.

Long outages

An operator's connection uses a stream token that Wardn renews every hour while it is connected. An operator that stays away longer than the token's lifetime (six hours) may need a new join token. Re-run the connect command for that cluster:

wardn cluster connect --cluster-id <cluster-id> --gateway-url https://gateway.example.com:8443

The operator keeps the same identity.

Paused and disconnected clusters

A cluster that someone paused in Wardn stays connected and reporting, but applies nothing until it is resumed. A cluster that was disconnected (wardn cluster disconnect) has had its credentials revoked: the gateway refuses it until it gets a new join token and joins again.

A server replica stops

In wardn-standard, every replica runs every role.

  • API. The other replicas keep answering behind the wardn-server Service. The PodDisruptionBudget keeps all but one replica up during a node drain.
  • Gateway. Each cluster is held by one replica with a lease. When that replica stops, its clusters move to another within WARDN_GATEWAY_LEASE_TTL (15 seconds by default). Their operators reconnect, and the new holder takes the lease.
  • Terminals and log streams held by that replica end, because their stream to the operator ends. Open them again.
  • Periodic tasks that the stopped replica was running are taken over by another replica.

The whole control plane is down

From the clusters' side this looks like a long network outage. Operators keep running what they applied and keep retrying. No deploys happen while it is down, and they resume afterwards. Nothing is applied that the control plane did not sign, so an operator cannot be talked into anything while Wardn is away.

Pushes to tracked branches are not lost either: when the control plane is back, each tracked branch is looked at again within WARDN_SYNC_POLL_INTERVAL (one minute by default), so a webhook GitHub sent while Wardn was down only delays the deploy.

The database is down

Every replica depends on Postgres. While it is unreachable:

  • /api/v1/ready and /readyz answer 503, so load balancers take replicas out of rotation. /livez keeps answering 200: a database outage is not a reason to restart a healthy process.
  • The API cannot serve requests, and no snapshots are rendered or applied.
  • Operators keep running what they applied, as above.

When the database is back, replicas become ready again by themselves. If it was restored from a backup, read Backup and restore for what to check.

The keys are missing or wrong

ProblemEffect
WARDN_SECRET_MASTER_KEY unsetThe secret store stays closed. The gateway cannot run, so no cluster can connect, and stored credentials cannot be read.
WARDN_SECRET_MASTER_KEY changedSecrets stored with the old key cannot be opened. Put the old key back.
BETTER_AUTH_SECRET differs between the server and the web appThe server cannot check the sessions the web app makes, so signed-in people are refused by the API. Give both the same value.
BETTER_AUTH_SECRET too short with APP_ENV=productionThe server does not start. It needs at least 32 characters.

The server does not start

The server checks every setting before it starts and stops with a list of every problem found, such as:

invalid configuration:
  - POSTGRES_URL is required
  - WARDN_GITHUB_APP_SLUG is required with WARDN_GITHUB_APP_ID
  - WARDN_APPLY_TIMEOUT: want a duration of at least 10s, such as 10m

Fix each line and start it again. Configuration lists every setting and its limits.

Next

On this page