fix(falcosidekick): Allow overriding the Prometheus scrape Service annotation #779
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind bug
/kind chart-release
Any specific area of the project related to this PR?
/area falcosidekick-chart
What this PR does / why we need it:
We are working on a migration from a deprecated Prometheus setup to one based on the Prometheus Kubernetes Operator.
Since metrics scraped by the operator-managed instances are targeting ServiceMonitor and PodMonitor resources, we need to be able to configure the
prometheus.io/scrape
Service annotation to gradually disable scraping from our deprecated instances.Which issue(s) this PR fixes:
Because the
prometheus.io/scrape
annotation is hard-coded in the Service template and it's the last entry in theannotations
map, there's no way to include custom values after it.This PR simply moves the hard-coded annotation to before the user-provided values, so at least they have an escape hatch in case they need to override the value.
Special notes for your reviewer:
You can test with:
The final template will include duplicate values, but the override will take precedence when the yaml gets parsed/applied to the cluster.
The duplicated keys will be removed by the cluster.
I considered going with a different approach based on something like
.Values.service.prometheusScrape
, but decided against it due to it requiring changes to thevalues.yaml
structure.Checklist