Skip to content

RemovePodsViolatingNodeTaints: list only pods that are not failed/suceeded #1688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ingvagabund
Copy link
Contributor

@ingvagabund ingvagabund commented May 10, 2025

Listing pods was incorrectly changed to listing all pods during code refactoring in 0ff8ecb#diff-494cd6260fda05699f68c7da810f7814dea797a006afee5380728a6433206fefL82.

…eeded

Listing pods was incorrectly changed to listing all pods during code
refactoring.
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 10, 2025
@a7i
Copy link
Contributor

a7i commented May 10, 2025

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: a7i

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

The pull request process is described here

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 10, 2025
@a7i
Copy link
Contributor

a7i commented May 10, 2025

@ingvagabund thoughts on adding a unit test to avoid similar regression in the future?

@ingvagabund
Copy link
Contributor Author

ingvagabund commented May 11, 2025

Field selectors are not properly implemented in the fake clientset, resp. informer built on top of a fake clientset. There would be no difference on the level of listing pods. You'd need to simulate the field selector filtering by injecting the right list of pods :(. Instead of relying on the functionality of the field selector to exclude the pods. Which is what is required here to properly test the code. The field selector filtering is kube-apiserver functionality.

@googs1025
Copy link
Member

/lgtm

I will add a case where the pod is in failed success phase and the eviction count is 0 in the unit test of each called plugin.
After this PRs are merged, the only plugins that use the ListAllPodsOnANode method are: PodLifeTime RemoveFailedPods RemovePodsHavingTooManyRestarts plugins, because these plugins will filter internally or use the pod.Status.Phase status. 😄

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 12, 2025
@googs1025
Copy link
Member

I will add a case where the pod is in failed success phase and the eviction count is 0 in the unit test of each called plugin.

Since I currently have limited bandwidth, I may have to wait for the weekend to work on this.

@k8s-ci-robot k8s-ci-robot merged commit 9aa6d79 into kubernetes-sigs:master May 12, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants