Health checks
The checks that decide an app is healthy, set once on the app (built-in checks, custom checks in CEL or Lua, HTTP and metric checks), and the watch that follows a release.
A health check says when something Wardn applied is working. Checks belong to the app: you set them once, and they run in every deployment that runs the app. A release or a sync is complete only after its watch passes, the time after it during which the checks are read and none may fail.
Where checks come from
| From | What it is | Set on |
|---|---|---|
| Built in | Rollouts finish, no crash loops, jobs succeed, endpoints ready, persistent volumes bound. They need no setup. | Each app can switch any of them off. |
| Health checks | Custom checks for a kind of object, written once for the organization: in CEL the way Flux writes healthCheckExprs, or in Lua the way Argo CD writes resource.customizations.health. | Operate › Health checks. They apply to every app that has an object of the kind, or to the apps you choose. Each app can switch one off. |
| This app | The app's own HTTP, metric, CEL and Lua checks. | The app's Health tab, Add a check. |
The app's Health tab lists them all with what each reads in the deployment you are looking at (Here now), and a switch per check. The tab also lists the app's other deployments, with how long each watches after a release and what it does when health fails.
Write a custom check
Open Operate › Health checks › Add checks. There are two ways to bring checks in, and nothing is saved until you press Add N checks.
Paste what you already have, as it is written, and choose its format:
- Argo CD (argocd-cm): the
resource.customizations.health.<group>_<kind>keys, each holding a Lua script. Paste the whole ConfigMap or only the keys. - Flux (healthCheckExprs): the list of kinds with
current,inProgressandfailedCEL expressions, from a Kustomization or on its own.
Wardn reads one check for each kind and lists them. A key with a wildcard (*) is refused: write one check for each kind.
CEL, the Flux way
Three expressions over the live object. Wardn reads them in this order: failed, then in progress, then healthy. An object none of them claims is still in progress. The object's status, spec and metadata are variables, and the whole object is data (and object), so a Flux expression runs as it is.
Healthy when: status.conditions.exists(c, c.type == "Ready" && c.status == "True")
In progress when: status.conditions.exists(c, c.type == "Ready" && c.status == "Unknown")
Failed when: status.conditions.exists(c, c.type == "Ready" && c.status == "False")An optional message expression gives the reason shown for an object that is not healthy. Each expression is at most 4,096 bytes and the work it may do is bounded.
Lua, the Argo CD way
A script that gets the object as obj and returns a table with status (Healthy, Progressing, Degraded, Suspended or Missing) and message. Argo CD's scripts run as they are.
hs = {}
if obj.status ~= nil and obj.status.succeeded ~= nil and obj.status.succeeded > 0 then
hs.status = "Healthy"
hs.message = "Migration finished"
elseif obj.status ~= nil and obj.status.failed ~= nil and obj.status.failed > 0 then
hs.status = "Degraded"
hs.message = "Migration failed"
else
hs.status = "Progressing"
end
return hsSuspended counts as healthy. Scripts run in a sandbox in the operator: only the base, table, string and math libraries are there, with no os, io, require, load or dofile, string.rep is removed, a script may run for 250 ms, and its stacks are bounded. A script that breaks a limit, does not compile, or returns no status reads as unknown, with the reason.
The app's own checks
| Kind | Reads | Healthy when |
|---|---|---|
| HTTP | A request from inside the cluster to a Service of the deployment (GET or HEAD). | The expected status (or any 2xx) comes back within the time, and it has not failed the set number of times in a row. |
| Metric | A query to the organization's metrics provider. | The value is below, or above, the threshold. |
| CEL, Lua | An object kind, as above, for this app only. | As above. |
A metric check with no metrics provider set up, or one that cannot answer, shows Not checked. It is never counted as a pass and never as a failure.
The watch
After each wave of a release, and after a sync, the app's checks are read for a set time. A release is complete only after its watch passes.
- Watch after each wave and If health fails are set on the stage (Health after release in the stage editor): 5, 10 or 30 minutes, and Pause and open an incident or Roll back. A stage that says nothing watches for 10 minutes and pauses.
- A deployment can change both in its app's Settings › Health.
- If a check fails during the watch, a release pauses on that wave and an incident opens, or the wave is rolled back. A sync that fails its watch opens an incident or rolls back to the last snapshot that applied.
- While a release carries a deployment, the release's waves watch it, so the deployment gets no second watch.
A stage with no qualification rules qualifies a snapshot on the built-in checks and a 10-minute soak.
API
GET /apps/{appId}/health returns an app's checks (with deploymentId for what each reads there). PUT /apps/{appId}/health/switches turns one on or off for every deployment of the app. The app's own checks are under /apps/{appId}/health/checks, the organization's under /health-checks, and POST /health-checks/parse and the two try endpoints change nothing. An app's checks are read with app:read and changed with app:manage on the app; the organization's library is read by anyone signed in and changed with org:manage.
Jobs and waves
The order Wardn applies objects in, how to run a migration or smoke test before or after an apply, and what a failure, a timeout or a rollback does.
Health rules
How Wardn decides a deployment is healthy, and how to write CEL rules for custom resources that Kubernetes has no standard readiness for.