Skip to content

Commit 2f0b29f

Browse files
authored
fix(monitoring): use a valid match-nothing selector for parca-analytics (#474)
The In: [] selector from the previous PR is rejected by Kubernetes' own API validation (In/NotIn require a non-empty values set), which made Prometheus Operator's reconciliation fail outright: selecting ServiceMonitors failed: values: Invalid value: []string(nil): for 'in', 'notin' operators, values set can't be empty Confirmed live: prometheus-analytics kept scraping thanos-sidecar/ thanos-query/thanos-store after that PR merged, because it never regenerated its scrape config at all. matchLabels on a label nothing carries has no such non-empty-set constraint and reliably matches zero objects.
1 parent 9cd8c21 commit 2f0b29f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

monitoring/environments/scaleway-parca-demo/main.jsonnet

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,13 @@ local prometheuses = [
338338
// job, see monitoring's serviceMonitorParcaAnalytics). The default {}
339339
// selectors match every PodMonitor/ServiceMonitor cluster-wide, so without
340340
// this it would also pick up unrelated apps (parca-agent, pyrra, ...) plus
341-
// its own Thanos components. `In: []` never matches, regardless of labels.
341+
// its own Thanos components. matchLabels on a label nothing carries never
342+
// matches; unlike `In: []`, the Kubernetes API accepts this (`In`/`NotIn`
343+
// reject empty values sets and fail Prometheus Operator's reconciliation).
342344
podMonitorNamespaceSelector: { matchLabels: { 'kubernetes.io/metadata.name': p._config.namespace } },
343345
serviceMonitorNamespaceSelector: { matchLabels: { 'kubernetes.io/metadata.name': p._config.namespace } },
344-
podMonitorSelector: { matchExpressions: [{ key: 'prometheus', operator: 'In', values: [] }] },
345-
serviceMonitorSelector: { matchExpressions: [{ key: 'prometheus', operator: 'In', values: [] }] },
346+
podMonitorSelector: { matchLabels: { 'prometheus-operator-select-nothing': 'true' } },
347+
serviceMonitorSelector: { matchLabels: { 'prometheus-operator-select-nothing': 'true' } },
346348
resources+: {
347349
requests+: { cpu: '500m' },
348350
},

0 commit comments

Comments
 (0)