Drift Detection in loki unit for PrometheusRule

Summary

We are facing the driftdetection for prometheusrule in loki namespace:

[Management Cluster] root@managment-node-1:~/sylva-logging/sylva-core (main) # ./tools/helmrelease-identify-drift-corrections.sh
📝 Checking Helm controller logs for drift...
🚨 Drift detected in the following components:
   🔹 loki
      🔄 [2025-08-25T16:59:24.604Z] PrometheusRule/loki/loki-loki-alerts changed (1 additions, 0 changes, 0 removals)\nPrometheusRule/loki/loki-loki-rules changed (1 additions, 0 changes, 0 removals)","type":"Warning","object":{"kind":"HelmRelease","namespace":"sylva-system","name":"loki","uid":"c0924be2-af69-48ca-82ca-d3cf0ef4223d","apiVersion":"helm.toolkit.fluxcd.io/v2","resourceVersion":"101868"},"reason":"DriftDetected}
      🔧 Patches applied:
        - [2025-08-25T16:59:24.604Z] PrometheusRule/loki/loki-loki-alerts ->
          [
            {
              "value": "true",
              "op": "add",
              "path": "/metadata/annotations/prometheus-operator-validated"
            }
          ]
        - [2025-08-25T16:59:24.604Z] PrometheusRule/loki/loki-loki-rules ->
          [
            {
              "value": "true",
              "op": "add",
              "path": "/metadata/annotations/prometheus-operator-validated"
            }
          ]

loki is creating two PrometheusRules in loki namespace:

$ kubectl get prometheusrule -n loki
NAME               AGE
loki-loki-alerts   12h
loki-loki-rules    12h

As the loki helmrelease have driftDetection: enabled and also these prometheusrule resources are getting new annotation prometheus-operator-validated: true is causing the driftDetection.

Edited Aug 28, 2025 by Nitin Sharma
Assignee Loading
Time tracking Loading