Skip to content

The operator doesn't validate target labels for Probe custom resources #7901

Description

@simonpasquier

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

Description

When deploying a Probe resource with a non-legacy label name (e.g. cluster-id), the generated configuration will crash on Prometheus without UTF-8 support (< v3.0.0).

Steps to Reproduce

  1. Deploy a Prometheus with image quay.io/prometheus/prometheus:v2.45.0
  2. Deploy this Probe manifest
apiVersion: monitoring.coreos.com/v1
kind: Probe
metadata:
  name: probe-test
spec:
  interval: 30s
  module: http_2xx
  prober:
    path: /probe
    url: blackbox-exporter:9115
  targets:
    staticConfig:
      labels:
        cluster-id: xxx
      static:
      - https://example.com

Expected Result

No crash :)

Actual Result

$ kc logs prometheus-prometheus-0 -c prometheus
ts=2025-09-11T09:10:28.271Z caller=main.go:482 level=error msg="Error loading config (--config.file=/etc/prometheus/config_out/prometheus.env.yaml)" file=/etc/prometheus/config_out/prometheus.env.yaml err="parsing YAML file /etc/prometheus/config_out/prometheus.env.yaml: \"cluster-id\" is not a valid label name"

Prometheus Operator Version

main

Kubernetes Version

N/A

Kubernetes Cluster Type

kind

How did you deploy Prometheus-Operator?

yaml manifests

Manifests

prometheus-operator log output

N/A

Anything else?

Related to #7362

Note that the issue doesn't manifest when using a Prometheus version >= 3 because utf-8 support is always enabled.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions