Skip to content

feat(deployer): support per-workload kubernetes resource injection - #33

Merged
thxCode merged 1 commit into
gpustack:mainfrom
gitlawr:feat/workload-resource-injection-policy
Oct 9, 2026
Merged

thxCode merged 1 commit into
gpustack:mainfrom
gitlawr:feat/workload-resource-injection-policy

Conversation

@gitlawr

@gitlawr gitlawr commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

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

Copilot AI balanced review requested due to automatic review settings October 9, 2026 09:34

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread gpustack_runtime/deployer/kubernetes.py Outdated
Comment thread gpustack_runtime/deployer/kubernetes.py
Comment thread gpustack_runtime/deployer/k8s/devicemanager/__init__.py
Comment thread tests/gpustack_runtime/deployer/test_workload_resource_injection_policy.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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, and KDP policy 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.

Comment thread gpustack_runtime/deployer/kubernetes.py Outdated
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>
@gitlawr
gitlawr force-pushed the feat/workload-resource-injection-policy branch from 2aa16c1 to b8ec4fb Compare October 9, 2026 09:58
@gitlawr
gitlawr requested a review from thxCode October 9, 2026 10:44
@gitlawr
gitlawr force-pushed the feat/workload-resource-injection-policy branch from 2e6ee46 to b8ec4fb Compare October 9, 2026 10:57

@thxCode thxCode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thxCode
thxCode merged commit 089358e into gpustack:main Oct 9, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants