refactor(scheduler): get rid of app-level GPU management#19
Merged
Conversation
6 tasks
This was referenced Jun 8, 2026
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.
Overview
Companion to Olares#3112, which moves all per-app GPU allocation logic into
app-service. This PR strips the now-unused app-level GPU management surface from HAMi and extends theGPUBindingschema with the fields the new owner (app-service) needs to disambiguate bindings across multi-tenant installs.Net change: 6 files, +56 / −1229.
What changes
1. Drop the app-level GPU management HTTP surface
pkg/scheduler/routes/gpu_manage.go(867 lines) is deleted in full. The following endpoints no longer exist on the HAMi scheduler:GET /gpusPUT /gpus/assignments/bulkPOST /gpus/:id/modePOST /gpus/:id/assignPOST /gpus/:id/unassignTheir replacements live in app-service under
/compute-resources/*(see the Olares PR). HAMi keeps the standard scheduler-extender surface (/filter,/bind,/webhook,/healthz) and that's it.cmd/scheduler/main.gois updated accordingly — the routes above are removed, and theCleanupGPUBindingsLoopgoroutine is no longer started because app-service is now the sole writer ofGPUBindingobjects and is responsible for their lifecycle. The--cleanup-startup-delayflag stays (it still gatesCleanupPodsWithMissingDevicesLoop).2.
GPUBindingCRD gainsspec.ownerandspec.namespaceBoth
charts/hami/crds/gpu.bytetrade.io_gpubindings.yamlandpkg/api/gpu/v1alpha1/gpubinding_types.goare updated. The fields are optional for backward compatibility, but app-service always populates them on newly-created bindings so the scheduler can tell apart two installs of the same app by different users.3. Scheduler filter matches on the new identity tuple
pkg/scheduler/scheduler.goshrinks from ~400 lines of GPU-management logic to ~47 lines focused purely on the filter path. The scheduler still selects which GPUs to bind a pod to, but it no longer:CleanupGPUBindingsLoop(app-service handles this in install/suspend/uninstall),selectDynamicGPUCandidatesfor dynamic candidate picking (app-service does the picking and writes the binding before the pod is scheduled).Matching is now keyed off a new
appBindingIdentity{appName, owner, namespace}tuple computed from pod labels (applications.app.bytetrade.io/name,applications.app.bytetrade.io/owner) and the pod's namespace, so a pod from useraliceand a pod from userbobfor the samecomfyuiapp never collide on each other's bindings.4. New
AppOwnerLabelKeyconstantpkg/util/types.goadds:Mirrors the existing
AppNameLabelKey; used by the scheduler when building the identity tuple above.Compatibility notes
GPUBindingobjects withoutspec.owner/spec.namespacecontinue to match byappNamealone. Olares ships a migration (in Olares#3112 follow-ups) that backfills these fields during upgrade./gpus*endpoints must move to the new/compute-resources/*surface on app-service. There are no in-cluster callers of the old endpoints in beclab./filter,/bind,/webhook) is unchanged — Kubernetes scheduler integration is untouched.Test plan
go build ./...andgo vet ./.../healthzrespondsGPUBindingGPUBindingrows and don't pick each other's UUIDs/gpus*routesMade with Cursor