@@ -35,6 +35,7 @@ import (
35
35
36
36
nodedisruptionv1alpha1 "github.com/criteo/node-disruption-controller/api/v1alpha1"
37
37
"github.com/criteo/node-disruption-controller/internal/controller"
38
+ "github.com/criteo/node-disruption-controller/pkg/utils"
38
39
//+kubebuilder:scaffold:imports
39
40
)
40
41
@@ -57,7 +58,7 @@ func main() {
57
58
var rejectEmptyNodeDisruption bool
58
59
var retryInterval time.Duration
59
60
var rejectOverlappingDisruption bool
60
- var nodeDisruptionTypes string
61
+ var nodeDisruptionTypesRaw string
61
62
flag .StringVar (& metricsAddr , "metrics-bind-address" , ":8080" , "The address the metric endpoint binds to." )
62
63
flag .StringVar (& probeAddr , "health-probe-bind-address" , ":8081" , "The address the probe endpoint binds to." )
63
64
flag .BoolVar (& enableLeaderElection , "leader-elect" , false ,
@@ -66,7 +67,7 @@ func main() {
66
67
flag .BoolVar (& rejectEmptyNodeDisruption , "reject-empty-node-disruption" , false , "Reject NodeDisruption matching no actual node." )
67
68
flag .DurationVar (& retryInterval , "retry-interval" , controller .DefaultRetryInterval , "How long to wait between each retry (Default 60s)" )
68
69
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." )
70
+ flag .StringVar (& nodeDisruptionTypesRaw , "node-disruption-types" , "" , "The list of types allowed for a node disruption separated by a comma." )
70
71
71
72
opts := zap.Options {
72
73
Development : true ,
@@ -100,14 +101,16 @@ func main() {
100
101
os .Exit (1 )
101
102
}
102
103
104
+ nodeDisruptionTypes := utils .FilterEmptyString (strings .Split (nodeDisruptionTypesRaw , "," ))
105
+
103
106
if err = (& controller.NodeDisruptionReconciler {
104
107
Client : mgr .GetClient (),
105
108
Scheme : mgr .GetScheme (),
106
109
Config : controller.NodeDisruptionReconcilerConfig {
107
110
RejectEmptyNodeDisruption : rejectEmptyNodeDisruption ,
108
111
RetryInterval : retryInterval ,
109
112
RejectOverlappingDisruption : rejectOverlappingDisruption ,
110
- NodeDisruptionTypes : strings . Split ( nodeDisruptionTypes , "," ) ,
113
+ NodeDisruptionTypes : nodeDisruptionTypes ,
111
114
},
112
115
}).SetupWithManager (mgr ); err != nil {
113
116
setupLog .Error (err , "unable to create controller" , "controller" , "NodeDisruption" )
0 commit comments