@@ -19,6 +19,7 @@ package main
19
19
20
20
import (
21
21
"context"
22
+ "errors"
22
23
"flag"
23
24
"fmt"
24
25
"os"
@@ -103,6 +104,7 @@ var (
103
104
syncPeriod time.Duration
104
105
restConfigQPS float32
105
106
restConfigBurst int
107
+ nodeDrainClientTimeout time.Duration
106
108
webhookPort int
107
109
webhookCertDir string
108
110
healthAddr string
@@ -205,6 +207,9 @@ func InitFlags(fs *pflag.FlagSet) {
205
207
fs .IntVar (& restConfigBurst , "kube-api-burst" , 30 ,
206
208
"Maximum number of queries that should be allowed in one burst from the controller client to the Kubernetes API server. Default 30" )
207
209
210
+ fs .DurationVar (& nodeDrainClientTimeout , "node-drain-client-timeout-duration" , time .Second * 10 ,
211
+ "The timeout of the client used for draining nodes. Defaults to 10s" )
212
+
208
213
fs .IntVar (& webhookPort , "webhook-port" , 9443 ,
209
214
"Webhook Server port" )
210
215
@@ -238,6 +243,11 @@ func main() {
238
243
restConfig .Burst = restConfigBurst
239
244
restConfig .UserAgent = remote .DefaultClusterAPIUserAgent (controllerName )
240
245
246
+ if nodeDrainClientTimeout <= 0 {
247
+ setupLog .Error (errors .New ("node drain client timeout must be greater than zero" ), "unable to start manager" )
248
+ os .Exit (1 )
249
+ }
250
+
241
251
minVer := version .MinimumKubernetesVersion
242
252
if feature .Gates .Enabled (feature .ClusterTopology ) {
243
253
minVer = version .MinimumKubernetesVersionClusterTopology
@@ -475,6 +485,7 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager) {
475
485
APIReader : mgr .GetAPIReader (),
476
486
Tracker : tracker ,
477
487
WatchFilterValue : watchFilterValue ,
488
+ NodeDrainClientTimeout : nodeDrainClientTimeout ,
478
489
}).SetupWithManager (ctx , mgr , concurrency (machineConcurrency )); err != nil {
479
490
setupLog .Error (err , "unable to create controller" , "controller" , "Machine" )
480
491
os .Exit (1 )
0 commit comments