Reeve Docs

Docs / Architecture

Workloads

A workload is a container a plugin declares and Reeve deploys beside the backend: a protocol sidecar pinned to a radio, a camera restreamer, a per-node scanner. The plugin half stays in process; the workload half runs where the hardware or the heavy runtime is. Which integrations take this shape, and why it is topology rather than a trust boundary, is in constraints.

The workload library (Reeve.Workloads) owns the manifest grammar, the providers, the reconciler and the update pipeline. Reeve, as its host, owns the gateway, the workload token, the reeve manifest extension, the adapter-session health mode, consent, and the plugin swap at the end of an update (constraints).

Three providers, one manifest

Provider Targets Notes
kubernetes in-cluster, or a remote cluster by saved kubeconfig the multi-node answer
docker one local daemon socket a single backend instance; a clustered host refuses it
manual nothing; Reeve renders artifacts, the operator runs them needs an externally reachable gateway URL

One active provider per installation, overridable per instance. All three consume the same typed manifest. A manifest feature a provider cannot honour (HTTP health probes, per-node kind, raw pod patches and config-map mounts are Kubernetes-only) fails with a named error at that provider's preflight and never degrades silently. A settings write naming a provider that is not compiled in is refused.

A saved remote kubeconfig must carry embedded certificate and token data. File references, exec or auth-provider credential plugins, and skip-TLS-verify are refused at save time.

Inspecting a remote cluster degrades per read. A 403 means the identity is RBAC-limited but the cluster is reachable, so only that field is unavailable and the remaining reads still run. A 401 or a transport failure (a TLS or certificate-authority error is named separately) ends the inspection at once, instead of stacking every read's timeout against an unreachable API server.

The Docker provider runs on one backend, and a clustered host refuses it

The Docker provider drives the one daemon its backend reaches. A second backend, or a leader that moves machine, would fork containers and their gateway sessions onto another daemon. A clustered host (Coordination:Clustered=true) therefore:

  • does not register Docker's auto-detect probe, so Automatic resolves to Kubernetes in a cluster and to Manual elsewhere;
  • answers 400 to a settings save that selects Docker;
  • refuses to boot, with exit code 75, when the active provider is Docker or a workload row bound to Docker is not frozen.

The boot check reads the stored workload-providers and workload-orchestrator snapshots before the replica serves. Frozen rows (externally managed after a switch to Manual) do not count, a row mid-switch does. A single backend is unaffected.

The manifest

Workloads are declared under a deployment section of the plugin manifest. Its JSON schema is a closed contract: unknown keys are refused. The parser collects all errors, fails closed at install and is tolerant at load.

Field Purpose
id, displayName, description identity, and the author's own prose, rendered quarantined at consent
image.ref + image.digest pinned by the digest of the multi-architecture index
image.component product-image reference, bundled workloads only; exclusive with ref and digest
image.platforms hard node affinity
kind service, single-node, per-node, scan-per-node
resources, network, privileges, volumes[] author defaults and declared posture; privileges covers capabilities, privileged, root, host bus, tun, host and device paths, node-local state, backend-REST opt-in
health container or http, or adapter-session (observed over the gateway session)
extensions.reeve required on every workload (below)
hostRequirements[] prerequisites: a bus service, a kernel module, a stable serial link
observability.metrics a named service port plus scrape annotations
env[], parameters[] value sources and install-time parameters

A new top-level manifest key must be added to the strict parser, the release manifest passthrough and every DTO allowlist. Miss one and the key is silently dropped.

A per-node workload may not declare volumes, since a read-write-once claim cannot be shared across nodes. It uses node-local state.

The reeve extension

Reeve claims the reeve namespace. No other key is allowed and the namespace is required, so a misspelt key is an error.

  • protocol (version, minSupported) is the plugin-to-sidecar compatibility range, checked in both directions. The integers have at most 9 digits. Absent means undeclared, and a blank token is refused.
  • apiSchema is the module-to-sidecar pair contract. When declared, Reeve forces REEVE_API_SCHEMA into the workload's env.
  • health.mode must be container, http or adapter-session.
  • No workload takes broker material. An adapter speaks to the gateway (constraints).

A malformed stored part reads as undeclared. The update axes compare the extensions on both sides and fail closed on an unparseable token or an unreadable previous side. An added workload has no previous pair, so both axes pass. Module and sidecar ship as one release, so the pair-contract check is equality, not a floor.

Parameters

Install-time parameters are typed: text, integer, boolean, password, enum, device path, node selector, network interface, storage size, storage class. Reeve synthesizes reserved parameters instead of the author declaring them: network mode and attachments, a host bus path, per-port host ports on the container provider, resource overrides, and per-volume existing-claim and size. That makes an already-published plugin attachable or resizable without a release. Path-typed values are validated against allowlisted prefixes.

Resource overrides are set with PUT /api/workloads/{id}/resources. The body is total: a null or blank axis clears that override. CPU is at most 64 cores, memory is between 6Mi and 1Ti, and a limit below its request is refused. A change recreates the workload on the next reconcile and is refused with 409 while an update is active. An update keeps every override except for workloads named in adoptDeclaredResourceWorkloadIds in the update request.

security.userNamespace (default false) runs a workload in its own user namespace. Only Kubernetes offers it.

The resolved parameter map is the accept-list

On install and on the day-2 edit, the resolved map's keys are exactly the declared plus the reserved names. A submitted name absent from it is rejected. A name the server populates itself is protected by being absent from the map, so an edit path must not merge unknown keys.

The parameter mask and its un-mask are one policy

  • On read, a value is returned verbatim only when the installed manifest proves it non-secret: a declared non-password parameter, or a reserved name Reeve synthesized for that workload. Everything else reads as the mask literal. An unreadable manifest masks everything.
  • On write, a posted mask literal means "keep the stored value" for every parameter name.

The halves must stay inverses, because the install wizard prefills from the read projection and posts it back. Otherwise the mask would be persisted as a literal. The cost is that no parameter can be set to the literal mask string.

Sections and switches are presentation

A parameter may name a section. The install wizard and the day-2 form group parameters per section. An enum parameter may also carry widget (select or radio), enumLabels (value to label) and reveals (value to section names). A section named in any reveals is gated, and that parameter is its switch. A gated section shows only while the switch's current value lists it.

A switch hides fields and never withholds values. Hidden values are still submitted, stored and delivered, so the container must decide from the switch which fields to use. A container that infers the choice from which fields are filled acts on stale values.

The parser rejects inconsistent use: the keys on a non-enum or reserved parameter, an unknown revealed section, a section revealed by two switches, and a required parameter or a switch in a gated section.

Bootstrap keys

Bootstrap keys are a closed set. The library resolves instanceId and specHash. Reeve answers gatewayUrl, backendBaseUrl, workloadToken and trustedCaCertificates. A manifest may reference only those six and workloadHost:<id> of a sibling in the same deployment. A workload that talks to an MQTT broker takes its address and credentials from its own parameters.

The gateway URL is composed per provider from the stored gateway URLs (below) and Workloads:GatewayEndpoint. backendBaseUrl is the gateway base, and gatewayUrl adds the instance route. The workload token is provisioned as REEVE_WORKLOAD_TOKEN under the credential id gateway-token.

Every answered value is hashed, except trustedCaCertificates, so a change to what a key composes moves the spec hash of every workload that references it.

Trusted certificate authorities are one host TLS setting

The operator lists extra trusted CAs once, in Tls__TrustedCaCertificates (chart tls.trustedCaCertificates or tls.trustedCaCertificatesFrom): a PEM bundle, validated at startup. A list that does not parse stops the start.

The host trusts the list after the system roots for its own outbound TLS: its HTTP clients, secret providers and MQTT connections, and so the in-process plugins that use them. A plugin that opens its own TLS asks for IHostTlsTrust. Database, Redis, Kubernetes and Docker clients keep their own settings.

A workload that declares trustedCaCertificates receives the PEM in an env. The value is not part of the spec hash, so a change needs a host restart and rolls out no workload: a workload sees it on its next apply, or when the operator redeploys it.

The spec hash

The spec hash is lowercase hex with no algorithm prefix, computed over a canonical sorted rendering. It excludes secret values (a secret reference is hashed by name), host requirements, resource names and labels, the workload token and the trusted-CA env.

Nothing in the workload surface is vetoed on the operator's behalf. Privileged containers, images from a registry outside the plugin's own, and the raw pod-patch escape hatch are all permitted, including from the official index. They are rendered verbatim at consent with dangerous fields highlighted and explained. A new risk gets a consent line item, never a block. Catalogue badges never gate an install.

The highlighting is best-effort. The patch revalidator is the enforcement authority and fails closed on anything the annotator missed. Severity comes from one coded privilege catalogue that the install preview and the update diff both use. Labels are Reeve-authored, and plugin author prose is quarantined and never merged into a label.

An operatorNetwork workload carries two Danger items: networkMode.operatorNetwork, which names the attachments it runs on, and network.unfiltered, because the platform's filtering does not see traffic on them. Nothing the network contains is disclosed, since no gate reads or judges it (operator networks). The names are the whole disclosure, and the decision is the operator's.

The consented profile

The grant stores the consented profile verbatim: kind, network mode, privilege booleans, capability set, resolved device, bus and host paths, volumes, node-local state, and the digest of any normalized pod patch.

Consent is judged where a spec can change, not at every apply. Each write that can change what a workload requires (install, update, day-2 parameter edit, an instance created with parameters, consenting again) compares the resolved requirements against the profile, and asks or refuses on any increase. The consent enforcer re-judges the stored workloads at replica boot, after a consent, grant or settings change, and once after each update intent ends.

A repository sync never changes the release row of a version that is installed or being updated to: a tag republished with other content keeps the row as installed, with a warning.

The profile is one per plugin type, so every instance of the type is judged against the same entry. A consent recorded for one instance is the join of that instance's requirements with those of each other instance the entry already covers. A path the operator never approved for any instance is not added on a sibling's behalf.

Axis Contents On increase
Security kind, network mode, privileges, resolved paths, patch digest parks and asks
Informational volumes flows through auto-update with a note

Attachment network names are not a drift axis: the mode is the privilege, the names are operator inventory. Consent still records which names the operator accepted.

A device slot (privileges.devices) lets the operator bind up to maxCount devices (1 to 8), filtered in the install wizard by deviceKind (usb-serial, gpu-render or accelerator). With group: auto the container also joins the device's owning group, read from the node hardware inventory and never from the manifest. Consent records that the workload joins the owning group, not the numeric id. On Kubernetes and Manual a bound device needs a privileged container, so consent for such a workload includes privileged mode.

GET api/workloads/consent/{pluginTypeId} lists the workloads of an installed type whose recorded consent does not cover what they require now, judged per instance on its effective provider. It returns the fingerprint of what consenting would record. POST to the same route (workloads.approve) echoes the fingerprint, is refused with 409 when the requirements changed since, and records consent for exactly that. A changed kind, network mode or unsupported pod patch is not renewed here: only a reinstall records that consent.

A clean update whose candidate profile is a subset of the recorded one installs without a fresh acknowledgement, decided server-side and audited. The candidate is derived from the parameters the staged spec deploys with: the instance's resolved parameters overlaid by the request. An operatorNetwork workload is covered only when its attachment names equal the recorded ones, in order. The install, the staged update and the day-2 parameter edit record the names they deploy.

The image digest is not a consent axis. No axis describes what a workload runs, so a publisher, or whoever takes over the repository or registry, can change privileged code on the operator's node without a prompt. The change shows afterwards in the informational note and the audit trail.

The server decides whether an update needs fresh consent, by comparing the recorded profile with one derived from the release manifest and the resubmitted parameters (constraints).

The unattended-update gate is fail-closed. Every reason a deployment can park declares an axis.

  • Consent axes are questions a human may answer: a security escalation, an added workload, new required parameters, an unparseable protocol declaration. An operator-initiated install skips them, because the consent panel already asked.
  • Feasibility axes are facts computable from the two manifests: a raised protocol floor. They block on every path with no override, because a sidecar whose floor exceeds the backend's protocol version would stay mute. The refusal names both plugin versions and both protocol declarations.

An unknown security change reads as an escalation. Volume-only changes never park, and a narrowing is only a note.

Nothing runs unless recorded consent is present and covers what the workload requires.

State Outcome
consent recorded but not covering the requirements never applied beyond consent
no consent, privileged by declaration, deployed torn down, volumes kept
no consent, not privileged, deployed suspended, resumable
no consent, never deployed waits; nothing torn down, not a revocation

The privilege decision uses the manifest declarations, so a cleared device parameter cannot turn a teardown into a suspend. A pre-consent instance has no profile and is never read as a revocation.

The library keeps one host hold per workload, for two reasons (instance disabled, consent withheld): enabling an instance lifts it only when consent also allows, and restoring consent never starts a disabled instance. At boot consent enforcement is settled before the reconciler starts, on every replica.

A module whose enforcement throws during a pass over all modules is held and the pass continues. Each of its instances, except one an update owns, gets a workload.consent_unchecked diagnostic and is suspended. The grant restore job re-enforces them every 15 s, lifts the hold where consent allows and clears the diagnostic. A module that can be neither enforced nor held fails the pass, and at boot that stops the replica.

Approval is its own permission

workloads.approve gates approving any privileged deployment, changing provider settings, force-adoption, switching a workload to the Manual provider, revealing or rotating a workload token, and the dangerous global toggles. Ordinary reads and workload commands run on integrations.manage. The plugin side requests workloads.deploy for a deployment section and workloads.command for the command facade bound to its own instance. "Can manage integrations" must not imply "can cause root-equivalent code execution on a node".

Granting workloads.approve is approximately granting node-root authority. Every escalating mutation and every live-credential return fails closed without it. A parameter edit needs it only when the edit changes a resolved host, device or D-Bus path or the network posture.

The install preview is side-effect-free and fails closed

The install wizard's consent projection and the provider preflight share one resolution of the prospective desired spec. They write nothing and mint no token. Any resolution fault blocks the whole preview instead of dropping a workload, and a provider throw in the preflight becomes a blocked 200 result, never a 500. Network checks in the preview are advisory; the install gate is the authority.

Before a provider is chosen, the consent preview resolves on the Docker grammar without the Docker-only reserved keys, which yields the provider-independent posture. The prospective spec is null on this leg, and the response says it was computed for no provider. The privilege items are always judged on the effective provider, because that is the provider the install records consent for.

Tokens

Each workload instance authenticates with a 256-bit random token prefixed rwt_, distinct from the personal-access-token prefix pat_. Only the SHA-256 digest is stored, and the raw value is returned once, at mint or rotate. A token carries zero permission codes, travels in the Authorization header only and is never logged.

A token authenticates the gateway handshake and the self-scoped /api/workloads/self surface, nothing else. That surface authorizes only a workload whose manifest declares the backend-REST privilege and whose recorded consent carries callsBackendRest. No grant, no entry or no flag all answer 403.

Mint, rotate, seed and revoke-all run in one transaction under a PostgreSQL advisory lock keyed by the instance id, so overlapping rotates never leave two live credentials.

Rotate revokes every active token and adds the new one in a single save, so there is never a moment with zero active tokens. After the commit, the follow-up steps (force-close the live session, mark drift) are uncancellable, because cancelling would drop the only copy of the new token. Revoking closes the live session even when the token was already revoked. Audit entries never contain the raw token or its hash.

A token is outside the spec hash, so rotation clears the applied-spec hash and the next permitted apply re-renders the workload. On Manual the operator re-renders.

Resolution runs on every handshake and fails closed: a malformed input yields no principal, and a transient database error denies instead of answering 500.

A deployment may hand the backend a raw token it also mounted into a sidecar, as the chart does for the Matter bridge. The backend seeds only its SHA-256 hash, idempotently, under the same lock. The raw token is never logged or persisted, and an empty value skips the seed. A malformed chart-provisioned token fails the boot.

The gateway session

A sidecar's control plane is a raw WebSocket session the backend terminates at /ws/workloads/{instanceId} on the same origin as the API. The frame vocabulary and a sidecar's standing obligations are on the integrations page. This section is the host side.

The handshake is verified before anything is registered

The bearer token comes from the Authorization header only. Authentication and route binding happen before the socket is accepted, so the client sees an HTTP status. The HELLO frame is then verified before a session is constructed:

  1. Shape.
  2. Three-way binding: the route's, the token's and HELLO's instance ids are the same non-empty GUID.
  3. Protocol overlap: m.minSupported <= s.version and s.minSupported <= m.version. A non-numeric or blank version fails closed.

Registration supersedes any prior session of the instance. The durable command backlog is sent only after HELLO_ACK, because the client drops a COMMAND that arrives before it.

Handshake attempts are rate-limited per connection source by a per-replica, in-memory fixed-window limiter, with IPv6 sources sharing a window per /64. A permit is refunded on success or when the refusal is the host's own (a reload fence, a drain), so a healthy reconnect is never charged.

Inbound frames are de-duplicated and acked before dispatch, so a sink fault does not tear the session down. A tagged frame (dataKind) whose payload does not bind is logged and dropped.

Token expiry closes the session. A sweep first sends a reauth frame so the sidecar reconnects with a freshly read token instead of the socket dropping.

A plugin reload fences new sessions on this replica

During a plugin reload this replica declines new session registrations for the instance. The WebSocket is accepted and closed with 1001 (EndpointUnavailable), and the adapter reconnects on its own backoff.

The fence is per process, not in Redis, so a replica that dies holding one wedges no install. It is raised before evacuation and lifted only after the swap, because a session registered in between would bind to the object about to be unloaded. A wedged socket does not stop the reload. After an instance starts, session resync closes the sockets this replica holds so each sidecar reconnects with a full snapshot. How the swap is placed across replicas is on cluster.

Presence is shared; the socket is local

A session terminates on exactly one replica, but presence lives in Redis. The health gate and the reconciler read presence as ground truth, never local socket state.

  • A presence read fault is never mistaken for absence.
  • An unreachable store is not a missed heartbeat. After a faulted read the sweep evicts nothing until the store has answered for one liveness window.
  • Superseding is ordered: the previous owner is told to drop its socket before presence is overwritten, and heartbeat and removal are conditional on the stored session id, so a superseded session cannot clobber the new owner.
  • A local socket whose presence is gone, or names another replica or session, is force-closed only after two consecutive known-good orphan observations.
  • The server's own work is not peer silence. A sink call still running after three liveness windows (270 s at the default heartbeat) is stalled: the session closes with the cause DispatchStalled. Where observation replication runs, a reconnected session's frames wait for the stalled call, but only up to HandoverDrainTimeout (the grace plus 5 s by default).
  • Locality is Unknown on a fault, never Remote. Callers of a locality query fail open.

The session-outage pass marks a session plugin's devices offline once the session has been absent for the grace period.

Commands cross replicas through durable rows

A command to an adapter whose session another replica holds uses a durable row in integration.workload_commands plus hint-grade bus nudges. The caller writes a Pending row, nudges the owner and awaits the terminal row.

  • Payloads and responses are encrypted with Data Protection under their own purpose, because they can carry secrets such as a Matter setup code (secrets at rest). An undecryptable value comes back Failed. A payload is never logged.
  • Delivery is an atomic claim: one conditional Pending-to-Delivered UPDATE wins for exactly one caller. Delivered rows are never re-sent. The message id is the row id, so the sidecar's de-duplication stops a redelivered row from executing twice.
  • The nudge is lossy and the poll is the backstop. Every row carries the caller's deadline (the command's own expiry when earlier), judged on the database's clock, and an owner neither claims nor keeps a Pending row past it. When the session a row was written to closes, the owner fails the row as session lost. A retention sweep deletes terminal and abandoned rows after CompletedCommandRetentionHours (default 24).
  • A local socket is used only while presence names this replica and session. A half-dead socket that lingers after the sidecar reconnected to a peer fails the gate, and the command goes through the durable plane. Only a genuinely offline instance answers NoSession.

Cluster messages use pinned wire names, because a mixed-version fleet drops a hint whose key moved.

Adapter frames enter the device pipeline

Authenticated, de-duplicated frames from an adapter feed the same device pipeline the in-process plugin path feeds, attributed to the owning plugin instance. A frame for an unresolvable workload is dropped, never mis-attributed.

  • Snapshots are resync, not replay. A device absent from a snapshot is never deleted, because the protocol has no removal message.
  • A discovery candidate is never a device. It goes to the candidate pipeline and never back-pressures.
  • Plugin-specific DATA frames go to the plugin's ingestor uninterpreted. An unclaimed kind is dropped, but observably.
  • An undeliverable frame warns once per (session, reason), then logs at Debug. Logs never carry the device id or payload, because the adapter controls the device id.

The Matter bridge opens a gateway session without being a workload instance. It owns no devices and its snapshot never enters the device pipeline (matter-bridge).

The client side, in .NET and Node

The shared session client (Reeve.Adapters.Protocol for .NET, @reeve-iot/workload-client for Node) carries the sidecar's obligations so a workload author does not re-derive them.

  • Handshake: HELLO then HELLO_ACK within a deadline.
  • Reconnect is resync. Buffered incremental frames are discarded just before the SNAPSHOT is sent. A snapshot above the gateway's 1 MiB frame cap goes out as several SNAPSHOT frames, and an entry too large for a frame of its own fails the session. The outbound queue is bounded and drops the newest frame when full, reporting the drop to the caller. Every SNAPSHOT is followed by the last health the adapter published. Backoff is bounded exponential with jitter.
  • Private data kinds: PublishAsync(payload, dataKind, typeInfo) (publishData(payload, dataKind) in Node) sends a kind the gateway hands to the plugin's IAdapterDataFrameIngestor and replicates to the replicas listing it in ObservedDataKinds. A blank kind, a well-known one (state, discovered, health), snapshot, and a frame above the 1 MiB cap are refused with an argument error. A data frame is best-effort: no snapshot carries it, so a frame the queue dropped is not re-sent. A kind that holds current state is re-published from OnSnapshotSent (onSnapshotSent), which runs after every connect.
  • Commands are acked, de-duplicated by messageId and handled off the receive loop. A handler fault becomes a handler_error response.
  • Enums serialise as member-name strings parsed by name only (ColorModel is the one numeric exception). Optional members are omitted, while null means "present, no value". The TypeScript constants match the C# ones byte for byte.

Sidecar self-config and self-discovery are self-scoped and default-deny

A sidecar can address only its own instance: the instance id comes from the authenticated principal's claim, never from a route or body. An unknown or terminating instance answers 404, and a profile without consented callsBackendRest answers 403. The self-config parameters use the default-deny mask.

Self-discovery (candidates and node hardware inventory) enqueues nothing for an unknown, terminating or non-consented instance. Batches are capped at 1000 items. A hardware-inventory record is accepted only when its device path lies inside a host path the operator consented the reporting workload to inspect (privileges.hostPaths, which under /dev can only be /dev/serial or /dev/dri). The node name is still the reporter's own claim: one credential serves every node of a per-node scan.

Observation replication

An adapter's session terminates on one replica, chosen by the session registry's presence. When replication is on, the owner appends the frames its plugin opts into to one Redis stream chain per workload instance, and every other replica reads that chain into its own copy of the plugin. Replication is opt-in per session and follows the resolved coordination setting unless Workloads:ObservationReplication:Enabled says otherwise. Which frames a plugin may opt in is on integrations. Operating it is in running multiple replicas.

Replication is data, not coordination

The stream's cursor orders the sessions of an instance and owns nothing. Presence and the durable command rows decide which replica holds the socket and who executes a command. A write from a session the cursor does not name is refused. No ownership decision reads the stream (see cluster).

Entries are sequenced, and gaps are reported

The owner tags each entry with a sequence number. A follower reads the chain in order and records gaps (cold start, Redis restart, a non-replicating owner, queue overflow, undecodable entries). Only a plugin checkpoint, published by the owner on request, closes a gap. A plugin that cannot restore one keeps the gap and behaves as a non-owner without replication.

Appends are fenced by stream ids and a write permission

An append is one transaction: the entries as XADD, then HSETEX … FXX on the cursor, which succeeds only while the session's permission w:<session>:<nonce> exists. Both halves are needed. Id order alone lets a stale cursor write land on a successor's cursor, and the permission alone lets time-based ids land after the successor's marker. A writer whose write ended ambiguously swaps the nonce and fences the stream with XSETID before it writes again. No Lua is used (constraints).

Rules to keep:

  • A session's entries all carry its open (or last re-arm) marker's millisecond, so a stream id says where an entry stands, not when it was written. No MINID or age-based retention may be added.
  • The cursor and stream-id shape is not additive. A change to it is gated or re-keyed before builds roll (constraints).

The store uses a dedicated Redis connection, because a conditioned transaction holds the shared multiplexer's write lock for a round trip. Stream sizes are bounded by byte shares of a budget derived from Redis maxmemory (20 percent by default). A small share only shortens history, reported as gaps.

Readers default to Adaptive

A non-owning replica's reader runs in one of three modes. The owner publishes a lossy hint on the cluster bus after each committed append. Correctness never rests on the hint.

Mode Behaviour
Polling reads on the fixed poll interval
Interrupt reads a hinted instance at once; a full round at the long idle interval is the backstop
Adaptive waits on hints while quiet, polls after deliveries, returns to hints after eight empty rounds

An unset mode resolves to Adaptive when the idle interval is at least the poll interval, otherwise to Polling.

Updates

stage.params -> stage.sidecar -> stage.health-gate -> stage.operator-redeploy
             -> stage.commit-version -> stage.host.plugin-roll -> stage.commit-params

An update is a walk over these stages, with a journal on the update row. A failure or an abandon before the first stage that cannot be undone walks back through the stages entered. Past it, nothing is undone and an abandon is refused while the walk goes on.

A walk past that point that cannot be planned, or whose stage keeps throwing, records walkFault and walkFaultSinceUtc on the update detail. An abandon after a minute of failing is accepted (200) and ends the update RollbackFailed with nothing undone, so the deployment is reconciled by hand. A younger fault answers 409 with the time from which an abandon is taken.

The sidecar goes first, while the plugin still matches last-known-good, because its rollout is the fragile step.

The health gate is certified by the new rollout's own evidence

Health requires provider-ready plus a live gateway session established after the apply whose handshake echoes the applied spec hash. Protocol compatibility is checked against the running and the incoming module. A workload that never opens a session is certified by its declared health contract (provider-ready, or the apply itself for scan-style workloads).

The rollout certifier reads the presence store and is required for adapter-session. It is asked under every mode, so a session with the wrong identity fails the gate under provider-ready too. It reports the first failing reason of SpecHashMismatch, AppVersionMismatch, ApiSchemaMismatch, ProtocolIncompatible.

A session that echoes the outgoing spec hash is the replaced workload still answering. It is neither a failure nor a pass: under adapter-session the gate keeps waiting, under a provider-ready mode it passes on provider Ready. A presence store fault pauses the gate's clock.

Parameters and the profile commit last

Parameter values are committed only at completion, so a rollback never renders the old manifest against new parameters. The consented profile is the exception: the candidate's requirements are recorded at the start, because rolling workloads already run the candidate's spec. If the update ends without completing, the earlier profile is put back, unless consent changed again meanwhile.

The plugin roll is a one-way door

The roll records the new version on the grant and the installation, then reloads the fleet one replica at a time, peers first and the leader last. Once entered it cannot be rolled back. A native plugin's workflow blocks and triggers load at boot, so a replica reports "loaded at V, needs a restart" and the roll counts it as done.

Replica placement is on cluster, the operator's actions on a halted roll in upgrading. Until the roll finishes, every workload of the group carries the plugin.roll_incomplete alert.

Edits during an update, and write conflicts

Parameter edits, token rotation and workload commands are rejected while an update is in flight on that instance. A parameter edit that loses a write race on the instance row is retried up to three times while the resolved parameters and network pin are still the ones the edit was judged against.

Outcome Answer
Another operator changed the parameters or the network pin 412 Precondition Failed, nothing written
Every attempt lost to other writers 409 Conflict with a problem body, nothing written

The same exception from any other workload endpoint maps to 409, never 500.

A host refusal is a 422, except in the artifact render

When Reeve's bootstrap source refuses a workload, commands, volume resize, resource limits, parameter edits and relocate answer 422 with the reason. The artifact render keeps its 400s. A new refusal must not refuse a value that stored specs were composed with.

Reconciliation

The reconciler runs on one replica, under a leader the library elects, driven by cluster nudges, a periodic resync and gateway presence events.

The periodic pass is never removed

Watch-based reconciliation is only a trigger optimisation. One loop runs the full pass (status and drift) every Workloads:Reconciler:StatusResyncSeconds. A watch fault or a delete event is never read as "tear the instance down".

Apply rules

  • Apply with server-side apply and no forcing. A conflict marks the workload failed and names the conflicting field manager. Forcing is allowed only during adoption, once, after ownership evidence (labels, image reference, volume binding) is verified, never on a name match alone.
  • Managed providers pull by immutable digest. A mirror that cannot serve the pinned digest fails the apply, so mirrors must retain the previous release's digests or rollback is impossible.
  • Every managed object carries prune-suppressing metadata, so a declarative sync does not delete it.
  • Volume claims are create-only except an upward size change.
  • Desired state comes from the plugin's installed grant version. When that version's directory is absent, hold. Never fall back to a newer parked or rolled-back manifest on disk.
  • A failure inside an authorization or gating path resolves to deny or hold. Secret masking fails closed.
  • A bundled workload takes the application's own image from the running backend's configuration. Third-party images require an authored digest.

Workload logs

The live tail follows a position, not a text diff

The log stream hub (/hubs/workload-logs) compares each read with the last line it sent, by the runtime's timestamps, so a repeating line does not freeze the tail. When the read no longer holds that line, the result starts with a gap marker, sent as isGapMarker.

Image pull credentials

Operator-configured registry credentials are matched by host pattern and attached only to TLS registries. A pull against a plain-HTTP host is refused rather than sending them in the clear. Enabled OCI plugin repositories that carry a credential also supply one, only for the exact host and port they pull from. The token is never logged.

Networking

network.mode is cluster, hostNetwork or operatorNetwork, with an attachment list under the last. Both are synthesized reserved parameters, not manifest fields. A Kubernetes workload on hostNetwork runs without a user namespace even when the switch is on, and the preflight warns.

Reeve never owns the operator's network

Reeve never creates or deletes a network it did not make. Operator attachment networks are connected to, never changed or removed, on teardown and uninstall alike. The provider's own network stays beside an attachment, because replacing it would cut the workload off from a backend on the same host.

Health listeners bind to all interfaces

Workload authors bind health listeners to all interfaces or the primary one, never to the attachment address, which the node cannot reach. Otherwise a working workload reads as permanently unhealthy. Under an attachment, readiness means container-running plus service-endpoint membership, not a probe pass.

An operator network is judged by name and existence

Reeve judges an attachment by its name and whether an object of that name exists: a Multus NetworkAttachmentDefinition in the workloads namespace on Kubernetes, a network on the Docker daemon. What the object contains is the operator's, and no gate reads it. A new name asks for consent again, because consent records the names (consent covers names).

The install gate, and the day-2 edit gate when the network posture changes, refuse an operatorNetwork workload that names no attachment, a named attachment that is not listed, and a listing that could not be read (all network-attachment-exists). On Kubernetes they also refuse a fan-out workload without a node-eligibility selector (network-attachment-node-eligibility), a warning for any other kind. No check reads a driver, a published port or IPv6, so a setup that cannot work fails at container start.

A pin holds the consented names

A workload that resolves to an operator network holds a pin: the mode and the ordered attachment names taken from consent. The library apply compares the pin with the spec and asks the provider whether each pinned attachment exists.

Condition Result
The pin cannot be read, names other attachments, or a named attachment is missing apply parks as AttachmentConfigDrifted
The listing faults, is refused or times out apply parks as AttachmentExistenceUnverifiable and is retried; never counted as missing

A missing attachment refuses a redeploy or a parameter save with the name, and resumes by itself once the attachment exists again. An unreadable listing is not drift and blocks no unrelated edit.

The gateway URLs

A sidecar dials the backend over a base address, the gateway URL, onto which Reeve appends /ws/workloads/{instanceId}. There is one per provider:

Provider Property Fallback when blank
Kubernetes gatewayUrl (an override) derived from Workloads:GatewayEndpoint
Docker gatewayUrl Manual's external URL, then ws://<BackendServiceName>:<BackendPort> inside the Docker network
Manual externalGatewayUrl none

Reeve stores them in the provider entries

They are keys inside the provider entries of the workload settings (providers.docker.gatewayUrl, providers.kubernetes.gatewayUrl, providers.manual.externalGatewayUrl), written with the entry by PUT /api/integrations/workload-orchestrator/providers/{provider} and read back by GET /api/integrations/workload-orchestrator/gateway (configuration). A URL left out of the body is kept, a null clears it, and the value is stored verbatim. The library never sees them: the host removes the three keys from the document it serves. With no settings saved there is no URL (constraints).

The workload settings are two rows and a pause

integration.workload_settings holds one jsonb document per feature key: providers (the provider entries) and selection (the selected provider, allowUnpinnedImages and the registry mirrors). Every secret is protected per field (enc: plus a data-protection payload), and a stored secret without the prefix is refused. The global reconciliation pause lives in core.runtime_settings. A write appends a workload_settings change entry in its transaction, and every replica then refreshes its snapshot.

The two records are the feature configs workload-providers and workload-orchestrator. The database is their source unless the deployment declares the feature (managed workload settings). There is no single-document write:

Route under /api/integrations/workload-orchestrator Writes
PUT providers/{provider} one provider entry
PUT selection the selection
PUT reconciliation-paused the pause

A provider or selection write builds the proposed document from the stored one (a masked or omitted secret keeps the stored value), validates (400 naming the field), and asks the library's judge before anything is written (the settings are judged on write). Consent enforcement runs after a provider or selection write, never after the pause.

Every write runs one transaction under the advisory lock WorkloadGatewaySettings_Writers. Helm workloads.defaultStorageClassName seeds the Kubernetes provider's default StorageClass only while the settings have never been saved. From the first save onward the settings page owns it.

Managed workload settings are applied snapshots

Managed:WorkloadProviders and Managed:WorkloadOrchestrator are two applied-snapshot features (applied snapshots). Per feature the host serves the active snapshot's projection when the feature is managed and a version is active, and the database rows otherwise. When this replica cannot serve the active version, the pass fails naming the feature and the library retries. The pause is always read from the database.

Each feature has a judge that checks the candidate beside the other feature's served part. Its verdict maps to a pending code, or to declaration_invalid when the content check of a resolved secret fails. With several broken rules, the code is the first of target_not_configured, provider_switch_blocked and provider_in_use. A reason names instances and volumes, never a secret. The selection answers 400 provider_not_declared for a provider the declared list lacks.

A declaration is the operator's consent to the orchestrator settings and to nothing about a workload: an activation that widens a workload's spec suspends it until consent is given in the panel.

While the managed selection names a provider other than the one in force, the host holds a pending switch. Installs and updates of plugins that declare workloads, restores from a retained volume and adoption answer 409 provider_switch_pending, and consent materialisation waits. Purge, retained volumes, orphans, relocation, per-instance commands and the pause are never held.

The settings are judged on write

The library's settings judge decides and the host acts on its verdict. The host hands it the proposed settings and the providers that cannot be a target: Docker is one while the backend runs clustered. A refusal writes nothing.

Judge rule Answer
A provider switch while non-terminating instances run on the current provider (provider_switch_blocked) 409, with the blocking instances
An entry dropped or relocated while instances or retained volumes are bound to it, or the active provider's entry dropped (provider_in_use) 409, each entry with its reason, instances and retained volumes
A target that is unavailable (target_not_configured), such as Docker while clustered 400

The 409 body is WorkloadSettingsRefusalResponse, whose code names the rule. A save that keeps the provider and moves nothing is never refused, and instances bound to a third provider do not block. The pause is not judged.

The install preflight checks the gateway URL and dials nothing

The preflight reports Manual's external-gateway-url and external-gateway-url-tls, and Docker's docker-gateway-url, docker-gateway-url-loopback and docker-gateway-reachable. A loopback or wildcard host cannot be reached by a container on a shared bridge, and a cluster-internal .svc host cannot be resolved by a sidecar outside the cluster. A well-formed URL the Docker network cannot route to shows up only after the apply, as a session that never opens.

The Manual probe reads the handshake's status and speaks only for the base URL

The token-less probe dials the configured gateway URL with a short timeout and classifies the handshake's HTTP status:

Response Verdict
101 upgrade
101 whose handshake still fails broken handshake
401 / 403 reachable, authentication required
any other status reachable base URL, upgrade unknown
none unreachable

The probe dials the base URL while sidecars dial /ws/workloads/{id}, so only an upgrade says anything about the workload's route. The live session count comes from presence, not from the diagnostics rows.

Volumes and adoption

Critical retained data (Thread and Matter fabrics, Bluetooth bind keys, Z-Wave keys) is never auto-deleted. Purge is a manual operator action and restore is offered at reinstall.

Adoption, drift and teardown key on the workload-instance label, never on a reconstructed name (constraints). Rules to keep:

  • Every site that derives a retained physical name goes through one resolver.
  • An adopted claim is must-exist-else-fail. No path may provision a fresh empty volume in its place.
  • A retained name is single-owner: at most one instance may adopt it.
  • Restore is install-time only.
  • After a database rebuild the volumes carry the old installation identity, so adoption verifies ownership evidence and relabels rather than matching a name.

The installation label is co-tenancy hygiene, not a security boundary: anything with API access can forge it.

The chart and plugin artifact storage

The chart is restricted by default (non-root, read-only root filesystem, default seccomp, no capabilities). Built-in plugins ship inside the image. Marketplace installs need a writable directory, offered two ways:

Shape Behaviour
per-replica scratch directory (ephemeral) self-healed at boot by re-pulling the recorded installed set
per-replica persistent volume (perReplica) through a stateful workload kind

The container provider

Only the leader, the holder of the workloads-engine mutex, applies container workloads. There is no failover: a leader on another machine would talk to a different daemon and could not adopt the previous host's containers or volumes, so a clustered host refuses this provider (above). A remote TCP daemon is not supported. Capabilities start from a full drop and add back exactly the consented set. With root not consented, the image default decides the user.

Updates are a journaled rename-first recreate

The sequence is pull, stop old, rename old, create new, start new, health-check, remove previous. The journal is the daemon's own container state: each entry resumes from the containers the daemon reports for the instance label. On a failed start or health check the candidate is removed and the previous container is restarted and kept. A removal never removes volumes or the shared network.

Rules a change to this sequence must keep:

  • The old container is stopped before it is renamed, so a restart policy cannot resurrect it into a name, port or device clash with the new one.
  • The resume leg re-runs attachment reconcile before starting an already-created container, because a crash between create and connect leaves the right label and no attachment.
  • A live container at the target spec hash but with a stale restart nonce counts as old, so an operator-triggered restart causes exactly one recreate.

Failure modes

Symptom Cause
A clustered backend exits with code 75 at boot The stored provider is Docker, or a non-frozen workload row is bound to Docker. Switch to Kubernetes or Manual.
Adapter pods run but never reach healthy in a default-deny cluster Sidecar pod labels match no existing policy, so egress to the backend is denied. Host-network adapters are not covered by pod-selector rules.
A workload waits for its adapter session forever Read the last connection outcome: no attempt, a TLS failure, a bad token, an instance-id mismatch, or connected without handshake.
A Docker workload's session never opens though the preflight passed The gateway URL is well-formed but the Docker workload network cannot route to it.
An update is refused with two protocol versions in the message The candidate sidecar's protocol floor exceeds this backend's version. Upgrade the backend first.
An attachment stops working after a node rebuild Hand-installed network plugin binaries are lost, and the attachment definition must live in the workload's namespace. A deleted network keeps working for a running pod and fails at the next apply.
Workloads run after a database rebuild but the product does not know them The fresh install has a new installation id while the volumes carry the old one. Use the previous-installation adoption path.

See also