VictoriaMetrics / operator

Kubernetes operator for Victoria Metrics
Apache License 2.0
422 stars 140 forks source link

Reconciliation Loop for Prometheus Converter #869

Closed mirondeldev closed 6 months ago

mirondeldev commented 6 months ago

Current behavior of the vmprometheusconverter rely on Prometheus CRD create and update events, e.g.: https://github.com/VictoriaMetrics/operator/blob/e261c37dc973154ff71073d7213000421416bd4e/controllers/vmprometheusconverter_controller.go#L86-L88

In some cases (like manual or circumstantial deletion of custom resources) it leads to "orphaned" Prometheus resources.

So, the problem is VictoriaMetrics Operator does not recreate converted VM-resources after ones being deleted

Steps to reproduce

Would you please consider implementing reconciliation loop for Prometheus resources in vmprometheusconverter?

f41gh7 commented 6 months ago

Hello, it makes sense to me. And it'd be great to have an option to enable periodical reconciliation of prometheus watched objects.

f41gh7 commented 6 months ago

Added new flag for period reconciliation at v0.42.2 release

It accepts duration format, -controller.prometheusCRD.resyncPeriod=10m.

By default, it's disabled.

mirondeldev commented 5 months ago

@f41gh7 thx, much appreciated