Secret references
Tell Wardn which secrets a deployment needs, from Kubernetes Secrets or External Secrets Operator, and see whether they are there and whether they changed, without Wardn ever holding the values.
An application needs secrets: a database password, an API key. Wardn is built so that it never needs your values. Instead of holding a secret, a deployment declares that it needs one, by name, and Wardn watches it by reference: is it there, and did it change? A change is detected with a fingerprint, a keyed hash made in your cluster, so Wardn can tell a secret moved without ever seeing what is in it.
That answers two questions that otherwise need the value. Before you restore an old snapshot, has a secret it depends on been deleted or rotated? And is the secret this deployment expects actually in the cluster? Security model puts this in the wider picture.
What Wardn does and does not do
| Wardn does | Wardn does not |
|---|---|
| Record which secrets a deployment needs, by reference | Store, log or send a secret value |
| Have the operator read each secret in your cluster only to hash it, inside one call | Create, rotate or write a secret |
| Keep the fingerprint and status, and compare them over time | Decrypt anything. There is no SOPS or sealed-secret support |
| Show a missing or changed secret in a restore's preflight | Resolve a reference into a value for your app |
A Secret you commit to git is in the snapshot
Declaring a reference does not stop you committing a Secret object. If a Secret with values is in your repository, Wardn renders it into the snapshot like any other object. It masks the values in diffs and drift views, but it stores them. Keep the value out of git: create the Secret in the cluster, or have External Secrets Operator create it from a secret store, and refer to it by name in your Deployment.
Sources
source | locator | What is checked |
|---|---|---|
k8s | A Kubernetes Secret: name, or namespace/name | By the operator: that the Secret exists, and, with a key, that the key does |
eso | An External Secrets Operator ExternalSecret: name, or namespace/name | By the operator: the ExternalSecret's sync condition and refresh time, and the Secret it created |
vault | A Vault path such as kv/data/app/db | By the control plane, not the operator. A known limit; see below |
A locator without a namespace means the deployment's namespace. key narrows a reference to one key of the Secret; left out, the reference covers the Secret as a whole, which means every key.
Declare them
A deployment declares its references as one list. The list replaces the previous one, and the request names secrets, never their values. The web app does not edit references yet; use the API.
api() { curl -fsS -H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' "$@"; }
api -X PUT "$WARDN_API_URL/api/v1/deployments/$DEPLOYMENT_ID/secret-refs" -d '{
"refs": [
{"name": "db-password", "source": "k8s", "locator": "shop-db", "key": "password"},
{"name": "api-key", "source": "eso", "locator": "shop-api"},
{"name": "worker-token", "source": "k8s", "locator": "shop/worker-token", "appId": "'"$WORKER_APP_ID"'"}
]
}'Prop
Type
A deployment can declare up to 100 references. A reference whose source, locator or key changed loses what was found about it until it is checked again.
What each check finds
api "$WARDN_API_URL/api/v1/deployments/$DEPLOYMENT_ID/secret-refs" | jq '.refs[] | {name, source, status, fingerprint}'Each reference has a status and a fingerprint:
| Status | Meaning |
|---|---|
present | It exists (and the key does, if named). The fingerprint is set. |
missing | It does not exist, the key is not in it, the operator may not read it, or nothing has checked it yet. The detail of the check says which. |
stale | It exists but is not being kept up to date. This applies to External Secrets Operator. |
The fingerprint is an HMAC-SHA256 keyed with a salt that is unique to the deployment and the reference, computed where the value lives. The same value in two deployments gives two different fingerprints, so a fingerprint tells nobody anything about the value. A change of value shows as a different fingerprint. The value itself is never returned.
Every reference also has checks, one per reporter: the id of the cluster whose operator looked, or server. A deployment on an environment is checked on each of its clusters, and the reference's own status is the worst of them (missing, then stale, then present). The detail of a check says why and never contains a value, for example The Secret does not exist. or The Secret has no such key.
Kubernetes Secrets
The operator reads the Secret as the deployment's own service account, wardn-deployer, never as itself. That account needs get on the Secret. The built-in admin role has it; with a narrower role, grant it:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: wardn-secret-refs
namespace: shop
rules:
- apiGroups: [""]
resources: ["secrets"]
resourceNames: ["shop-db", "worker-token"]
verbs: ["get"]
- apiGroups: ["external-secrets.io"]
resources: ["externalsecrets"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: wardn-secret-refs
namespace: shop
roleRef: { apiGroup: rbac.authorization.k8s.io, kind: Role, name: wardn-secret-refs }
subjects:
- { kind: ServiceAccount, name: wardn-deployer, namespace: shop }Without the right, the status is missing with the detail The deployment's service account may not read the Secret. The fingerprint of a whole Secret covers every key and value, so it changes if any of them does. An ExternalSecret reference also needs get on the Secret it creates.
External Secrets Operator
For an eso reference, the operator reads the ExternalSecret and the Secret it creates (spec.target.name, or the ExternalSecret's own name). It tries the v1 version of the API and then v1beta1. The status follows from what it finds:
| Finding | Status |
|---|---|
| The ExternalSecret does not exist | missing: The ExternalSecret does not exist. |
| It exists but has not created its Secret | missing: The ExternalSecret has not created its Secret. |
It has not reported a sync, or its Ready condition is not True | stale, with the reason |
Its last refresh is more than two refresh intervals old (the interval is its spec.refreshInterval, one hour if it sets none) | stale: The ExternalSecret has not refreshed within its interval. |
| Otherwise | present |
A stale reference still carries the fingerprint of the Secret that is there, so a restore can see that it has not moved. An ExternalSecret with refreshInterval: 0 syncs once and never goes stale.
A common arrangement is to keep the ExternalSecret manifest in git, since it holds no value, so that Wardn applies it with the rest of the app, and to declare a reference to it. Give it an early wave so it exists before the workloads that read its Secret:
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: shop-api
annotations:
wardn.dev/sync-wave: "-5"
spec:
refreshInterval: 15m
secretStoreRef: { name: shop-store, kind: SecretStore }
target: { name: shop-api }
dataFrom:
- extract: { key: shop/api }The External Secrets Operator and its CRDs must already be installed in the cluster; Wardn does not install them, and an ExternalSecret whose CRD is missing is refused when applied. See External Secrets Operator with Wardn for the full setup.
When they are checked
- With an apply. References are sent to the operator with the deployment's next apply. Changing the declared list alone does not push it; the operator learns of it on an apply, so use Sync now after declaring.
- On a timer. From then on the operator checks every reference about every five minutes and after each apply, and reports the results. Reports hold only names, statuses and fingerprints.
- Vault references are the control plane's to check, when you ask (
POST /deployments/{id}/secret-refs/check, which needsdeployment:manage) and as part of a restore's preflight.
A vault reference that names a store (storeId) is checked through that store's connection, and rechecked every 15 minutes, or at the server Vault's interval when one is configured. A vault reference with no store is checked with the server's own Vault, if WARDN_VAULT_* sets one up; with neither, it is reported missing with the detail This server has no Vault configured.
A store a deployment may not use
Declaring a reference that names a store the deployment is not allowed to use is refused (403 secret_ref.store_scope). Add the deployment's team or environment to the store's Who may use it first.
What it is used for
The first time a reference is read while a snapshot runs, that reading becomes the snapshot's baseline. The restore preflight compares what is there now with the baseline of the snapshot you want to go back to:
| Finding in the preflight | Severity | Meaning |
|---|---|---|
| Secret missing | Blocking | The secret has gone. The old snapshot would start with nothing to read. |
| Secret changed since this snapshot ran | Warning | The fingerprint differs from the baseline. The value was rotated or replaced. |
| Secret out of date | Warning | The reference is stale. |
| Secret not checked | Warning | Nothing has checked it yet. |
A blocking finding stops the restore unless someone with restore:bypass gives a reason. The restore dialog groups these findings under Secrets match. A snapshot's page also lists, under Settings and secrets, what each app held, with secrets as fingerprints. You can run the same comparison yourself:
api "$WARDN_API_URL/api/v1/deployments/$DEPLOYMENT_ID/secret-refs/preflight?snapshotId=$SNAPSHOT_ID" | jq .problemsIt lists problems only, each with a kind (missing, changed, stale or unknown) and, for a change, the fingerprint it was and the fingerprint it is now.
Permissions
| To | You need |
|---|---|
| Read references and run the preflight | deployment:read |
| Declare references, and check Vault ones | deployment:manage |
Next
Secret stores
Connect Vault, a cloud secret manager or a SOPS key, and say who may use it.
External Secrets Operator with Wardn
A complete setup with a secret store behind it.
Restore and rollback
Go back to an earlier snapshot, with the preflight.
Security model
How Wardn handles secrets, commands and access.
Related: Jobs and waves, Deployment settings, Connect a cluster.
Shared deployments
Let several people take turns on one deployment, such as a shared staging namespace, with claims, a waiting line, hand-overs and an end time.
Secret stores
Connect Vault, OpenBao, a cloud secret manager, an External Secrets Operator store or a SOPS key, say which teams, environments and agents may use it, and test it. Wardn keeps references, never values.