Serve materialization and contract projection¶
A serve assignment carries every decision the control plane made about a model deployment as a set of versioned contracts. The node reads them into one projection, checks that they agree with each other, and acts on them in a fixed order. The first thing it puts in place is the weights: a model served from its own weights needs them on a volume or in a bucket before an engine can start. This page covers the assignment and its phases, the contracts it carries, the order the node applies them in, and how weights are materialized.
The assignment¶
The control plane sends model.serve.v1. Its phase says what to do:
| Phase | The node |
|---|---|
materialize |
Puts the weights in place and reports, starting no runtime |
serve_start |
Puts the weights in place and starts or updates the runtime; the default |
readiness_check |
Confirms the runtime is ready and runs the inference probe |
serve_stop |
Removes the runtime and detaches the weights |
A deployment is usually serve_start followed by readiness_check. Scaling to
zero and waking use the same phases with a new replica count. See
Serve runtime, scaling, and scale to zero.
The contracts it carries¶
flowchart TB
subgraph TASK["model.serve.v1"]
direction TB
subgraph WHERE["WHERE THE MODEL LIVES"]
direction LR
MC[("materialization<br/>model.serve.materialization.v1")]
SC[("runtime storage<br/>model.serve.runtime_storage.v1")]
end
subgraph HOW["HOW IT IS SERVED, one of"]
direction LR
SH[("self-hosted runtime<br/>model.serve.self_hosted_runtime.v1")]
PX[("proxy runtime<br/>proxy.runtime.v1")]
end
subgraph RULES["UNDER WHAT RULES"]
direction LR
AG[("airgapped_execution_contract<br/>model.airgapped_execution.v1")]
GC[("gpu_runtime_class<br/>model.self_hosted_gpu_runtime_class.v1")]
IB[("interface behaviour<br/>model.interface_behavior.v1")]
LI[("exact XSRP grants<br/>assignment authority")]
end
RR[("release_route_contract<br/>route_generation, route_hash")]
end
PJ{{"Contract projection<br/>one checked view"}}
WHERE --> PJ
HOW --> PJ
RULES --> PJ
RR --> PJ
The projection reads each contract, checks its version, normalizes it and
checks it against the others: a self-hosted runtime's model source and source
path must match the ones the materialization delivers, and its GPU class must
name a valid sharing mode and an accelerator that agrees with its node
selector. A contract that fails fails the assignment
before anything in your cluster changes, with
MODEL_SERVE_SELF_HOSTED_RUNTIME_CONTRACT_INVALID or
MODEL_SERVE_PROXY_RUNTIME_CONTRACT_INVALID.
The interface contract fixes how callers talk to the model:
| Field | Values |
|---|---|
interface |
normalized or native |
api_standard |
openai-v1 or native |
| Translation | passthrough or native_passthrough |
| Model injection | client_supplied_model_required (default), or provider_default_or_client |
The order the node applies them¶
flowchart TB
A1{{"1 Airgapped preflight"}}
A2{{"2 GPU sharing preflight"}}
A3{{"3 Scaling preflight"}}
A4["4 XSRP grant admission<br/>zero-auth skips resolution"]
A5["5 Weights materialization"]
A6["6 Runtime storage"]
END1(["materialize ends here"])
A7["7 Runtime<br/>self-hosted or proxy"]
A8{{"8 Observation"}}
A9{{"9 Readiness gate<br/>inference probe on readiness_check"}}
A1 --> A2 --> A3 --> A4 --> A5 --> A6
A6 -.->|"phase materialize"| END1
A6 --> A7 --> A8 --> A9
The three preflights change nothing in your cluster. A deployment the node cannot honour under its attested network posture, its GPU modes or its replica bounds is refused before any object is created. Each step has one failure code:
| Step | Code |
|---|---|
| 1 | MODEL_SERVE_AIRGAPPED_PREFLIGHT_FAILED |
| 2 | MODEL_SERVE_GPU_SHARING_PREFLIGHT_FAILED |
| 3 | MODEL_SERVE_SCALING_PREFLIGHT_FAILED |
| 4 | The reason in the fetch record; see XSRP resolution |
| 5 | MODEL_SERVE_MATERIALIZATION_ACTUATION_FAILED |
| 6 | MODEL_SERVE_RUNTIME_STORAGE_ACTUATION_FAILED |
| 7 | MODEL_SERVE_SELF_HOSTED_RUNTIME_ACTUATION_FAILED or MODEL_SERVE_PROXY_RUNTIME_ACTUATION_FAILED |
| 8 | MODEL_SERVE_RUNTIME_OBSERVER_FAILED |
| 9 | MODEL_SERVE_INFERENCE_PROBE_FAILED, or the materialization code when the weights are not ready |
See Airgapped execution runtime, GPU sharing runtime and Serve observation and evidence.
Model secrets¶
A model document holds no secret. A model-serving assignment resolves the keys
its project declares like any other assignment: the project's auth.xratu
maps each consumer to a workspace SecretBinding, the control plane derives a
grant for the serve assignment, and step 4 resolves it through your XSRP
gateway. A project with no declared keys skips step 4. See
Model-serving secret resolution
and Declared auth binding delivery.
Weights materialization¶
The materialization contract, model.serve.materialization.v1, names a
runtime path, the weights lane and a stage job policy. It is required for any
model served from its own weights; a proxy model has nothing to materialize.
Runtime paths¶
A runtime path names where the weights come from and where they land. The node
accepts only paths registered as promoted, and checks the contract against the
path's descriptor, model.serve.materialization.runtime_path_support.v1:
staging, stage handler, weights mode and delivery must all match.
| Path | Source | Lands in | Stage handler |
|---|---|---|---|
hf_direct_staged_pvc |
Hugging Face Hub | Volume | hf_required_stage |
hf_direct_staged_bucket |
Hugging Face Hub | Bucket | hf_required_stage |
hf_bucket_staged_bucket |
A Hugging Face snapshot in your bucket | Bucket | hf_required_stage |
ollama_direct_staged_pvc |
Ollama registry | Volume | ollama_required_stage |
ollama_direct_staged_bucket |
Ollama registry | Bucket | ollama_required_stage |
ollama_bucket_staged_pvc, ollama_bucket_required_staged_pvc |
An Ollama snapshot in your bucket | Volume | ollama_required_stage |
ollama_bucket_staged_bucket, ollama_bucket_required_staged_bucket |
An Ollama snapshot in your bucket | Bucket | none |
api_direct_passthrough |
A hosted provider | Nothing | none |
A staged path delivers the weights to the runtime as a mount; the passthrough
path delivers nothing. A path outside the registry, or a contract that
disagrees with its path, fails with
MODEL_SERVE_MATERIALIZATION_EXECUTION_UNSUPPORTED.
The two weights lanes¶
flowchart TB
subgraph SRC["MODEL SOURCE"]
direction LR
HUB[("Hugging Face Hub<br/>or Ollama registry")]
BKT[("Your bucket")]
end
subgraph PVC["pvc lane"]
direction TB
JOB["Stage job<br/>in the model namespace"]
VOL[("PersistentVolumeClaim<br/>claim_ref, size, storage_class")]
JOB ==> VOL
end
subgraph BUK["bucket lane"]
direction TB
ING["Snapshot ingest<br/>into your bucket"]
SNAP[("Verified snapshot<br/>_xratu_manifest.json")]
INIT["Init container<br/>weights-bucket-stage"]
ING ==> SNAP ==> INIT
end
ENG["Engine container<br/>weights at the runtime source path"]
HUB ==> JOB
BKT ==> JOB
HUB ==> ING
SNAP -.->|"reused when present"| INIT
VOL -->|"mounted"| ENG
INIT -->|"emptyDir"| ENG
The pvc lane stages the weights once onto a volume. The contract must name
claim_ref, size, storage_class and mount_path, and the engine mounts the
volume at that path. The node binds the claim, runs a stage job that writes the
snapshot onto it, and records the lane as bound.
The bucket lane keeps the weights in your bucket. The contract names none
of the volume fields and takes the source bucket URI. The snapshot is ingested
into the bucket with a verified manifest when it is missing, and each runtime
pod copies it into an emptyDir with an init container before the engine
starts. See Snapshot ingest runtimes.
A volume survives a scale to zero with the weights on it; a bucket keeps them outside the cluster. The control plane reads which lane a model uses before it scales it to zero.
Stage jobs¶
A stage job runs in the model namespace, xratu-models unless the contract
names another, under the stage job policy model.stage_job_policy.v1:
| Policy field | Default |
|---|---|
backoff_limit |
0 |
active_deadline_seconds |
3600 |
retry_budget |
1 |
cancellation_mode |
graceful, or force |
| Requests | 200m CPU, 512Mi memory |
| Limits | 1 CPU, 2Gi memory |
A failed job is deleted and started again under the next attempt until the
retry budget is used up. The attempt, the budget and the cancellation mode are
recorded on the job as xratu.io/stage-retry-attempt,
xratu.io/stage-retry-budget and xratu.io/stage-cancellation-mode. The job
reports its result on one log line, prefixed XRATU_HF_STAGE_RESULT= or
XRATU_OLLAMA_STAGE_RESULT=. On the pvc lane it records each file it has
written, with its size and SHA-256, in .xratu-stage-checkpoint.json on the
volume, so a restarted job resumes where the last one stopped. The staged tree carries _xratu_manifest.json, which the
readiness gate checks.
Materialization evidence¶
The node reports model.serve.materialization_evidence.v1 and, for the
runtime's input, model.serve.runtime_input_evidence.v1:
| Situation | status |
Cleanup |
|---|---|---|
| No weights to materialize | not_required |
|
Phase materialize |
materialized |
|
| Runtime starting or running | mounted or materialized |
pending_cleanup |
Phase serve_stop |
detached |
completed |
The weights lane inside it carries the staged reference, the manifest and
snapshot digests, and the files and bytes transferred and resumed. The readiness
gate accepts a materialization that is mounted or materialized with a lane
that is bound, staged, mounted or materialized.
| Code | Condition |
|---|---|
MODEL_SERVE_MATERIALIZATION_CONTRACT_INVALID |
The contract is malformed |
MODEL_SERVE_MATERIALIZATION_PHASE_INVALID |
The phase is outside the four |
MODEL_SERVE_MATERIALIZATION_MODE_INVALID |
The lane is neither pvc nor bucket, or carries the other lane's fields |
MODEL_SERVE_MATERIALIZATION_EXECUTION_UNSUPPORTED |
The runtime path is unregistered or disagrees with its descriptor |
MODEL_SERVE_MATERIALIZATION_NAMESPACE_PRECONDITION_FAILED |
The model namespace is missing |
MODEL_SERVE_MATERIALIZATION_COMMAND_FAILED |
Applying or reading a cluster object failed |
Runtime storage¶
The runtime storage contract, model.serve.runtime_storage.v1, gives an engine
a cache volume that outlives its pods. Its cache mode is none or pvc; with
pvc the node binds the named claim and the engine mounts it read-write at the
contract's mount path. A failure reports a MODEL_SERVE_RUNTIME_STORAGE_* code.