Skip to content

Commit

Permalink
Merge pull request #9243 from LittleFox94/9241-update-prometheus
Browse files Browse the repository at this point in the history
monitoring: update label on prometheus resources
  • Loading branch information
travisn committed Nov 24, 2021
2 parents e008464 + 733878b commit 9d3bcb4
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 9d3bcb4

Please sign in to comment.