Missing Test for InitContainers & EphemeralContainers GPU Quota Checks - #2367
Missing Test for InitContainers & EphemeralContainers GPU Quota Checks#2367aniket866 wants to merge 1 commit into
Conversation
Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: aniket866 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe GPU pair scoring path now handles asymmetric NVML P2P-link counts without panicking. It logs a warning and returns zero scores. A regression test covers both directions, and the changelog records the fix. ChangesAsymmetric GPU link handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Warning |
|
pls read and understand what are you doing with codes first |
Path Under Test
fitResourceQuota)Explanation & Bug Gap
The admission webhook's quota controller only checks resource limits inside
pod.Spec.Containers. If a pod runs anInitContainerrequesting GPUs, the quota checks are bypassed entirely. The current tests inwebhook_test.goonly verify resource configurations within regular containers.Why Add This Test
To verify that init containers and ephemeral containers cannot bypass namespace GPU quota constraints, ensuring proper resource isolation inside multi-tenant clusters.
Mermaid Diagram
graph TD A[Test Case: InitContainer with GPUs] --> B[fitResourceQuota] B --> C{Scan Containers, InitContainers} C --> D[Aggregate Total GPU Core/Memory] D --> E{Exceeds Quota?} E -- Yes --> F[Assert: Webhook Denies Admission] E -- No --> G[Assert: Webhook Allows Admission]Proposed Test Implementation
Create a test inside
webhook_test.gothat mocks an admission request for a Pod whereSpec.InitContainersrequests a GPU count or memory limit exceeding the namespace resource quota. Assert that the admission response hasAllowed: falseand mentions exceeding the quota.Summary by CodeRabbit
Bug Fixes
Documentation