Merge pull request #13254 from rook/mergify/bp/release-1.12/pr-13248
mgr: get servicemonitor exporter's interval from MonitoringSpec (backport #13248)
This commit is contained in:
1 file changed
+5
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user