@@ -184,7 +184,9 @@ func (o *Options) makeTLSConfig() (*tls.Config, error) {
184
184
185
185
func (o * Options ) run (ctx context.Context , controllerCtx * Context , lock * resourcelock.ConfigMapLock ) {
186
186
runContext , runCancel := context .WithCancel (ctx )
187
+ defer runCancel ()
187
188
shutdownContext , shutdownCancel := context .WithCancel (ctx )
189
+ defer shutdownCancel ()
188
190
errorChannel := make (chan error , 1 )
189
191
errorChannelCount := 0
190
192
if o .ListenAddr != "" {
@@ -392,6 +394,7 @@ func (o *Options) NewControllerContext(cb *ClientBuilder) *Context {
392
394
393
395
sharedInformers := externalversions .NewSharedInformerFactory (client , resyncPeriod (o .ResyncInterval )())
394
396
397
+ coInformer := sharedInformers .Config ().V1 ().ClusterOperators ()
395
398
ctx := & Context {
396
399
CVInformerFactory : cvInformer ,
397
400
OpenshiftConfigInformerFactory : openshiftConfigInformer ,
@@ -405,12 +408,11 @@ func (o *Options) NewControllerContext(cb *ClientBuilder) *Context {
405
408
o .PayloadOverride ,
406
409
resyncPeriod (o .ResyncInterval )(),
407
410
cvInformer .Config ().V1 ().ClusterVersions (),
408
- sharedInformers . Config (). V1 (). ClusterOperators () ,
411
+ coInformer ,
409
412
openshiftConfigInformer .Core ().V1 ().ConfigMaps (),
410
413
sharedInformers .Config ().V1 ().Proxies (),
411
414
cb .ClientOrDie (o .Namespace ),
412
415
cb .KubeClientOrDie (o .Namespace , useProtobuf ),
413
- o .ListenAddr != "" ,
414
416
o .Exclude ,
415
417
),
416
418
}
@@ -423,6 +425,11 @@ func (o *Options) NewControllerContext(cb *ClientBuilder) *Context {
423
425
cb .KubeClientOrDie (o .Namespace ),
424
426
)
425
427
}
428
+ if o .ListenAddr != "" {
429
+ if err := ctx .CVO .RegisterMetrics (coInformer .Informer ()); err != nil {
430
+ panic (err )
431
+ }
432
+ }
426
433
return ctx
427
434
}
428
435
0 commit comments