-
Notifications
You must be signed in to change notification settings - Fork 39.4k
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
pod quota evaluator adds termination grace period twice #84459
Comments
/sig scheduling |
@bazzargh |
@tedyu no, for 2 reasons - I'm not familiar enough with that quota code to write an appropriate test, and legal at $job would take an age to approve me signing the CLA (they would eventually, it's just slow - and I |
The following code from staging/src/k8s.io/apiserver/pkg/registry/rest/delete.go around line 117 verifies your assumption:
|
It seems we have signed the CLA as an org already, getting my name added to our authorised users list so I can send a patch |
You can submit PRs directly. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
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/test-infra repository. |
What happened:
Dev asked me to explain why deletionTimestamps for pods were in the future, went to find the line that added the grace period before setting the timestamp and found this:
kubernetes/pkg/quota/v1/evaluator/core/pods.go
Line 398 in 5856397
if now.After(deletionTime.Add(gracePeriod)) {
What you expected to happen:
this code seems wrong in a couple of ways. deletionTimestamp already has the grace period added here (the line of code I was looking for...):
https://github.com/kubernetes/apiserver/blob/d1b1b64dd9245cc8aa4391714eaad8eef96fe5a9/pkg/registry/rest/delete.go#L132-L133
staging link for embed:
kubernetes/staging/src/k8s.io/apiserver/pkg/registry/rest/delete.go
Lines 132 to 133 in 5856397
...what is more, the grace period applied for a deletion may not be the grace period that applied to any given deletion. By just comparing to the deletionTimestamp, it would make the correct comparison. Furthermore, since deletion timestamps can be in the future, the quota evaluator should be checking deletionTimestamps, whether or not the pod had a grace period set.
Suggested fix to the quota evaluator would be:
How to reproduce it (as minimally and precisely as possible):
It's a code review issue, you just need to read the code at the two links above.
Anything else we need to know?:
Environment:
kubectl version
): master (in the links above I selected master branch then pressed 'y' in github to get latest commit)cat /etc/os-release
): N/Auname -a
): N/AThe text was updated successfully, but these errors were encountered: