Repository navigation
feat(compute): manage clusters, machines and GPUs with infer compute - #1763
Merged
Merged
Conversation
4 tasks
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
force-pushed
the
feat/compute-commands
branch
from
November 8, 2026 16:49
3455c99 to
ee6b12d
Compare
Contributor
|
🎉 This PR is included in version 0.249.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1761
Follows #1762, which is merged. This branch is rebased onto
mainwith only its own two commits.Summary
Compute gets its own bounded context, and the CLI gets commands for it.
internal/computeholds the GPU model and its rules indomain/.infrastructure/runpodtranslates RunPod's API into that domain, andinfrastructure/kubernetesconnects to a cluster and checks it.infer compute clustersandinfer compute machinesadd, list, check and remove what is incompute.yaml.infer gpubecomesinfer compute gpus, and the old name stays as a hidden, deprecated alias.Changes
internal/provisionermoves tointernal/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/domainhas the GPU rules: the hourly price (community, else secure), the spending cap, and uptime and spend so far.infer gpurepeated the price rule in two places, and both now use the domain's.RUNPOD_API_KEYin the environment or~/.infer/auth.yaml, and a key asked for on first use is saved there by the newconfig.SetAuthKey, which keeps the other entries and the file at0600. GPU defaults andmax_hourlymove undergpusincompute.yaml.provisionerblock and key inconfig.yaml, orINFER_PROVISIONER_RUNPOD_API_KEY, still work with a warning that points at the new place.fmt.Printf, so tests can capture their output.internal/compute/infrastructure/kubernetesbuilds 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.infer compute clusters statuscounts the sessions of every workspace on it.addandremoveeditcompute.yamlas written, through a loader that does not expand${VAR}, so a reference is saved back as a reference and never as the secret.removerefuses compute a workspace indaemon.yamlstill runs on.statuschecks 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 listnever prints a token.infer --helplists compute under a Platform group.computedomainalias.gpu-provisioningexample move toinfer compute.Verification
infer computethrough a fresh state andSetArgs. It adds a cluster and a machine, refuses a duplicate name and a missing namespace, keeps a${VAR}token as written and out ofmachines list, refuses to remove a cluster a workspace uses, and removes a machine.SetAuthKey, cluster status against a fake cluster with and without the operator, the compute label on Orchestrators, and concurrent checks keeping their order.go test ./...passes, the new packages pass under-race, the pre-commit hook passes, andtask test:e2epasses.Not done here
examples/gpu-provisioning/.env.examplestill namesINFER_PROVISIONER_RUNPOD_API_KEY, which works with a warning. My permissions do not allow reading files named.env*, so renaming it toRUNPOD_API_KEYis left to a follow-up.compute.yaml.Docs follow-up: inference-gateway/docs#1131.