From 47a6c9ff7f53e98ecae01938bdfc8c835b1c7a3a Mon Sep 17 00:00:00 2001 From: Redouane Kachach Date: Tue, 21 Nov 2023 17:21:12 +0100 Subject: [PATCH] mgr: get servicemonitor exporter's interval from MonitoringSpec this change updates the serviceMonitor interval of the the rook-ceph-exporter with the value from the MonitoringSpec. closes: https://github.com/rook/rook/issues/13159 Signed-off-by: Redouane Kachach (cherry picked from commit 6b71325dbe9527179985519fee29f8a0aeef9741) --- pkg/operator/ceph/cluster/nodedaemon/exporter.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/operator/ceph/cluster/nodedaemon/exporter.go b/pkg/operator/ceph/cluster/nodedaemon/exporter.go index df922503f..1d7910561 100644 --- a/pkg/operator/ceph/cluster/nodedaemon/exporter.go +++ b/pkg/operator/ceph/cluster/nodedaemon/exporter.go @@ -234,6 +234,11 @@ func MakeCephExporterMetricsService(cephCluster cephv1.CephCluster, servicePortM func EnableCephExporterServiceMonitor(context *clusterd.Context, cephCluster cephv1.CephCluster, scheme *runtime.Scheme, opManagerContext context.Context, servicePortMetricName string) error { serviceMonitor := k8sutil.GetServiceMonitor(cephExporterAppName, cephCluster.Namespace, servicePortMetricName) + if cephCluster.Spec.Monitoring.Interval != nil { + duration := cephCluster.Spec.Monitoring.Interval.Duration.String() + serviceMonitor.Spec.Endpoints[0].Interval = monitoringv1.Duration(duration) + } + cephv1.GetCephExporterLabels(cephCluster.Spec.Labels).OverwriteApplyToObjectMeta(&serviceMonitor.ObjectMeta) err := controllerutil.SetControllerReference(&cephCluster, serviceMonitor, scheme)