@@ -198,7 +198,8 @@ func istioPodMonitorBuild(ns string) *monitoringv1.PodMonitor {
198
198
APIVersion : monitoringv1 .SchemeGroupVersion .String (),
199
199
},
200
200
ObjectMeta : metav1.ObjectMeta {
201
- Name : istioPodMonitorName ,
201
+ Name : istioPodMonitorName ,
202
+ Namespace : ns ,
202
203
Labels : map [string ]string {
203
204
kuadrant .ObservabilityLabel : "true" ,
204
205
},
@@ -300,7 +301,8 @@ func envoyStatsMonitorBuild(ns string) *monitoringv1.PodMonitor {
300
301
APIVersion : monitoringv1 .SchemeGroupVersion .String (),
301
302
},
302
303
ObjectMeta : metav1.ObjectMeta {
303
- Name : envoyStatsMonitorName ,
304
+ Name : envoyStatsMonitorName ,
305
+ Namespace : ns ,
304
306
Labels : map [string ]string {
305
307
kuadrant .ObservabilityLabel : "true" ,
306
308
},
@@ -353,8 +355,9 @@ func (r *ObservabilityReconciler) Subscription() *controller.Subscription {
353
355
}
354
356
}
355
357
356
- func (r * ObservabilityReconciler ) Reconcile (ctx context.Context , _ []controller.ResourceEvent , topology * machinery.Topology , _ error , _ * sync.Map ) error {
357
- logger := controller .LoggerFromContext (ctx ).WithName ("ObservabilityReconciler" )
358
+ func (r * ObservabilityReconciler ) Reconcile (baseCtx context.Context , _ []controller.ResourceEvent , topology * machinery.Topology , _ error , _ * sync.Map ) error {
359
+ logger := controller .LoggerFromContext (baseCtx ).WithName ("ObservabilityReconciler" )
360
+ ctx := logr .NewContext (baseCtx , logger )
358
361
logger .V (1 ).Info ("reconciling observability" , "status" , "started" )
359
362
defer logger .V (1 ).Info ("reconciling observability" , "status" , "completed" )
360
363
@@ -380,31 +383,19 @@ func (r *ObservabilityReconciler) Reconcile(ctx context.Context, _ []controller.
380
383
381
384
// Kuadrant Operator monitor
382
385
kOpMonitor := kOpMonitorBuild (r .namespace )
383
- err := r .createServiceMonitor (ctx , kOpMonitor , logger )
384
- if err != nil {
385
- return err
386
- }
386
+ r .createServiceMonitor (ctx , kOpMonitor , logger )
387
387
388
388
// DNS Operator monitor
389
389
dnsOpMonitor := dnsOpMonitorBuild (r .namespace )
390
- err = r .createServiceMonitor (ctx , dnsOpMonitor , logger )
391
- if err != nil {
392
- return err
393
- }
390
+ r .createServiceMonitor (ctx , dnsOpMonitor , logger )
394
391
395
392
// Authorino operator monitor
396
393
authOpMonitor := authOpMonitorBuild (r .namespace )
397
- err = r .createServiceMonitor (ctx , authOpMonitor , logger )
398
- if err != nil {
399
- return err
400
- }
394
+ r .createServiceMonitor (ctx , authOpMonitor , logger )
401
395
402
396
// Limitador operator monitor
403
397
limitOpMonitor := limitOpMonitorBuild (r .namespace )
404
- err = r .createServiceMonitor (ctx , limitOpMonitor , logger )
405
- if err != nil {
406
- return err
407
- }
398
+ r .createServiceMonitor (ctx , limitOpMonitor , logger )
408
399
409
400
// Create monitors for each gateway instance of each gateway class
410
401
gatewayClasses := topology .Targetables ().Items (func (o machinery.Object ) bool {
@@ -415,31 +406,19 @@ func (r *ObservabilityReconciler) Reconcile(ctx context.Context, _ []controller.
415
406
gwClass := gatewayClass .(* machinery.GatewayClass )
416
407
if gwClass .GatewayClass .Spec .ControllerName == istioGatewayControllerName {
417
408
istiodMonitor := istiodMonitorBuild (istiodMonitorNS )
418
- err := r .createServiceMonitor (ctx , istiodMonitor , logger )
419
- if err != nil {
420
- return err
421
- }
409
+ r .createServiceMonitor (ctx , istiodMonitor , logger )
422
410
423
411
for _ , gateway := range gateways {
424
412
istioPodMonitor := istioPodMonitorBuild (gateway .GetNamespace ())
425
- err = r .createPodMonitor (ctx , istioPodMonitor , logger )
426
- if err != nil {
427
- return err
428
- }
413
+ r .createPodMonitor (ctx , istioPodMonitor , logger )
429
414
}
430
415
} else if gwClass .GatewayClass .Spec .ControllerName == envoyGatewayGatewayControllerName {
431
416
envoyGatewayMonitor := envoyGatewayMonitorBuild (envoyGatewayMonitorNS )
432
- err = r .createServiceMonitor (ctx , envoyGatewayMonitor , logger )
433
- if err != nil {
434
- return err
435
- }
417
+ r .createServiceMonitor (ctx , envoyGatewayMonitor , logger )
436
418
437
419
for _ , gateway := range gateways {
438
420
envoyStatsMonitor := envoyStatsMonitorBuild (gateway .GetNamespace ())
439
- err = r .createPodMonitor (ctx , envoyStatsMonitor , logger )
440
- if err != nil {
441
- return err
442
- }
421
+ r .createPodMonitor (ctx , envoyStatsMonitor , logger )
443
422
}
444
423
}
445
424
}
0 commit comments