Skip to content

Commit 3e3e787

Browse files
authored
feat(charts): make honorTimestamps configurable for PodMonitors (#15080)
**Why is this PR necessary?** In clusters with frequent pod restarts, Prometheus may drop scrapes due to duplicate timestamps reported by the exporter. Allowing honorTimestamps to be disabled lets Prometheus use scrape time instead, preventing those drops. **What does it do?** Adds an optional honorTimestamps field to the controller, proxy and serviceMirror PodMonitors in the linkerd-control-plane chart. The field is rendered only when set, preserving backward compatibility. **References:** N/A **Notes:** N/A Signed-off-by: bezarsnba <bezarsnba@gmail.com>
1 parent a966448 commit 3e3e787

23 files changed

Lines changed: 82 additions & 3 deletions

charts/linkerd-control-plane/templates/podmonitor.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ spec:
2222
podMetricsEndpoints:
2323
- interval: {{ $podMonitor.scrapeInterval }}
2424
scrapeTimeout: {{ $podMonitor.scrapeTimeout }}
25+
{{- if not (kindIs "invalid" $podMonitor.controller.honorTimestamps) }}
26+
honorTimestamps: {{ $podMonitor.controller.honorTimestamps }}
27+
{{- end }}
2528
relabelings:
2629
- sourceLabels:
2730
- __meta_kubernetes_pod_container_port_name
@@ -60,6 +63,9 @@ spec:
6063
podMetricsEndpoints:
6164
- interval: {{ $podMonitor.scrapeInterval }}
6265
scrapeTimeout: {{ $podMonitor.scrapeTimeout }}
66+
{{- if not (kindIs "invalid" $podMonitor.serviceMirror.honorTimestamps) }}
67+
honorTimestamps: {{ $podMonitor.serviceMirror.honorTimestamps }}
68+
{{- end }}
6369
relabelings:
6470
- sourceLabels:
6571
- __meta_kubernetes_pod_label_linkerd_io_control_plane_component
@@ -99,6 +105,9 @@ spec:
99105
podMetricsEndpoints:
100106
- interval: {{ $podMonitor.scrapeInterval }}
101107
scrapeTimeout: {{ $podMonitor.scrapeTimeout }}
108+
{{- if not (kindIs "invalid" $podMonitor.proxy.honorTimestamps) }}
109+
honorTimestamps: {{ $podMonitor.proxy.honorTimestamps }}
110+
{{- end }}
102111
relabelings:
103112
- sourceLabels:
104113
- __meta_kubernetes_pod_container_name

charts/linkerd-control-plane/values.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,12 +722,22 @@ podMonitor:
722722
matchNames:
723723
- {{ .Release.Namespace }}
724724
- linkerd-viz
725+
# -- Sets honorTimestamps for the control-plane PodMonitor endpoint. When set to false
726+
# Prometheus uses scrape time instead of exporter-provided timestamps.
727+
honorTimestamps: false
725728
serviceMirror:
726729
# -- Enables the creation of PodMonitor for the Service Mirror component
727730
enabled: true
731+
# -- Sets honorTimestamps for the Service Mirror PodMonitor endpoint. When set to false,
732+
# Prometheus uses scrape time instead of exporter-provided timestamps.
733+
honorTimestamps: false
728734
proxy:
729735
# -- Enables the creation of PodMonitor for the data-plane
730736
enabled: true
737+
# -- Sets honorTimestamps for the proxy PodMonitor endpoint. When set to false,
738+
# Prometheus uses scrape time instead of exporter-provided timestamps,
739+
# preventing duplicate timestamp drops in clusters with frequent pod restarts.
740+
honorTimestamps: false
731741

732742

733743
# Egress related configuration

cli/cmd/testdata/install_controlplane_tracing_output.golden

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/cmd/testdata/install_custom_domain.golden

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/cmd/testdata/install_custom_registry.golden

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/cmd/testdata/install_default.golden

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/cmd/testdata/install_default_override_dst_get_nets.golden

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/cmd/testdata/install_default_token.golden

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/cmd/testdata/install_gid_output.golden

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/cmd/testdata/install_ha_output.golden

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)