podgroup: count only Pods in the PodGroup's namespace #1034
<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 |
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:
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>
/ok-to-test
This fixes a PodGroup status bug where Pods from another namespace could be counted toward a same named PodGroup, incorrectly marking it as Failed.
[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:
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"]} -->
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?
googs1025
lkhun9311
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-grouplabel alone, so Pods in other namespaces that use the same PodGroup name were counted too. A PodGroup could then be markedFailedby Pods it does not own, and sinceFailedis 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:
TestReconcileIgnoresPodsInOtherNamespacescreates a PodGroup with no Pods of its own indefaultand two failed Pods with the same pod-group label in another namespace. Without the change it fails:With the change it passes, and
go test ./pkg/controllers/andgo 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.