Skip to content

Commit

Permalink
Rename ServiceMonitors to not get deleted by operator
Browse files Browse the repository at this point in the history
We create our own ServiceMonitor resources, since the argocd-operator
doesn't support creating ServiceMonitors without also deploying a
Prometheus instance.

However, the operator will delete any ServiceMonitor which matches the
name that it would generate for its managed ServiceMonitors if the
Prometheus component is disabled, cf.
https://github.com/argoproj-labs/argocd-operator/blob/17064c9b310785ab145747a367f7deb5507a572e/controllers/argocd/prometheus.go#L129-L136

This causes the component-managed ServiceMonitors to get deleted from
time to time, and they get recreated after a while by an ArgoCD resync.

This commit circumvents the issue by renaming the component-managed
ServiceMonitors so they don't get deleted by the operator.
  • Loading branch information
simu committed Nov 16, 2023
1 parent 9c43d47 commit d952eea
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions component/monitoring.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ local promEnable = function(obj)
;

[
promEnable(serviceMonitor('syn-argocd-metrics')),
promEnable(serviceMonitor('syn-argocd-server-metrics')),
promEnable(serviceMonitor('syn-argocd-repo-server')),
// We explicitly select names for the service monitors which don't match the
// operator-generated names for instance syn-argocd
promEnable(serviceMonitor('syn-component-argocd-metrics')),
promEnable(serviceMonitor('syn-component-argocd-server-metrics')),
promEnable(serviceMonitor('syn-component-argocd-repo-server')),
promEnable(alert_rules),
] + if params.monitoring.dashboards then [ grafana_dashboard ] else []

0 comments on commit d952eea

Please sign in to comment.