@@ -50,9 +50,9 @@ import (
50
50
)
51
51
52
52
var (
53
- scheme = runtime .NewScheme ()
54
- setupLog = ctrl .Log .WithName ("setup" )
55
- diagnosticsOptions = flags.DiagnosticsOptions {}
53
+ scheme = runtime .NewScheme ()
54
+ setupLog = ctrl .Log .WithName ("setup" )
55
+ managerOptions = flags.ManagerOptions {}
56
56
)
57
57
58
58
func init () {
@@ -93,7 +93,10 @@ func main() {
93
93
pflag .CommandLine .AddGoFlagSet (flag .CommandLine )
94
94
pflag .Parse ()
95
95
96
- diagnosticsOpts := flags .GetDiagnosticsOptions (diagnosticsOptions )
96
+ _ , metricsOptions , err := flags .GetManagerOptions (managerOptions )
97
+ if err != nil {
98
+ setupLog .Error (err , "Unable to start manager: invalid flags" )
99
+ }
97
100
98
101
var watchNamespaces map [string ]cache.Config
99
102
if watchNamespace != "" {
@@ -130,7 +133,7 @@ func main() {
130
133
131
134
mgr , err := ctrl .NewManager (ctrl .GetConfigOrDie (), ctrl.Options {
132
135
Scheme : scheme ,
133
- Metrics : diagnosticsOpts ,
136
+ Metrics : * metricsOptions ,
134
137
LeaderElection : enableLeaderElection ,
135
138
LeaderElectionID : "controller-leader-election-capg" ,
136
139
LeaderElectionNamespace : leaderElectionNamespace ,
@@ -371,7 +374,7 @@ func initFlags(fs *pflag.FlagSet) {
371
374
"The maximum duration a reconcile loop can run (e.g. 90m)" ,
372
375
)
373
376
374
- flags .AddDiagnosticsOptions (fs , & diagnosticsOptions )
377
+ flags .AddManagerOptions (fs , & managerOptions )
375
378
376
379
feature .MutableGates .AddFlag (fs )
377
380
}
0 commit comments