exporter: applying labels from monitoring section to ceph-exporter

the labels listed under the 'monitoring' section are currently only
being applied to the rook-ceph-mgr ServiceMonitor. This change extends
those labels to also include the rook-ceph-exporter ServiceMonitor.

Fixes: https://github.com/rook/rook/issues/13774

Signed-off-by: Redouane Kachach <rkachach@redhat.com>
This commit is contained in:
Redouane Kachach committed 2024-03-08 14:38:27 +01:00
1 parent 66fba39eab
commit 10e26709c4
1 file changed
+1
@@ -262,6 +262,7 @@ func EnableCephExporterServiceMonitor(context *clusterd.Context, cephCluster cep
func applyCephExporterLabels(cephCluster cephv1.CephCluster, serviceMonitor *monitoringv1.ServiceMonitor) {
if cephCluster.Spec.Labels != nil {
cephv1.GetMonitoringLabels(cephCluster.Spec.Labels).OverwriteApplyToObjectMeta(&serviceMonitor.ObjectMeta)
if cephExporterLabels, ok := cephCluster.Spec.Labels["exporter"]; ok {
if managedBy, ok := cephExporterLabels["rook.io/managedBy"]; ok {
relabelConfig := monitoringv1.RelabelConfig{