Deployment settings
Every setting of a deployment, where it runs, how snapshots arrive, observe only, pruning and the prune limit, the drift policy, and how to change them.
A deployment puts one or more apps in a namespace on a cluster, or on every cluster of an environment, and says how new snapshots reach it. This page lists each setting, what it does and where to change it. Deploy your first app creates a deployment step by step.
Settings come in two groups, and the web app keeps them apart. How it changes (arrival, prune, observe) is the deployment itself. Delivery settings (jobs, drift policy, pull request previews and the prune limit) are saved together with the Save delivery settings button on the same Settings tab, and through one API call.
The deployment
Prop
Type
Where to see and change each setting: on a deployment's page, the Settings tab shows How it changes (the rows Name, App, Runs on, Cluster or Environment, Namespace, Snapshots arrive, Branch, Prune and Observe only), then the delivery sections, then Held prunes when there are any, and a Danger zone with Delete deployment. The app and where it runs are fixed when you create the deployment; the rest can change, with Save. Through the API, GET /api/v1/deployments/{deploymentId} reads the deployment and PUT replaces it, both under deployment:manage for the write.
The rest of this page goes through the settings that need explaining.
Where it runs
A deployment on a cluster applies there. A deployment on an environment is applied to each cluster of that environment, with one apply per cluster, and its sync and health are the roll-up of theirs: it counts as applied when every cluster has applied it, and its health is the worst of theirs. GET /deployments/{id}/state returns the clusters array with each cluster's own state. Environments and many clusters covers environments.
The namespace is where objects land. Objects in a snapshot that name another namespace, or that are cluster-scoped, make the operator refuse the snapshot. The namespace also needs the wardn-deployer service account and a role for it (Connect a cluster), and the cluster's settings must allow the namespace (Which namespaces Wardn may manage).
How snapshots arrive
arrival decides where a deployment's snapshots come from.
| Arrival | Web app label | Meaning |
|---|---|---|
branch | Automatic | A new snapshot on every push to the branch, rendered from the commit the branch points at. This is sync on push; see Connect a source. |
request | By request | A snapshot only when a person asks for one, or when a pipeline promotes one in. Pull request previews use it. |
Promotion is a pipeline's job, not a deployment setting: a pipeline moves the exact snapshot from one stage to the next, and nothing is rendered again. Every snapshot that lands passes the arrival checks.
A deployment in the first stage of a pipeline follows its own arrival, and a deployment in a later stage takes promotion from the stage, and the Settings tab of an app in the deployment says so (Set by the ... stage).
With several apps, branch is the default branch for all of them, and an app can follow a branch of its own (Apps).
Retry or re-apply
Sync now, on an app's page within the deployment, queues the snapshot the deployment wants (or the one it runs, if it wants none) again through the normal path. Use it to retry an apply that failed.
api() { curl -fsS -H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' "$@"; }
api -X POST "$WARDN_API_URL/api/v1/deployments/$DEPLOYMENT_ID/sync"It answers 409 while an apply is queued or running, and when the deployment only observes. It needs deployment:sync and writes an Activity entry.
Observe only
A deployment with observe on renders, stores snapshots and compares them with the cluster, but nothing is ever applied: not a push, a sync, a promotion, a restore or a rollback. It is a safe way to see what Wardn would do before it does it.
- Adopting a namespace. A cluster's Deployments tab lists namespaces that hold pods and that no deployment accounts for. Adopt opens the new-deployment form filled with that cluster and namespace, arrival On request and Observe only on.
- Turning it off (the Automated sync switch on an app's Settings tab, or Observe only on the deployment) makes Wardn apply from then on. It is recorded in Activity.
- An observing deployment only detects drift, whatever its drift policy says.
Prune
With prune on, an apply deletes the objects that the previous snapshot had and this one does not. Without it, those objects stay in the cluster.
| Setting | Meaning |
|---|---|
| Prune on the deployment | Organization default, On or Off (prune null, true or false). |
| Organization default | PUT /api/v1/deployment-settings with {"pruneDefault": true}, needing org:manage. It is off until set. The web app does not edit it yet. |
Wardn deletes only objects that carry the annotation naming this deployment. An object that lacks it is left alone and reported as not owned.
The prune limit
A bad commit can drop most of a deployment's objects. Two guards stand in its way, and they are separate:
| Render guard | Prune limit | |
|---|---|---|
| Acts | Before anything is applied, on the new snapshot | During an apply, on the delete step |
| Trigger | The render has no objects, or lacks more than half of the last approved snapshot's objects | An apply would delete more than the limit of the deployment's objects |
| Setting | Fixed at 50% | Prune at most (maxPrunePercent), default 50 |
| Result | The snapshot is stored and held; nothing is applied | The objects in the snapshot are applied, and nothing is deleted |
| Decision | Release or discard the snapshot (snapshot:signoff) | Approve prune or Reject the held prune (deployment:sync) |
A prune of three objects or fewer is never held, and neither is the removal of everything that a preview's teardown does. maxPrunePercent 0 means the default of 50.
A held prune lists the objects it would remove. On the Settings tab, Held prunes shows Prune held with the reason and the objects, and Approve prune or Reject. Approving sends the same snapshot again with the hold lifted, once. A later successful apply closes an old held prune as superseded.
api "$WARDN_API_URL/api/v1/deployments/$DEPLOYMENT_ID/held-prunes?open=true"
api -X POST "$WARDN_API_URL/api/v1/deployments/$DEPLOYMENT_ID/held-prunes/$HELD_PRUNE_ID/approve"
api -X POST "$WARDN_API_URL/api/v1/deployments/$DEPLOYMENT_ID/held-prunes/$HELD_PRUNE_ID/reject"Drift policy
What Wardn does when the cluster changes outside Wardn. It applies to the whole deployment.
| Mode | Web app label | Meaning |
|---|---|---|
detect | Detect only | Record and show drift. The default. |
revert_after | Revert after 1h | Revert what still differs a set time after it was found: 60 to 86,400 whole seconds (revertAfterSeconds). The web app offers 15 minutes, 1 hour, 4 hours and 1 day under Revert after. |
revert | Revert at once | Revert as soon as drift is found. |
A revert is the same action as Revert on the Drift tab, run as the system and recorded in Activity. An observing deployment only detects.
Change settings through the API
Settings other than the deployment itself are one document: PUT /deployments/{id}/settings replaces every group at once, and takes effect with the next apply (the drift policy with the next drift found). Read, change what you need and write back:
api "$WARDN_API_URL/api/v1/deployments/$DEPLOYMENT_ID/settings" \
| jq 'del(.delivery.updatedAt) | .delivery.maxPrunePercent = 30 | .drift = {"mode": "revert_after", "revertAfterSeconds": 3600}' \
| api -X PUT "$WARDN_API_URL/api/v1/deployments/$DEPLOYMENT_ID/settings" -d @-{
"delivery": { "maxPrunePercent": 30, "beforeJobs": [], "afterJobs": [], "healthRules": [] },
"previews": { "enabled": false, "maxPreviews": 5, "ttlHours": 72, "githubStatus": true, "githubDeployment": true, "forkLabel": "wardn:preview" },
"drift": { "mode": "revert_after", "revertAfterSeconds": 3600 }
}A deployment that has never set any gets the defaults above. Because the call replaces everything, always send the groups you did not mean to change back as you read them, or you will erase them. The groups have their own pages: delivery.beforeJobs and afterJobs in Jobs and waves, delivery.healthRules in Health rules, and previews in Pull request previews. Saving from the web app writes an Activity entry.
Delete a deployment
Delete deployment on the Settings tab (or DELETE /api/v1/deployments/{deploymentId}) stops Wardn tracking and applying the deployment. Its history is kept. A deployment that others take their snapshots from cannot be deleted.
Permissions
| To | You need |
|---|---|
| See a deployment, its state and its settings | deployment:read |
| Create a deployment | deployment:manage on the cluster or environment, and read access to each app |
| Change a deployment, its apps and its settings; move it | deployment:manage (and on the new place, when moving) |
| Sync now; approve or reject a held prune | deployment:sync |
| Release or discard a held snapshot | snapshot:signoff |
| Set the organization's prune default | org:manage |
Next
Held snapshots
What the render guard holds, and how to release or discard it.
Jobs and waves
Run a migration before an apply and control the order of objects.
Drift
Adopt, revert or ignore what changed in the cluster.
Related: Deployments, Sync and arrival, Restore and rollback, Access model.