aws/amazon-vpc-cni-k8s

Helm: podMonitor.scrapeTimeout is defined in values.yaml but never used in the PodMonitor template

Chiusa

#3803 aperta il 25 lug 2026

 (1 commento) (0 reazioni) (0 assegnatari)Go (823 fork)auto 404
good first issue

Metriche repository

Star
 (2450 stelle)
Metriche merge PR
 (Merge medio 10g 13h) (29 PR mergiate in 30 g)

Descrizione

What happened

The aws-vpc-cni Helm chart defines podMonitor.scrapeTimeout in values.yaml, but the PodMonitor template never references it. As a result, a user who sets podMonitor.scrapeTimeout has their value silently ignored — the rendered PodMonitor has no scrapeTimeout field, so Prometheus falls back to its own default.

charts/aws-vpc-cni/values.yaml (defines the value):

podMonitor:
  # The interval to scrape metrics.
  interval: 30s
  # The timeout before a metrics scrape fails.
  scrapeTimeout: 30s

charts/aws-vpc-cni/templates/podmonitor.yaml (uses interval but not scrapeTimeout):

  podMetricsEndpoints:
  - interval: {{ .Values.podMonitor.interval }}
    path: /metrics
    port: metrics
  {{- if .Values.nodeAgent.enabled }}
  - interval: {{ .Values.podMonitor.interval }}
    path: /metrics
    port: agentmetrics
  {{- end }}

Expected behavior

Setting podMonitor.scrapeTimeout should propagate into each podMetricsEndpoints entry of the generated PodMonitor, so operators can bound how long Prometheus waits before marking a scrape of the CNI metrics endpoints as failed.

Proposed fix

Add scrapeTimeout to both endpoints (the metrics port and the agentmetrics port):

  podMetricsEndpoints:
  - interval: {{ .Values.podMonitor.interval }}
    scrapeTimeout: {{ .Values.podMonitor.scrapeTimeout }}
    path: /metrics
    port: metrics
  {{- if .Values.nodeAgent.enabled }}
  - interval: {{ .Values.podMonitor.interval }}
    scrapeTimeout: {{ .Values.podMonitor.scrapeTimeout }}
    path: /metrics
    port: agentmetrics
  {{- end }}

Value of fixing

  • Makes a documented, already-shipped configuration knob actually take effect instead of being silently dropped.
  • Lets users tune scrape timeouts for the CNI metrics endpoints (useful on busy nodes where a scrape can take longer than the Prometheus default), avoiding spurious scrape failures/gaps in metrics.
  • Small, self-contained, well-scoped change — good for a first-time contributor.

Affected file

charts/aws-vpc-cni/templates/podmonitor.yaml (value is defined in charts/aws-vpc-cni/values.yaml). Present on master.

Guida contributor