Skip to content

Commit f5fb5b8

Browse files
committed
update metrics options for new types
1 parent 3fd245f commit f5fb5b8

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

main.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ import (
5050
)
5151

5252
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{}
5656
)
5757

5858
func init() {
@@ -93,7 +93,11 @@ func main() {
9393
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
9494
pflag.Parse()
9595

96-
diagnosticsOpts := flags.GetDiagnosticsOptions(diagnosticsOptions)
96+
// diagnosticsOpts := flags.GetDiagnosticsOptions(diagnosticsOptions)
97+
_, metricsOptions, err := flags.GetManagerOptions(managerOptions)
98+
if err != nil {
99+
setupLog.Error(err, "Unable to start manager: invalid flags")
100+
}
97101

98102
var watchNamespaces map[string]cache.Config
99103
if watchNamespace != "" {
@@ -130,7 +134,7 @@ func main() {
130134

131135
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
132136
Scheme: scheme,
133-
Metrics: diagnosticsOpts,
137+
Metrics: *metricsOptions,
134138
LeaderElection: enableLeaderElection,
135139
LeaderElectionID: "controller-leader-election-capg",
136140
LeaderElectionNamespace: leaderElectionNamespace,
@@ -371,7 +375,7 @@ func initFlags(fs *pflag.FlagSet) {
371375
"The maximum duration a reconcile loop can run (e.g. 90m)",
372376
)
373377

374-
flags.AddDiagnosticsOptions(fs, &diagnosticsOptions)
378+
flags.AddManagerOptions(fs, &managerOptions)
375379

376380
feature.MutableGates.AddFlag(fs)
377381
}

0 commit comments

Comments
 (0)