You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Enable leader election for controller manager. "+
61
-
"Enabling this will ensure there is only one active controller manager.")
62
-
flag.StringVar(
63
-
&watchNamespace,
64
-
"namespace",
65
-
"",
66
-
"Namespace that the controller watches to reconcile cluster-api objects. If unspecified, the controller watches for cluster-api objects across all namespaces.",
67
-
)
68
-
flag.Parse()
61
+
klog.InitFlags(nil)
62
+
63
+
initFlags(pflag.CommandLine)
64
+
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
65
+
pflag.Parse()
69
66
70
-
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
67
+
ctrl.SetLogger(klogr.New())
71
68
72
69
ifwatchNamespace!="" {
73
70
setupLog.Info("Watching cluster-api objects only in namespace for reconciliation", "namespace", watchNamespace)
@@ -128,3 +125,27 @@ func main() {
128
125
os.Exit(1)
129
126
}
130
127
}
128
+
129
+
funcinitFlags(fs*pflag.FlagSet) {
130
+
fs.StringVar(
131
+
&metricsAddr,
132
+
"metrics-bind-addr",
133
+
":8080",
134
+
"The address the metric endpoint binds to.",
135
+
)
136
+
137
+
fs.BoolVar(
138
+
&enableLeaderElection,
139
+
"leader-elect",
140
+
false,
141
+
"Enable leader election for controller manager. "+
142
+
"Enabling this will ensure there is only one active controller manager.",
143
+
)
144
+
145
+
fs.StringVar(
146
+
&watchNamespace,
147
+
"namespace",
148
+
"",
149
+
"Namespace that the controller watches to reconcile cluster-api objects. If unspecified, the controller watches for cluster-api objects across all namespaces.",
0 commit comments