Skip to content

[prometheus-blackbox-exporter] Duplicate endpoints in self ServiceMonitor when config-reloader is enabled #5321

Open
@sebhoss

Description

@sebhoss

Describe the bug a clear and concise description of what the bug is.

When both configReloader.enabled and serviceMonitor.selfMonitor.enabled is set to true, the following ServiceMonitor is generated:

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: daemon-prometheus-blackbox-exporter
  namespace: blackbox-exporter
  labels:
    helm.sh/chart: prometheus-blackbox-exporter-9.2.0
    app.kubernetes.io/name: prometheus-blackbox-exporter
    app.kubernetes.io/instance: daemon
    app.kubernetes.io/version: v0.25.0
    app.kubernetes.io/managed-by: Helm
spec:
  endpoints:
    - path: /metrics
      interval: 30s
      scrapeTimeout: 30s
      scheme: http
    - path: /metrics
      interval: 30s
      scrapeTimeout: 30s
      scheme: http
  jobLabel: daemon
  selector:
    matchLabels:
      app.kubernetes.io/name: prometheus-blackbox-exporter
      app.kubernetes.io/instance: daemon
  namespaceSelector:
    matchNames:
      - blackbox-exporter

I think the intention here is to scrape the /metrics path of the config-reloader. We can improve this a little by setting serviceMonitor.selfMonitor.port to http so that the first endpoint in the service monitor scrapes the correct port of the service it is referencing. However we cannot specify the port of the second endpoint and I think the helm-chart should default to working out-of-the-box, e.g. by setting serviceMonitor.selfMonitor.port to http and something like configReloader.serviceMonitor.selfMonitor.port to reloader-web.

What's your helm version?

version.BuildInfo{Version:"v3.17.0", GitCommit:"301108edc7ac2a8ba79e4ebf5701b0b6ce6a31e4", GitTreeState:"clean", GoVersion:"go1.23.4"}

What's your kubectl version?

Client Version: v1.32.1 Kustomize Version: v5.5.0 Server Version: v1.31.4

Which chart?

prometheus-blackbox-exporter

What's the chart version?

9.2.0

What happened?

The chart generated duplicated endpoints, both of which are missing the port information

What you expected to happen?

The chart should generate endpoints correctly matching those exposed by the associated service

How to reproduce it?

Render chart with the below values.yaml settings and look at the generated ServiceMonitor resource

Enter the changed values of values.yaml?

configReloader:
  enabled: true
serviceMonitor:
  selfMonitor:
    enabled: true

Enter the command that you execute and failing/misfunctioning.

helm template ...

Anything else we need to know?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions