-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Added case on 'terminated-but-not-yet-deleted' for Admit. #48322
Conversation
/assign |
97c2d21
to
2ba70b0
Compare
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main concern is that I think the existing logic of Kubelet is correct. With your change, Kubelet would consider the terminated-but-not-yet-deleted pods as active and would account their resources when admitting a new pod. IMO we shouldn't account resources of terminated pods.
pkg/kubelet/kubelet_pods.go
Outdated
@@ -743,6 +743,20 @@ func (kl *Kubelet) podIsTerminated(pod *v1.Pod) bool { | |||
return status.Phase == v1.PodFailed || status.Phase == v1.PodSucceeded || (pod.DeletionTimestamp != nil && notRunning(status.ContainerStatuses)) | |||
} | |||
|
|||
// podIsFinished returns true if pod is in the finished state ("Failed" or "Succeeded"). | |||
func (kl *Kubelet) podIsFinished(pod *v1.Pod) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I am not sure about podIsFinished
. It is kind of confusing that we have both "podIsTerminated" and "podIsFinished". I don't have any better suggestion though.
pkg/kubelet/kubelet_pods.go
Outdated
@@ -729,7 +729,7 @@ func (kl *Kubelet) getPullSecretsForPod(pod *v1.Pod) []v1.Secret { | |||
return pullSecrets | |||
} | |||
|
|||
// Returns true if pod is in the terminated state ("Failed" or "Succeeded"). | |||
// podIsTerminated returns true if pod is in the terminated state ("Failed", "Succeeded" or "DeletionTimestamp" not nil). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new comment is not accurate. This method return true when "DeletionTimestamp" is not nil AND pod containers are not running.
pkg/kubelet/kubelet_pods.go
Outdated
@@ -743,6 +743,20 @@ func (kl *Kubelet) podIsTerminated(pod *v1.Pod) bool { | |||
return status.Phase == v1.PodFailed || status.Phase == v1.PodSucceeded || (pod.DeletionTimestamp != nil && notRunning(status.ContainerStatuses)) | |||
} | |||
|
|||
// podIsFinished returns true if pod is in the finished state ("Failed" or "Succeeded"). | |||
func (kl *Kubelet) podIsFinished(pod *v1.Pod) bool { | |||
var status v1.PodStatus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to declare this variable explicitly?
@bsalamat , we should account I updated comments to the issue, and update this PR to add a case on |
/retest |
/unassign |
I am not sure if this is the right approach. IMO, kubelet admission logic will become unnecessarily more restrictive after this PR. |
do you mean the latest version? |
The current version of this PR doesn't seem to change the kubelet admission logic -- maybe a commit is missing? |
I think Bobby is talking about previous version :). |
Yes, I was talking about the previous version of this PR. This one only improves a test. /lgtm |
/retest |
/assign @timstclair |
@timstclair , would you help to approve that? |
@timstclair , more comments? |
/approve |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: bsalamat, k82cn, tallclair Assign the PR to them by writing Associated issue: 47867 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/retest |
@tallclair , I think you need to update OWNER in kubelet :). |
/retest |
Automatic merge from submit-queue (batch tested with PRs 48402, 47203, 47460, 48335, 48322) |
What this PR does / why we need it:
Added case on 'terminated-but-not-yet-deleted' for Admit.
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #47867Release note: