canonical / prometheus-k8s-operator

https://charmhub.io/prometheus-k8s
Apache License 2.0
21 stars 35 forks source link

Add authorization to allowed scrape jobs keys #489

Closed neoaggelos closed 1 year ago

neoaggelos commented 1 year ago

Issue

Scrape jobs that require a bearer token for authorization must provide it via the authorization configuration field, see https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config

Solution

Allow passing authorization field to the scrape jobs

Context

This is required for properly defining scrape jobs in the MicroK8s charm, otherwise the bearer token gets dropped and the metrics endpoints cannot be scraped.

Testing Instructions

Pass a scrape job with a set authorization field. Did not see any existing unit tests for scrape job sanitization, so I did not go through the effort to add one.

Release Notes

Add authorization in the allowlist for scrape jobs configuration