@@ -58,7 +58,7 @@ func main() {
58
58
var customConfigPath string
59
59
flag .StringVar (& metricsAddr , "metrics-bind-address" , ":8080" , "The address the metric endpoint binds to." )
60
60
flag .StringVar (& probeAddr , "health-probe-bind-address" , ":8081" , "The address the probe endpoint binds to." )
61
- flag .StringVar (& customConfigPath , "custom-config-path" , "./custom/config.yaml " , "the path to custom config." )
61
+ flag .StringVar (& customConfigPath , "custom-config-path" , "" , "the path to custom config." )
62
62
flag .BoolVar (& enableLeaderElection , "leader-elect" , false ,
63
63
"Enable leader election for controller manager. " +
64
64
"Enabling this will ensure there is only one active controller manager." )
@@ -69,12 +69,19 @@ func main() {
69
69
flag .Parse ()
70
70
71
71
ctrl .SetLogger (zap .New (zap .UseFlagOptions (& opts )))
72
- customConfig , err := config .InitConfig (customConfigPath )
73
- if err != nil {
74
- setupLog .Info ("custom config not loaded" )
75
- } else {
76
- authenticatorv1alpha1 .ValidationTimeout = time .Second * time .Duration (customConfig .WebhookConf .ValidationTimeoutSecond )
72
+
73
+ var customConfig * config.CustomConfig
74
+ if customConfigPath != "" {
75
+ setupLog .Info (customConfigPath )
76
+ tmpConf , err := config .InitConfig (customConfigPath )
77
+ if err != nil {
78
+ setupLog .Error (err , "failed to load custom config" )
79
+ } else {
80
+ customConfig = tmpConf
81
+ authenticatorv1alpha1 .ValidationTimeout = time .Second * time .Duration (customConfig .WebhookConf .ValidationTimeoutSecond )
82
+ }
77
83
}
84
+
78
85
mgr , err := ctrl .NewManager (ctrl .GetConfigOrDie (), ctrl.Options {
79
86
Scheme : scheme ,
80
87
MetricsBindAddress : metricsAddr ,
0 commit comments