Skip to content

Commit

Permalink
Merge pull request #9245 from rook/mergify/bp/release-1.7/pr-9243
Browse files Browse the repository at this point in the history
monitoring: update label on prometheus resources (backport #9243)
  • Loading branch information
mergify[bot] committed Nov 24, 2021
2 parents 0a94e11 + fc9f05e commit 32cb63b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/operator/k8sutil/prometheus.go
Expand Up @@ -80,6 +80,7 @@ func CreateOrUpdateServiceMonitor(serviceMonitorDefinition *monitoringv1.Service
return nil, fmt.Errorf("failed to retrieve servicemonitor. %v", err)
}
oldSm.Spec = serviceMonitorDefinition.Spec
oldSm.ObjectMeta.Labels = serviceMonitorDefinition.ObjectMeta.Labels
sm, err := client.MonitoringV1().ServiceMonitors(namespace).Update(ctx, oldSm, metav1.UpdateOptions{})
if err != nil {
return nil, fmt.Errorf("failed to update servicemonitor. %v", err)
Expand Down Expand Up @@ -123,6 +124,7 @@ func CreateOrUpdatePrometheusRule(prometheusRule *monitoringv1.PrometheusRule) (
return nil, fmt.Errorf("failed to get prometheusRule object. %v", err)
}
promRule.Spec = prometheusRule.Spec
promRule.ObjectMeta.Labels = prometheusRule.ObjectMeta.Labels
_, err = client.MonitoringV1().PrometheusRules(namespace).Update(ctx, promRule, metav1.UpdateOptions{})
if err != nil {
return nil, fmt.Errorf("failed to update prometheusRule. %v", err)
Expand Down

0 comments on commit 32cb63b

Please sign in to comment.