Commit cbd6ba3
COO-1687: feat: migrate to EndpointSlice service discovery (#1028)
* feat: migrate to EndpointSlice service discovery
Prometheus Operator defaults to watching the deprecated Endpoints API for
service discovery. Switch the operator's own ServiceMonitors to use
EndpointSlice explicitly, which eliminates the deprecation log noise from
the operator's internal components.
Changes:
- Set serviceDiscoveryRole: EndpointSlice on the ServiceMonitors we own
(observability-operator, health-analyzer, thanos-querier) so that
prometheus-operator uses the EndpointSlice role for these jobs.
- Add discovery.k8s.io/endpointslices to all Prometheus RBAC roles and
ClusterRoles (alongside the existing endpoints permission) so that
Prometheus can serve both kinds of ServiceMonitors simultaneously.
- Add discovery.k8s.io/endpointslices to the korrel8r ClusterRole so
the correlation tool can read both endpoint representations.
- Add the corresponding kubebuilder markers and update the generated
cluster role YAML and CSV.
The Prometheus CR's global serviceDiscoveryRole is intentionally left
unset (defaulting to Endpoints) so that user-created ServiceMonitors
continue to work without modification. Users can opt individual
ServiceMonitors into EndpointSlice by setting serviceDiscoveryRole:
EndpointSlice on them.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Jan Fajerski <jan@fajerski.name>
* fix: revert serviceDiscoveryRole from monitoring.coreos.com ServiceMonitors
The operator's self-monitoring ServiceMonitor and the health-analyzer
ServiceMonitor are monitoring.coreos.com objects processed by the
platform prometheus-operator on OpenShift, which we don't control.
Setting serviceDiscoveryRole: EndpointSlice on them requires the
platform Prometheus to have endpointslices access and the platform
prometheus-operator to correctly generate TLS-aware scrape configs
for the endpointslice role — neither of which is guaranteed across
OCP versions.
The thanos-querier ServiceMonitor (monitoring.rhobs) is handled by
the obo-prometheus-operator we manage, so it retains the EndpointSlice
setting safely.
Fixes TestOperatorMetrics/metrics_ingested_in_Prometheus on OCP clusters.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
---------
Signed-off-by: Jan Fajerski <jan@fajerski.name>
Co-authored-by: Jan Fajerski <jan@fajerski.name>
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>1 parent d844495 commit cbd6ba3
9 files changed
Lines changed: 38 additions & 1 deletion
File tree
- bundle/manifests
- deploy/operator
- pkg/controllers
- monitoring
- monitoring-stack
- thanos-querier
- operator
- uiplugin
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
439 | 447 | | |
440 | 448 | | |
441 | 449 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
122 | 130 | | |
123 | 131 | | |
124 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
103 | 107 | | |
104 | 108 | | |
105 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| 252 | + | |
252 | 253 | | |
253 | 254 | | |
254 | 255 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
42 | 47 | | |
43 | 48 | | |
44 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
197 | 202 | | |
198 | 203 | | |
199 | 204 | | |
| |||
0 commit comments