Investigate and fix the handling of Succeeded pods in DaemonSet
This commit is contained in:
@@ -75,6 +75,8 @@ const (
|
||||
FailedPlacementReason = "FailedPlacement"
|
||||
// FailedDaemonPodReason is added to an event when the status of a Pod of a DaemonSet is 'Failed'.
|
||||
FailedDaemonPodReason = "FailedDaemonPod"
|
||||
// SucceededDaemonPodReason is added to an event when the status of a Pod of a DaemonSet is 'Succeeded'.
|
||||
SucceededDaemonPodReason = "SucceededDaemonPod"
|
||||
)
|
||||
|
||||
// controllerKind contains the schema.GroupVersionKind for this controller type.
|
||||
@@ -842,6 +844,12 @@ func (dsc *DaemonSetsController) podsShouldBeOnNode(
|
||||
// Emit an event so that it's discoverable to users.
|
||||
dsc.eventRecorder.Eventf(ds, v1.EventTypeWarning, FailedDaemonPodReason, msg)
|
||||
podsToDelete = append(podsToDelete, pod.Name)
|
||||
} else if pod.Status.Phase == v1.PodSucceeded {
|
||||
msg := fmt.Sprintf("Found succeeded daemon pod %s/%s on node %s, will try to delete it", pod.Namespace, pod.Name, node.Name)
|
||||
logger.V(2).Info("Found succeeded daemon pod on node, will try to delete it", "pod", klog.KObj(pod), "node", klog.KObj(node))
|
||||
// Emit an event so that it's discoverable to users.
|
||||
dsc.eventRecorder.Eventf(ds, v1.EventTypeNormal, SucceededDaemonPodReason, msg)
|
||||
podsToDelete = append(podsToDelete, pod.Name)
|
||||
} else {
|
||||
daemonPodsRunning = append(daemonPodsRunning, pod)
|
||||
}
|
||||
|
Reference in New Issue
Block a user