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, } {