Skip to content

feat(compute): manage clusters, machines and GPUs with infer compute - #1763

Merged
edenreich merged 2 commits into
mainfrom
feat/compute-commands
Nov 8, 2026
Merged

edenreich merged 2 commits into
mainfrom
feat/compute-commands

Conversation

@edenreich

@edenreich edenreich commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1761

Follows #1762, which is merged. This branch is rebased onto main with only its own two commits.

Summary

Compute gets its own bounded context, and the CLI gets commands for it.

  • internal/compute holds the GPU model and its rules in domain/. infrastructure/runpod translates RunPod's API into that domain, and infrastructure/kubernetes connects to a cluster and checks it.
  • infer compute clusters and infer compute machines add, list, check and remove what is in compute.yaml.
  • infer gpu becomes infer compute gpus, and the old name stays as a hidden, deprecated alias.
infer compute clusters  add | list | status | remove
infer compute machines  add | list | status | remove
infer compute gpus      provision | list | status | destroy

Changes

  • GPUs
    • internal/provisioner moves to internal/compute/infrastructure/runpod. RunPod's JSON stays in private wire structs, and every method returns domain values: GPU types, instances and provision requests.
    • internal/compute/domain has the GPU rules: the hourly price (community, else secure), the spending cap, and uptime and spend so far. infer gpu repeated the price rule in two places, and both now use the domain's.
    • The RunPod API key is RUNPOD_API_KEY in the environment or ~/.infer/auth.yaml, and a key asked for on first use is saved there by the new config.SetAuthKey, which keeps the other entries and the file at 0600. GPU defaults and max_hourly move under gpus in compute.yaml.
    • The old provisioner block and key in config.yaml, or INFER_PROVISIONER_RUNPOD_API_KEY, still work with a warning that points at the new place.
    • The commands print through the command instead of fmt.Printf, so tests can capture their output.
  • Clusters and machines
    • internal/compute/infrastructure/kubernetes builds a cluster's clients, checks it runs the operator, reads its Kubernetes version and reports its status. The agent's Kubernetes workspace now connects and checks through it, and its errors read word for word as before.
    • Each session's Orchestrator is labelled with its cluster, so infer compute clusters status counts the sessions of every workspace on it.
    • add and remove edit compute.yaml as written, through a loader that does not expand ${VAR}, so a reference is saved back as a reference and never as the secret. remove refuses compute a workspace in daemon.yaml still runs on.
    • status checks every cluster or machine at once, each with its own timeout and its own result slot. A machine is probed the way the daemon probes a daemon-kind workspace. machines list never prints a token.
    • A cluster name must be a Kubernetes label value, because it labels the Gateway and the sessions.
  • Wiring
    • The depguard rule for client-go also allows compute's Kubernetes adapter.
    • infer --help lists compute under a Platform group.
    • AGENTS.md lists the compute context and the computedomain alias.
  • Docs: the commands reference, the configuration reference and the gpu-provisioning example move to infer compute.

Verification

  • An in-memory test drives infer compute through a fresh state and SetArgs. It adds a cluster and a machine, refuses a duplicate name and a missing namespace, keeps a ${VAR} token as written and out of machines list, refuses to remove a cluster a workspace uses, and removes a machine.
  • Unit tests cover the domain rules, the RunPod adapter, RunPod key precedence, GPU settings with the legacy fallback, SetAuthKey, cluster status against a fake cluster with and without the operator, the compute label on Orchestrators, and concurrent checks keeping their order.
  • A smoke run against a throwaway home added, listed and removed compute, and reported an unreachable cluster and machine as rows.
  • go test ./... passes, the new packages pass under -race, the pre-commit hook passes, and task test:e2e passes.

Not done here

Docs follow-up: inference-gateway/docs#1131.

@edenreich
edenreich requested a review from a team as a code owner November 8, 2026 16:25
@github-project-automation github-project-automation Bot moved this to Todo in 2026 Nov 8, 2026
Base automatically changed from feat/compute-context to main November 8, 2026 16:47
GPU rental joins the compute context. internal/provisioner moves to internal/compute/infrastructure/runpod, which now translates RunPod's API into compute's domain: GPU types, instances and provision requests, with the hourly price, the spending cap, uptime and spend so far as domain rules. RunPod's JSON no longer leaves the adapter.

infer gpu becomes infer compute gpus. The old name stays as a hidden, deprecated alias. The RunPod API key is read from RUNPOD_API_KEY in the environment or ~/.infer/auth.yaml, and a key asked for on first use is saved there. GPU defaults and max_hourly move under gpus in compute.yaml. The provisioner block and key in config.yaml still work, with a warning that points at the new place.

Refs #1761
The compute context now owns the cluster connection. internal/compute/infrastructure/kubernetes builds the clients from a kubeconfig and context, checks the cluster runs the operator, reads its Kubernetes version and reports its status. The agent's Kubernetes workspace connects through it, and its errors read as before. Each session's Orchestrator is labelled with its cluster, so a cluster's status counts the sessions of every workspace on it.

infer compute clusters and infer compute machines add, list, check and remove compute. add and remove edit compute.yaml as written, so a ${VAR} reference is saved back as a reference, and remove refuses compute a workspace still runs on. status checks every cluster or machine at once, each with its own timeout, and a machine is probed the way the daemon probes a daemon-kind workspace. A cluster name must be a Kubernetes label value, because it labels the Gateway and the sessions. infer --help lists compute under a Platform group.

The gpus commands now print through the command, so tests can capture their output.

Closes #1761
@edenreich
edenreich force-pushed the feat/compute-commands branch from 3455c99 to ee6b12d Compare November 8, 2026 16:49
@edenreich
edenreich merged commit 1d83422 into main Nov 8, 2026
1 check passed
@edenreich
edenreich deleted the feat/compute-commands branch November 8, 2026 17:17
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.249.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Nov 8, 2026
@edenreich edenreich moved this from Todo to Done in 2026 Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[FEATURE] Compute context: clusters, machines and GPUs outside daemon.yaml

1 participant