Repository navigation
feat(deployer): support per-workload kubernetes resource injection - #33
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a workload-specific resource_injection_policy override for Kubernetes deployments, adding the KubernetesResourceInjectionPolicyEnum and updating the deployer to copy itself for concurrent, policy-independent workload creation. Feedback on these changes highlights a performance bottleneck where resetting _materials forces slow device detection on every workload creation, suggesting a caching mechanism instead. Additionally, it is recommended to make the policy enum case-insensitive to gracefully handle lowercase configurations and to update the test suite accordingly.
There was a problem hiding this comment.
🟡 Changes recommended
Per-workload copying breaks canonical node tracking and repeatedly performs full accelerator detection.
1 open finding
What changed in this PR
Adds per-workload Kubernetes GPU resource-injection policy overrides while preserving environment defaults.
Changes:
- Adds
Auto,Env, andKDPpolicy enum and resolution. - Isolates policy-specific workload creation state.
- Adds serialization, validation, precedence, and concurrency tests.
| File | Description |
|---|---|
gpustack_runtime/deployer/kubernetes.py |
Applies per-workload policies during pod creation. |
gpustack_runtime/deployer/k8s/devicemanager/__init__.py |
Defines and resolves injection policies. |
gpustack_runtime/deployer/__init__.py |
Exports the public policy enum. |
tests/gpustack_runtime/deployer/test_workload_resource_injection_policy.py |
Tests policy behavior and isolation. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Allow KubernetesWorkloadPlan to override the worker resource injection policy with a case-insensitive enum while preserving environment defaults. Resolve Auto independently for each workload. Keep target node and mirrored options on the registered deployer. Cache device mappings per resolved policy with synchronized initialization, and keep incomplete detection results out of the cache. ref gpustack/gpustack#6359 Signed-off-by: gitlawr <lawrleegle@gmail.com>
2aa16c1 to
b8ec4fb
Compare
2e6ee46 to
b8ec4fb
Compare

Allow KubernetesWorkloadPlan to override the worker resource injection policy while preserving environment defaults. Resolve Auto per workload and isolate policy-dependent device mappings during concurrent creation.
ref gpustack/gpustack#6359