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>
(cherry picked from commit 10e26709c4)
This commit is contained in:
Redouane Kachach authored and Mergify committed 2024-03-13 14:11:01 +00:00
1 parent b9284ac6ba
commit bbc482d82f
1 file changed
+1
@@ -261,6 +261,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{