Runtime Operator
Signed workload identity leases
For hosts embedded with workload credentials and a lease verifier, configure the operator with
--workload-identity-config=/etc/wasmcloud/identity-leases.json.
The configuration and private key are operator-controlled files, such as read-only Secret mounts.
They are loaded at startup; changing policy or signing keys requires an operator restart.
The signing key is an Ed25519 private key in PKCS#8 PEM format.
A relative key path is resolved against the configuration directory.
{
"key_id": "operator-2026-12",
"private_key_file": "lease-key.pem",
"identities": [
{
"namespace": "payments",
"identity": {
"identity_ref": "api",
"approved_digests": ["sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"],
"jwt_audiences": ["sts.amazonaws.com"],
"ingress_hosts": ["api.example.com"]
}
}
]
}
Replace the example digest with the SHA-256 digest of each approved component's uncompressed Wasm bytes.
An OCI manifest digest is not a component digest.
Policies use the generated WorkloadIdentity JSON field names and may also set mtls_destinations.
A workload's spec.identityRef.name selects a policy within its namespace.
Missing policy refuses placement; the operator never takes approved digests from control-plane messages or workload annotations.
Kubernetes RBAC and admission policy must restrict who can grant an identity through workload specs.
Embedded operators can instead set EmbeddedOperatorConfig.IdentityLeases with workloadidentity.NewSigner.
The operator signs a ten-minute compact JWS for the selected host, workload UID, and verified owner's kind, name and UID.
Signing requires hosts that advertise both verified workload owners and runtime.wasmcloud.dev/verifies-identity-leases=true.
The host derives this label from its configured verifier; signing-enabled placement skips incompatible hosts, including DaemonSet instances.
For a mixed-fleet rollout, configure verifiers and keys on hosts first, then enable operator signing.
The host checks the signed owner against the start message and keeps that owner fixed during renewal.
It reserves increasing sequences with optimistic Kubernetes writes before sending starts or renewals,
and renews running workloads every two minutes, including when healthy polling is configured longer.
The sequence, renewal deadline and pending acknowledgement live in status.identityLease, protected by separate workloads/status RBAC.
Tenant annotation edits do not change signing progress.
The host retains the highest accepted sequence for one hour plus 60 seconds after release to refuse replayed starts.
This replay-protection state is in memory and is lost when the credentials store is recreated or the host restarts.
A durable pending marker keeps a refused or interrupted renewal unhealthy during its retry delay; only a successful host acknowledgement clears it.
A stopped, deleted or unsynced workload receives no further lease renewal.
Grant policy is fixed at host bind time; changing approved digests or identity requires a new workload start.
The issuer receives the authenticated JWS as its scheduling token and must support that format.
Configure matching public keys on the host's Ed25519LeaseVerifier before enabling signing.
Preload old and new public keys during rotation; the operator emits the configured key_id in the protected header.
The shipped wash binary does not install workload credentials; this configuration serves embedding hosts that do.
When signing is disabled, the existing identity-ref forwarding behavior is retained.
The signed lease covers identity assignment only.
Workloads without spec.identityRef receive no lease and retain the existing trust in control-plane NATS publishers.
Config, secret grants, allowedHosts, volumes, JWT audiences, ingress hosts and mTLS destinations stay unsigned, including on identity-bearing starts.
The lease contains no digest of those fields; it is not proof that the complete start specification is unchanged.
Continue protecting NATS publishing credentials and enforcing RBAC and admission policy for these grants.
NATS authentication
The operator and its hosts share one NATS control plane. On a NATS that
requires authentication, the operator presents one of:
| Flag |
Credential |
-nats-creds |
a .creds file (user JWT and nkey seed) |
-nats-nkey |
a file holding an nkey seed |
-nats-token-file |
a file holding a token |
-nats-user, -nats-password-file |
a user name, and a file holding its password |
The operator refuses to start with more than one of these, and requires
-nats-user and -nats-password-file together. The NATS client would send
every credential it is given, and the server authenticates with only one.
Credentials, token, and password files are reread on every connect. When the
server rejects the operator's credential, as when the server rotates a token
before the kubelet refreshes the mounted Secret, the operator keeps
reconnecting with whatever the file holds until the server accepts it.
If the server is still refusing it after -nats-auth-failure-grace (five
minutes by default, longer than the kubelet takes to refresh a Secret),
liveness fails so Kubernetes restarts the operator and the refusal shows.
Token and password files may end with one LF or CRLF line ending, which is
removed. All other whitespace is preserved.
Restart the operator after replacing a bare nkey seed: the NATS client
caches its public key when building the connection options. Repeated auth
rejections close a bare-nkey connection and fail liveness so Kubernetes can
restart the operator with the new key.
-nats-name sets the connection name, runtime-operator by default.
Helm Secret mounts
Set operator.volumes and operator.volumeMounts to mount an existing
Kubernetes Secret, then pass the matching file flag in operator.extraArgs.
For a Secret named operator-nats-auth with a token key:
operator:
extraArgs:
- "-nats-token-file=/nats-auth/token"
volumes:
- name: nats-auth
secret:
secretName: operator-nats-auth
volumeMounts:
- name: nats-auth
mountPath: /nats-auth
readOnly: true
Mount the Secret directory without subPath so Kubernetes can refresh its
files. These mounts work with global.tls.enabled set to either value and
coexist with the chart's TLS certificate mount. The Secret must exist in the
operator's release namespace. Hosts need their own NATS credentials.
Host NATS authentication
Hosts authenticate their scheduler and data connections separately, with the
same choice of one credential per connection:
Flag (scheduler or data) |
Credential |
--<plane>-nats-creds |
a .creds file (user JWT and nkey seed) |
--<plane>-nats-nkey |
a file holding an nkey seed |
--<plane>-nats-token-file |
a file holding a token |
--<plane>-nats-user, --<plane>-nats-password-file |
a user name, and a file holding its password |
Each flag also reads WASH_<PLANE>_NATS_<NAME>, such as
WASH_SCHEDULER_NATS_CREDS. Files are reread on every reconnect, and token
and password files lose one LF or CRLF line ending. While a file stalls, fails
to read, or does not parse, the host presents the last contents that parsed.
--<plane>-nats-jwt-as-token sends a .creds file's user JWT a second time,
as the token. A NATS server without trusted operators drops the JWT before
an auth callout sees it, so a callout that authorizes by JWT reads this copy.
Give each connection its own credential, so the data connection can be denied
the control subjects under Permissions. Mount the Secret on a
host group and pass the flags in its extraArgs. The Secret must exist in the
host group's namespace:
runtime:
hostGroups:
- name: default
extraArgs:
- "--scheduler-nats-creds=/nats-auth/scheduler.creds"
- "--data-nats-creds=/nats-auth/data.creds"
volumes:
- name: nats-auth
secret:
secretName: host-nats-auth
volumeMounts:
- name: nats-auth
mountPath: /nats-auth
readOnly: true
The host refuses workload volumes that expose these files.
Permissions
<id> is a host's id. A heartbeat's payload ID must match its subject's
ID. An existing Host name cannot be claimed by a different ID; remove the
old Host before reusing its name with a new ID. These checks rely on NATS
permissions restricting each host to its own heartbeat subject.
The operator's replies arrive on its inbox prefix,
_INBOX unless -nats-inbox-prefix sets another.
| Client |
Publish |
Subscribe |
| Operator |
runtime.host.> |
runtime.operator.heartbeat.>, <inbox-prefix>.> |
| Host, scheduler connection |
runtime.host.<id>.__control.ready, runtime.operator.heartbeat.<id>, and replies (allow_responses with max: 1, or <inbox-prefix>.>) |
runtime.host.<id>.> |
A host's scheduler connection must also receive its own messages, which is
the NATS default. Its data connection carries workload traffic and needs
none of the subjects above; deny it runtime.>.
Any client that may subscribe to _INBOX.> can read the replies hosts send
the operator, and any client that may publish there can forge one. On a NATS
shared with other clients, set -nats-inbox-prefix to a subject only the
operator may subscribe to, such as runtime.operator.inbox, and allow hosts
to reply there or by allow_responses.
Set wash host --host-id <id> or WASH_HOST_ID to match a credential's
permitted host ID. IDs must contain 1–128 ASCII letters, digits, _ or -
and must be unique among running hosts. The default remains a random UUID
chosen at startup, which needs a credential issued for that ID. With one
credential per host group, use * for <id>: those hosts can then read
each other's commands and publish each other's heartbeats, though only the
operator can send commands.
Logging
The operator and the gateway both configure Go's log/slog and controller-runtime's
logr bridge through pkg/logging, so they accept the same flags. Logs go
to stderr. Development mode defaults to text output, debug logging (controller
verbosity 1), RFC3339 timestamps, and stack traces at warn and above. Use
--dev-mode=false for JSON output, info logging, and stack traces at error and
above. Text output uses slog's key=value format; JSON keeps ts, level, msg,
logger, error, and stacktrace fields. User fields named time keep their
name. Production logging is unsampled.
Kubernetes object pointers, passed directly or through logr.Marshaler, are
logged as identity in every mode, including the default Helm deployment. Full
contents, including Secret data, require an explicit --log-full-objects flag.
Objects passed by value, or nested in slices, maps, or other structs, are not
redacted.
| Flag |
Values |
--log-full-objects |
Include full Kubernetes objects; defaults to false |
--log-format |
text, json |
--log-level |
debug, info, warn, error, panic, or verbosity 1–127 |
--log-stacktrace-level |
info, warn, error, panic |
--log-time-encoding |
epoch, millis, nanos, iso8601, rfc3339, rfc3339nano |
Explicit logging flags override mode defaults regardless of argument order.
--json-log overrides format and timestamp flags with JSON and numeric epoch
seconds. The existing --zap-devel, --zap-encoder, --zap-log-level,
--zap-stacktrace-level, and --zap-time-encoding flags remain aliases;
--zap-encoder=console selects text output. If an alias and its new flag both
appear, the last one wins. panic sets a threshold above error; logging does
not itself panic. Controller records include a numeric v field. Standard
library HTTP server diagnostics are logged at error without application stack
traces. Application stack traces start at the log call. In text output a stack
trace is a single escaped stacktrace="…\n\t…" value.
Host cleanup
The workload-host controller reconciles live Hosts. Deleting Hosts are handled
by workload-host-cleanup, whose two workers share a limit of 24 concurrent
Workload deletes. Cleanup has its own queue so overlapping Host removals cannot
occupy the workers that make replacement Hosts Ready.
A cleanup error retains the Host finalizer and retries through the cleanup
queue. Cleanup also resumes for deleting Hosts after an operator restart.
Deletes check object identity and resource version; a stale Host deletion
decision must be reconciled again against the current Host.
Heartbeat status writes also check resource version so an old probe cannot
overwrite a replacement Host's status.
Scaling and cleanup
Workload starts and cleanup each run in their own controller, so slow pulls and
stops do not occupy the workers that select hosts and monitor live workloads.
The live and start pools each have --workload-concurrency workers.
Starts rotate between namespaces, with per-namespace FIFO ordering.
On shared hosts, admission to each host's start slots also rotates namespaces;
retries cannot bypass another namespace's queued turn while the woken waiter claims
its slot within a short grace period.
All queues yield when a host has reached its concurrency limit.
A shared per-object guard prevents a start
and finalization from overlapping, and placement checks current API state before
sending Start. Host selection remains a durable status checkpoint before that RPC.
The standalone operator exposes these bounds through flags; embedded callers
can set the corresponding fields on EmbeddedOperatorConfig:
| Flag |
Default |
Purpose |
--workload-concurrency |
8 |
Workers in each of the live and start Workload pools |
--workload-cleanup-concurrency |
16 |
Workload cleanup workers |
--workload-host-concurrency |
2 |
Concurrent reconciliations per host, separately for live passes, starts and cleanup |
--replica-batch-size |
64 |
Creates or deletes per ReplicaSet scaling or cleanup batch |
--replica-concurrency |
8 |
Concurrent API mutations within a ReplicaSet batch |
--ready-requeue-interval |
0 |
Healthy-object polling interval; zero retains controller defaults |
ReplicaSet scaling rechecks the parent through an uncached read before each
batch. Deletes retain UID and resourceVersion preconditions. A delete that
conflicts because the cache was stale rereads the child uncached: one already
deleting or replaced counts as deleted, and one that changed while live is left
for the next pass to choose again. Scale-down and cleanup remove unavailable
children first, then a deterministic prefix by name, and count terminating
children as already selected, so retries do not choose extra victims. Each
cleanup pass deletes at most one batch: unhealthy-child cleanup waits while
previous revisions still need more than one batch. Operator-created
Workloads carry their cleanup finalizer from creation. Failed stops on Ready
hosts retain the finalizer and back off together.
An explicit stop rejection retains the finalizer regardless of Host readiness.
After a failed stop, queued
cleanup on a Host that is missing or not available (failed, or Unknown after
missed heartbeats) uses the existing unavailable-host cleanup policy without
repeating the timeout.
Before releasing a finalizer after any unconfirmed deletion stop, the operator
persists a pending-stop ConfigMap in its own namespace.
If that write fails, deletion retries with the finalizer intact.
A separate controller replays stops for the original Workload UIDs when the host
becomes available, removing each record only after a successful stop RPC.
These records survive operator restarts, Host removal, and tenant namespace deletion.
Missing Hosts and terminating Pods do not prove that the host process stopped.
Unconfirmed records remain until a stop is acknowledged or an administrator removes them.
Missing hosts are probed every five minutes; retired hosts can acknowledge stops
without being registered for new placement.
Eviction records also gate a later start of the same Workload UID on the same host,
so an old stop completes before that ID is reused.
Start and replay decisions read records uncached and share a lock.
A confirmed stop wakes the waiting placement.
Suppression alone never authorizes that shortcut for a Ready Host. A cancelled
reconcile or a failed Host lookup does not count as a failed stop.
Child and route events coalesce over 100 milliseconds without extending the
deadline when new events arrive; initial-list events keep their low priority on
controller-runtime's priority queue. Routes omit terminating workloads, resolve
each host once per pass, and use EndpointSlices of at most 100 endpoints.
Existing slice membership is preserved when endpoints disappear. The route
controller manages slices that carry its label or that the Service controls
without another controller's endpointslice.kubernetes.io/managed-by label, and
watches them: a slice that loses its label is adopted and repaired, and an
endpoint a pass published twice against a stale cache is deduplicated when the
new slice reaches the cache.
Hosts supporting workload.status.batch answer up to 128 status queries in one
RPC. The operator groups assignments with a local host/bucket index and reuses
observations for at most 30 seconds. Observations predating placement are ignored;
missing or mismatched response entries invalidate the batch. These are bounded
request/reply observations, not an atomic fleet snapshot. Operator restart drops
the cache and rebuilds it from fresh queries. Hosts that do not answer, or return
an invalid response, use the existing individual status RPC; batch capability is
retried after one minute. When a host that answered batches before stops
answering, that Sync fails without a second timeout and the host is probed
again on the next one, so a host rolled back to a release without batch support
falls back instead of failing until its support record expires. An unsupported
batch probe can add up to one second before fallback; sharing observations can add up to 30 seconds to failure
detection beyond the configured polling interval. Individual start/stop
confirmations remain uncached.
The runtime applies the normal status handler to every batch entry, including
custom authorization. Requests are limited to 128 IDs of at most 128 bytes each;
diagnostic messages in batch replies are truncated to 1 KiB at a UTF-8 boundary.
The existing query admission limit also applies to batch requests, and the
lookups of every batch on a host share one pool the size of that limit (64), so
batching neither multiplies the status handler calls in flight nor runs a full
batch slower than the same lookups sent individually.
Use controller-runtime queue/worker metrics and API-server request metrics to
tune these limits. Measure traffic withdrawal, actual runtime cleanup, and
Kubernetes object removal separately: a successful stop acknowledgement can
precede the runtime's background cleanup. Increasing concurrency does not remove
the per-object API writes or establish capacity for 100,000 workloads.
Development
You will need a local Kind cluster, NATS, and a Wash host.
For NATS, use:
docker run --rm --name wasmcloud-nats -p 4222:4222 nats -js
For Wash Host, use:
wash host --http-addr 127.0.0.1:8000
or from the top git directory:
cargo run -- host --http-addr 127.0.0.1:8000
For local kind cluster, refer to wash/README.md.
Install the CRDs into the cluster:
make install
Run the operator with formatted JSON logs:
make devlog
Restart the command after changing the source.
Use make run to run the operator with its default logging settings.
You can apply development samples from the config/sample:
kubectl apply -f config/samples
Verify the Wash Host registered correctly with:
kubectl get host
Example:
❯ kubectl get host
NAME HOSTID HOSTGROUP READY AGE
exotic-toes-5866 14b0a1df-3f91-441c-b304-2aa56e9bef6e default True 52s
If you applied the samples, check if they deployed correctly:
❯ kubectl get workloaddeployment
NAME REPLICAS READY
blobby 1 True
hello 1 True
❯ curl -i hello.localhost.direct:8000
HTTP/1.1 200 OK
transfer-encoding: chunked
date: Tue, 25 Nov 2025 15:30:32 GMT
Hello from Rust!