← Back to Pull requests

podgroup: count only Pods in the PodGroup's namespace #1034

Open
lkhun9311 opened this pull request with 33 lines diff across 2 files
View on GitHub
lkhun9311 lkhun9311 commented on Nov 19, 2026 05:19 UTC
Author

What type of PR is this?

/kind bug

What this PR does / why we need it:

The PodGroup controller listed a PodGroup's Pods by the scheduling.x-k8s.io/pod-group label alone, so Pods in other namespaces that use the same PodGroup name were counted too. A PodGroup could then be marked Failed by Pods it does not own, and since Failed is terminal it was never corrected.

The list now also uses client.InNamespace(pg.Namespace), the same way the ElasticQuota controller in this package scopes its Pod list.

Which issue(s) this PR fixes:

Fixes #1031

Special notes for your reviewer:

TestReconcileIgnoresPodsInOtherNamespaces creates a PodGroup with no Pods of its own in default and two failed Pods with the same pod-group label in another namespace. Without the change it fails:

podgroup_controller_test.go:223: want phase Pending, got Failed
podgroup_controller_test.go:226: want 0 failed pods, got 2

With the change it passes, and go test ./pkg/controllers/ and go vet ./pkg/controllers/ pass.

Does this PR introduce a user-facing change?

``release-note
The PodGroup controller now counts only the Pods in the PodGroup's own namespace.
``

Diff: 33 lines (+33 / -0) across 2 files Reviewer: googs1025 Review duration: 1942m
All Vouch review confidence checks passed
Residual risk 0.04 = Change Risk (0.26) × (1 − Review Confidence (0.86)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.26 · 33 lines diff across 2 files
0.26
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.91 · 5 substantive comment(s)
0.91
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
86%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.211
Real PR Conversation Timeline
8 items
netlify[bot] netlify[bot] commented on Nov 19, 2026 05:19 UTC
Bot

<span aria-hidden="true">👷</span> Deploy request for kubernetes-sigs-scheduler-plugins pending review.


Visit the deploys page to approve it

| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | a279b526f4b65d815d4f1a148b01afb4067894e7 |

kubernetes-prow[bot] kubernetes-prow[bot] commented on Nov 19, 2026 05:20 UTC
Bot

Welcome @lkhun9311! <br><br>It looks like this is your first PR to <a href='https://github.com/kubernetes-sigs/scheduler-plugins'>kubernetes-sigs/scheduler-plugins</a> 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval. <br><br>You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation. <br><br>You can also check if kubernetes-sigs/scheduler-plugins has its own contribution guidelines. <br><br>You may want to refer to our testing guide if you run into trouble with your tests not passing. <br><br>If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs! <br><br>Thank you, and welcome to Kubernetes. :smiley:

kubernetes-prow[bot] kubernetes-prow[bot] commented on Nov 19, 2026 05:20 UTC
Bot

Hi @lkhun9311. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

<details>

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
</details>

googs1025 googs1025 commented on Nov 19, 2026 07:48 UTC
Contributor

/ok-to-test

googs1025 googs1025 approved these changes on Nov 19, 2026 08:03 UTC
Approved Reviewer

This fixes a PodGroup status bug where Pods from another namespace could be counted toward a same named PodGroup, incorrectly marking it as Failed.

kubernetes-prow[bot] kubernetes-prow[bot] commented on Nov 19, 2026 08:03 UTC
Bot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: <a href="https://github.com/kubernetes-sigs/scheduler-plugins/pull/1034#pullrequestreview-5971306167" title="Approved">googs1025</a>, <a href="https://github.com/kubernetes-sigs/scheduler-plugins/pull/1034#" title="Author self-approved">lkhun9311</a>
Once this PR has been reviewed and has the lgtm label, please assign ffromani for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

<details open>
Needs approval from an approver in each of these files:

  • OWNERS
  • Approvers can indicate their approval by writing /approve in a comment
    Approvers can cancel approval by writing /approve cancel in a comment
    </details>
    <!-- META={"approvers":["ffromani"]} -->

    lkhun9311 lkhun9311 commented on Nov 20, 2026 13:14 UTC
    Author

    Thanks @googs1025 for the review. The GitHub approval didn't add the lgtm label here; if it still looks good to you, could you comment /lgtm?

    Reviewers
    Assignees
    lkhun9311 lkhun9311
    Labels
    risk: low confidence: 86.1% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 25.6% (LOW) · Higher = larger blast radius
    25.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 86.1% · Lower = rushed or shallow review
    86.1%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 3.6% · Safe to merge
    3.6%