Skip to content

Commit e422ffe

Browse files
taaahaaakubermatic-bot
authored andcommitted
Fix busy loop when pod eviction is blocked during node drain
kubectl v0.35.0 replaced the hardcoded five second sleep between eviction retries with the configurable EvictErrorRetryDelay field on drain.Helper. The field has no default, so KubeOne, which builds the helper itself, retried with no delay and spun as fast as the API server would answer whenever a PodDisruptionBudget blocked a pod. Set it to five seconds, matching kubectl drain. Signed-off-by: t.hosseini <taaahaaa75@gmail.com>
1 parent 63de856 commit e422ffe

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

pkg/nodeutils/drain.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package nodeutils
1818

1919
import (
2020
"context"
21+
"time"
2122

2223
"github.com/sirupsen/logrus"
2324

@@ -86,12 +87,13 @@ func (dr *drainer) drainHelper(ctx context.Context) (*drain.Helper, error) {
8687
Client: kubeClinet,
8788
// Force is used to force deleting standalone pods (i.e. not managed by
8889
// ReplicaSet)
89-
Force: true,
90-
GracePeriodSeconds: -1,
91-
IgnoreAllDaemonSets: true,
92-
DeleteEmptyDirData: true,
93-
Out: loggerIoWriter(dr.logger.Infof),
94-
ErrOut: loggerIoWriter(dr.logger.Errorf),
90+
Force: true,
91+
GracePeriodSeconds: -1,
92+
IgnoreAllDaemonSets: true,
93+
DeleteEmptyDirData: true,
94+
EvictErrorRetryDelay: 5 * time.Second,
95+
Out: loggerIoWriter(dr.logger.Infof),
96+
ErrOut: loggerIoWriter(dr.logger.Errorf),
9597
OnPodDeletedOrEvicted: func(pod *corev1.Pod, usingEviction bool) {
9698
evicted := "evicted"
9799
if !usingEviction {

0 commit comments

Comments
 (0)