From d45b0e5c6b0bda28b7425740b9f13d03d4f1d8d4 Mon Sep 17 00:00:00 2001 From: Sanchit2662 Date: Tue, 27 Jan 2026 21:41:05 +0530 Subject: [PATCH] fix: add missing ScrapeConfigNamespaceSelector in handleMonitorNamespaceUpdate Signed-off-by: Sanchit2662 --- pkg/prometheus/agent/operator.go | 3 ++- pkg/prometheus/server/operator.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/prometheus/agent/operator.go b/pkg/prometheus/agent/operator.go index aff2adc5c..ccaa426e7 100644 --- a/pkg/prometheus/agent/operator.go +++ b/pkg/prometheus/agent/operator.go @@ -1199,13 +1199,14 @@ func (c *Operator) handleMonitorNamespaceUpdate(oldo, curo any) { c.metrics.TriggerByCounter("Namespace", operator.UpdateEvent).Inc() // Check for Prometheus Agent instances selecting ServiceMonitors, PodMonitors, - // and Probes in the namespace. + // Probes and ScrapeConfigs in the namespace. err := c.promInfs.ListAll(labels.Everything(), func(obj any) { p := obj.(*monitoringv1alpha1.PrometheusAgent) for name, selector := range map[string]*metav1.LabelSelector{ "PodMonitors": p.Spec.PodMonitorNamespaceSelector, "Probes": p.Spec.ProbeNamespaceSelector, + "ScrapeConfigs": p.Spec.ScrapeConfigNamespaceSelector, "ServiceMonitors": p.Spec.ServiceMonitorNamespaceSelector, } { diff --git a/pkg/prometheus/server/operator.go b/pkg/prometheus/server/operator.go index 2ede081ab..9fdcfe856 100644 --- a/pkg/prometheus/server/operator.go +++ b/pkg/prometheus/server/operator.go @@ -774,7 +774,7 @@ func (c *Operator) handleMonitorNamespaceUpdate(oldo, curo any) { c.metrics.TriggerByCounter("Namespace", operator.UpdateEvent).Inc() // Check for Prometheus instances selecting ServiceMonitors, PodMonitors, - // Probes and PrometheusRules in the namespace. + // Probes, PrometheusRules and ScrapeConfigs in the namespace. err := c.promInfs.ListAll(labels.Everything(), func(obj any) { p := obj.(*monitoringv1.Prometheus) @@ -782,6 +782,7 @@ func (c *Operator) handleMonitorNamespaceUpdate(oldo, curo any) { "PodMonitors": p.Spec.PodMonitorNamespaceSelector, "Probes": p.Spec.ProbeNamespaceSelector, "PrometheusRules": p.Spec.RuleNamespaceSelector, + "ScrapeConfigs": p.Spec.ScrapeConfigNamespaceSelector, "ServiceMonitors": p.Spec.ServiceMonitorNamespaceSelector, } {