@@ -117,8 +117,8 @@ var (
117117 errMaxSyncPeriodExceeded = errors .New ("sync period greater than maximum allowed" )
118118 errEKSInvalidFlags = errors .New ("invalid EKS flag combination" )
119119
120- logOptions = logs .NewOptions ()
121- diagnosticsOptions = flags.DiagnosticsOptions {}
120+ logOptions = logs .NewOptions ()
121+ managerOptions = flags.ManagerOptions {}
122122)
123123
124124// Add RBAC for the authorized diagnostics endpoint.
@@ -136,7 +136,10 @@ func main() {
136136 }
137137 ctrl .SetLogger (klog .Background ())
138138
139- diagnosticsOpts := flags .GetDiagnosticsOptions (diagnosticsOptions )
139+ _ , metricsOptions , err := flags .GetManagerOptions (managerOptions )
140+ if err != nil {
141+ setupLog .Error (err , "Unable to start manager: invalid flags" )
142+ }
140143
141144 var watchNamespaces map [string ]cache.Config
142145 if watchNamespace != "" {
@@ -172,7 +175,7 @@ func main() {
172175 restConfig .UserAgent = "cluster-api-provider-aws-controller"
173176 mgr , err := ctrl .NewManager (restConfig , ctrl.Options {
174177 Scheme : scheme ,
175- Metrics : diagnosticsOpts ,
178+ Metrics : * metricsOptions ,
176179 LeaderElection : enableLeaderElection ,
177180 LeaseDuration : & leaderElectionLeaseDuration ,
178181 RenewDeadline : & leaderElectionRenewDeadline ,
@@ -606,5 +609,5 @@ func initFlags(fs *pflag.FlagSet) {
606609
607610 feature .MutableGates .AddFlag (fs )
608611
609- flags .AddDiagnosticsOptions (fs , & diagnosticsOptions )
612+ flags .AddManagerOptions (fs , & managerOptions )
610613}
0 commit comments