feat(charts): support extra relabelings on control-plane PodMonitors - #15539
Open
Coder-in-a-shell wants to merge 1 commit into
Open
feat(charts): support extra relabelings on control-plane PodMonitors#15539Coder-in-a-shell wants to merge 1 commit into
Coder-in-a-shell wants to merge 1 commit into
Conversation
Adds `extraRelabelings` and `extraMetricRelabelings` values for each of the three PodMonitors in the linkerd-control-plane chart (controller, serviceMirror and proxy). Operators who need to add their own filters to the PodMonitors -- for example, dropping a pod that a second, non-Prometheus scraper already covers, to avoid duplicate timeseries -- currently have to fork the chart, since the `relabelings` the chart ships are fixed and there is no `metricRelabelings` block at all. The extra rules are appended after the relabelings the chart already sets rather than replacing them, so the `labelmap`/`labeldrop` chain that produces the expected proxy metric labels stays intact. Both values default to an empty list, and the `metricRelabelings` block is only rendered when non-empty, so the default output is unchanged. Fixes linkerd#15212 Signed-off-by: Sudhir Jaiswal <jaiswalsudhir2944@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
The
linkerd-control-planechart'stemplates/podmonitor.yamlships a fixed set ofrelabelingson each of its three PodMonitors, and nometricRelabelingsat all. Operators who need to add their own rules — the motivating case in #15212 is dropping a pod that a second, non-Prometheus scraper (vmagent) already covers, to avoid duplicate timeseries — have no way to do it from values and must fork the chart.Solution
Adds
extraRelabelingsandextraMetricRelabelingsunderpodMonitor.controller,podMonitor.serviceMirrorandpodMonitor.proxy.This follows the shape @alpeb confirmed in #15212 (comment), and specifically the append semantics rather than a wholesale spec-override map: the extra rules land after the relabelings the chart already sets, so the
labelmap/labeldropchain that produces the expected proxy metric labels can't be replaced by accident.Both values default to
[], and themetricRelabelingsblock renders only when non-empty, so default output is byte-for-byte unchanged — the only golden-file churn is the two new empty keys in thelinkerd-configvalues dump.This is the same pattern as the two already-merged siblings on this template:
podMonitor.labels(#11222) andhonorTimestamps(#15080).Validation
helm templatewith the exact drop rule from the issue, plus metric relabelings on all three PodMonitors, renders as intended:Parsing the rendered manifests confirms placement and count for each PodMonitor:
i.e. the extra rules are appended last and
metricRelabelingsappears only where configured. Rendering with the defaults produces output identical tomain.Also ran:
go test ./pkg/charts/linkerd2/...— passgo test ./cli/cmd/...— pass (golden files regenerated with-update; diff is only the two new empty keys)go build ./...,go vet,gofmt— cleanFixes #15212
Signed-off-by: Sudhir Jaiswal jaiswalsudhir2944@gmail.com