Merge pull request #30624 from derekwaynecarr/node-controller-fix
Automatic merge from submit-queue Node controller deletePod return true if there are pods pending deletion Fixes https://github.com/kubernetes/kubernetes/issues/30536 If a node had a single pod in terminating state, and that node no longer reported healthy, the pod was never deleted by the node controller because it believed there were no pods remaining. @smarterclayton @ncdc
This commit is contained in:
commit
9ebaf29295
@ -57,7 +57,7 @@ func cleanupOrphanedPods(pods []*api.Pod, nodeStore cache.Store, forcefulDeleteP
|
|||||||
}
|
}
|
||||||
|
|
||||||
// deletePods will delete all pods from master running on given node, and return true
|
// deletePods will delete all pods from master running on given node, and return true
|
||||||
// if any pods were deleted.
|
// if any pods were deleted, or were found pending deletion.
|
||||||
func deletePods(kubeClient clientset.Interface, recorder record.EventRecorder, nodeName, nodeUID string, daemonStore cache.StoreToDaemonSetLister) (bool, error) {
|
func deletePods(kubeClient clientset.Interface, recorder record.EventRecorder, nodeName, nodeUID string, daemonStore cache.StoreToDaemonSetLister) (bool, error) {
|
||||||
remaining := false
|
remaining := false
|
||||||
selector := fields.OneTermEqualSelector(api.PodHostField, nodeName)
|
selector := fields.OneTermEqualSelector(api.PodHostField, nodeName)
|
||||||
@ -76,8 +76,9 @@ func deletePods(kubeClient clientset.Interface, recorder record.EventRecorder, n
|
|||||||
if pod.Spec.NodeName != nodeName {
|
if pod.Spec.NodeName != nodeName {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// if the pod has already been deleted, ignore it
|
// if the pod has already been marked for deletion, we still return true that there are remaining pods.
|
||||||
if pod.DeletionGracePeriodSeconds != nil {
|
if pod.DeletionGracePeriodSeconds != nil {
|
||||||
|
remaining = true
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// if the pod is managed by a daemonset, ignore it
|
// if the pod is managed by a daemonset, ignore it
|
||||||
|
Loading…
Reference in New Issue
Block a user