Skip to content
Opod

Core reference

Plan file

The JSON plan a manager mounts for a leader — every field the leader reads, what each one changes, how the file is watched, and how the leader heals declared gangs.

In short

The plan file is a JSON document a manager writes to say what one endpoint is: its one model, its revision, adapters, request size and gangs. A leader that finds it at start serves that model only and re-reads the file every 10 seconds. Without it, the leader is unrestricted.

{ "revision": 7, "model": { "id": "qwen2.5-7b-instruct" } }

The plan says what one endpoint is: its one model, how it scales, the adapters it serves, the request size it is sized for, and its gangs. A manager writes it; the leader reads it and serves within it.

SettingValue
PathOPOD_PLAN_FILE, default /etc/opod/plan.json
Watchedonly when the file exists when the leader starts. Without it the leader is standalone and unrestricted, and a file created later is not picked up until a restart.
Re-readevery 10 seconds, when the file's modification time is newer than the last good read. No restart.
Bad JSONlogged (plan file unreadable — keeping last good plan) and ignored; the last good plan stays in force and the file is read again every 10 seconds until it parses.
Unknown fieldsignored, so the plan can carry a manager's own data.
Eventa change of revision or model.id records plan.updated with the revision, and logs plan file applied.

Fields the leader reads

{
  "revision": 7,
  "model": { "id": "qwen2.5-7b-instruct" },
  "autoscale": { "floor": 0, "max": 4 },
  "adapters": [ { "name": "sql" }, { "name": "support" } ],
  "workload": { "inputTokens": 4000, "outputTokens": 1000, "maxContext": 8192 },
  "shardGroups": [
    {
      "id": "g0",
      "parts": [ {}, {} ],
      "parallelism": { "tensor": 1, "pipeline": 2, "expert": false },
      "devicesPerPart": 1,
      "flags": { "ctx": "8192" },
      "parked": false
    }
  ]
}
FieldTypeEffect
revisionintegerShown as plan_revision on /loadz, so you can see which revision a leader observes.
model.idstringThe endpoint's one model (below). Empty = no model restriction.
autoscale.floor, autoscale.maxintegersWith max > 0 and floor == 0, zero serving capacity is a healthy, parked state: /readyz answers 200 with mode sleeping or waking instead of 503 degraded.
adapters[].namestringsThe LoRA adapters this endpoint serves. Empty names are skipped. Empty list = no adapter check.
workload.maxContextintegerThe longest request a worker must hold, in tokens. When 0, inputTokens + outputTokens is used.
workload.inputTokens, workload.outputTokensintegersUsed only when maxContext is 0.
shardGroups[]arrayThe gangs the endpoint declares (below).

One model per endpoint

With model.id set, the leader serves that model only. It passes:

  • the catalog id itself;
  • any engine-native name of it (for example the Ollama tag an engine reports);
  • <model>:<adapter> for a LoRA adapter, when adapters names it or names none.

Anything else is refused before routing, with 404 and error.type not_found:

this endpoint serves only qwen2.5-7b-instruct (requested llama-3.2-3b)
this endpoint serves only qwen2.5-7b-instruct with adapters sql, support (requested qwen2.5-7b-instruct:legal)

Workload and the KV bound

With a workload context, admission counts no more requests at once per worker than that worker's KV-cache pool holds at that context; /loadz then reports admission_bound: kv. No workload means no KV bound, and admission holds a worker to its engine's slots only. A change of the context re-checks every held request at once.

Gangs

FieldEffect
shardGroups[].idThe gang id. Empty = g0, the default gang.
shardGroups[].partsOne entry per part. Only the count is read; the objects can carry the manager's own data. A gang with no parts is skipped.
shardGroups[].parallelism.tensor, .pipelineTensor- and pipeline-parallel sizes, as for opod shard create --tp/--pp.
shardGroups[].parallelism.experttrue for a vLLM expert-parallel gang.
shardGroups[].devicesPerPartGPUs per part.
shardGroups[].flagsEngine flags (string to string) passed to the gang's coordinator when the leader forms it, for example ctx.
shardGroups[].parkedtrue = scaled to zero on purpose. The leader does not form it.

Gang healing

A leader with a plan heals the gangs the plan declares. This is what lets an endpoint recover a gang while its manager is down: an autoscaler restores the worker pods, and the leader forms the gang on them.

The rule is narrow on purpose:

  1. Every 15 seconds the leader looks at each declared gang that is not parked.
  2. It acts only on a gang with no parts at all. A gang that lost one part is left alone: re-creating it would take down the parts still serving.
  3. The gang must have been completely absent for 45 seconds, so a manager that is doing its job always wins the first race.
  4. Enough free workers must have registered for the gang's part count.
  5. It runs the same create as POST /admin/v1/shards/create, with the plan's parts, parallelism, devices and flags. It does not choose where parts run: the parts are already on the nodes the manager placed them on.

After a failed heal it backs off that gang: 15 s, then 30 s, then 60 s. Each failure records shard.heal_failed with the gang, the plan revision, the create's error.code, the reason, the attempt number and final. After 3 failed attempts at the same gang shape, the last event carries final: true and the leader stops trying that gang.

The back-off and the give-up reset when:

  • a heal succeeds, or the gang appears by any other path;
  • the plan changes that gang's shape (parts, parallelism, devices or flags);
  • the gang leaves the plan's active set (parked or removed) and later comes back.

A new revision alone does not reset them, since an autoscaler writes a revision for every scale. A gang that gave up is the manager's to fix: park it, change its shape, or form it by hand.

While a heal runs, it holds the gang's create guard. A manager's own create of the same gang in that window gets 502 gang_create_in_flight; read shard.heal_failed on the event stream for the leader's verdict.

Revisions and traffic split

Workers state the plan revision they were started for with OPOD_PLAN_REVISION. The policy snapshot's routing.revisions then splits traffic between revision groups, which is how a manager runs a canary. See Policy snapshot.

Write it safely

Write the file atomically (a temporary file, then a rename), or let a ConfigMap mount do it. Create the file before the leader starts: a leader that started without one never watches the path.

Last updated · Source: content/docs/core-reference/plan-file.mdx · View as Markdown