UNCLASSIFIED - NO CUI

Backend: Add functionality to export Kyverno Reporter Data Metrics to Prometheus

Description:

Add functionality in the backend to export Kyverno Policy Reporter data metrics to Prometheus for monitoring and visualization.


Tasks:

  1. Integration with Prometheus

    • Set up Prometheus metrics endpoint in the backend.
    • Define and register custom metrics for Kyverno policy violations (e.g., counters, gauges).
  2. Data Processing

    • Fetch Kyverno Policy Reporter data using the existing client.
    • Parse and transform the data into Prometheus-compatible metrics.
  3. Metrics Export

    • Push the transformed metrics to the Prometheus endpoint.
    • Ensure proper labeling (e.g., policy name, severity, namespace).
  4. Error Handling and Logging

    • Handle errors during data fetching, transformation, and export.
    • Implement logging for debugging and monitoring.
  5. Testing

    • Write unit tests for metric transformation and export logic.
    • Perform integration tests with Prometheus to validate metric ingestion.

Acceptance Criteria:

  • Kyverno data metrics (e.g., violations, compliance scores) are exported to Prometheus.
  • Metrics include appropriate labels for detailed filtering and monitoring.
  • Robust error handling and logging are implemented.
  • Unit and integration tests validate the functionality.

Edited by Manuel Ucles