@@ -57,7 +57,7 @@ func main() {
5757 var rejectEmptyNodeDisruption bool
5858 var retryInterval time.Duration
5959 var rejectOverlappingDisruption bool
60- var nodeDisruptionTypes string
60+ var nodeDisruptionTypesRaw string
6161 flag .StringVar (& metricsAddr , "metrics-bind-address" , ":8080" , "The address the metric endpoint binds to." )
6262 flag .StringVar (& probeAddr , "health-probe-bind-address" , ":8081" , "The address the probe endpoint binds to." )
6363 flag .BoolVar (& enableLeaderElection , "leader-elect" , false ,
@@ -66,7 +66,7 @@ func main() {
6666 flag .BoolVar (& rejectEmptyNodeDisruption , "reject-empty-node-disruption" , false , "Reject NodeDisruption matching no actual node." )
6767 flag .DurationVar (& retryInterval , "retry-interval" , controller .DefaultRetryInterval , "How long to wait between each retry (Default 60s)" )
6868 flag .BoolVar (& rejectOverlappingDisruption , "reject-overlapping-disruption" , false , "Automatically reject any overlapping NodeDisruption (based on node selector), preserving the oldest one" )
69- flag .StringVar (& nodeDisruptionTypes , "node-disruption-types" , "" , "The list of types allowed for a node disruption separated by a comma." )
69+ flag .StringVar (& nodeDisruptionTypesRaw , "node-disruption-types" , "" , "The list of types allowed for a node disruption separated by a comma." )
7070
7171 opts := zap.Options {
7272 Development : true ,
@@ -100,14 +100,16 @@ func main() {
100100 os .Exit (1 )
101101 }
102102
103+ nodeDisruptionTypes := strings .FieldsFunc (nodeDisruptionTypesRaw , func (c rune ) bool { return c == ',' })
104+
103105 if err = (& controller.NodeDisruptionReconciler {
104106 Client : mgr .GetClient (),
105107 Scheme : mgr .GetScheme (),
106108 Config : controller.NodeDisruptionReconcilerConfig {
107109 RejectEmptyNodeDisruption : rejectEmptyNodeDisruption ,
108110 RetryInterval : retryInterval ,
109111 RejectOverlappingDisruption : rejectOverlappingDisruption ,
110- NodeDisruptionTypes : strings . Split ( nodeDisruptionTypes , "," ) ,
112+ NodeDisruptionTypes : nodeDisruptionTypes ,
111113 },
112114 }).SetupWithManager (mgr ); err != nil {
113115 setupLog .Error (err , "unable to create controller" , "controller" , "NodeDisruption" )
0 commit comments