Skip to content
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

🐛 Speed up ignoring terminating Pods when draining unreachable Nodes #10706

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions internal/controllers/machine/machine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,18 @@ func (r *Reconciler) drainNode(ctx context.Context, cluster *clusterv1.Cluster,
}

if noderefutil.IsNodeUnreachable(node) {
// When the node is unreachable and some pods are not evicted for as long as this timeout, we ignore them.
drainer.SkipWaitForDeleteTimeoutSeconds = 60 * 5 // 5 minutes
// Kubelet is unreachable, pods will never disappear.

// SkipWaitForDeleteTimeoutSeconds ensures the drain completes
// even if pod objects are not deleted.
drainer.SkipWaitForDeleteTimeoutSeconds = 1

// kube-apiserver sets the `deletionTimestamp` to a future date computed using the grace period.
// We are effectively waiting for GracePeriodSeconds + SkipWaitForDeleteTimeoutSeconds.
// Override the grace period of pods to reduce the time needed to skip them.
drainer.GracePeriodSeconds = 1
sbueringer marked this conversation as resolved.
Show resolved Hide resolved

log.V(5).Info("Node is unreachable, draining will ignore gracePeriod. PDBs are still honored.")
sbueringer marked this conversation as resolved.
Show resolved Hide resolved
}

if err := kubedrain.RunCordonOrUncordon(drainer, node, true); err != nil {
Expand Down
Loading