Skip to content

[release-1.4] COO-1687: feat: migrate to EndpointSlice service discovery#1035

Merged
openshift-merge-bot[bot] merged 1 commit intorhobs:release-1.4from
PeterYurkovich:manual-cherry-pick
Mar 12, 2026
Merged

[release-1.4] COO-1687: feat: migrate to EndpointSlice service discovery#1035
openshift-merge-bot[bot] merged 1 commit intorhobs:release-1.4from
PeterYurkovich:manual-cherry-pick

Conversation

@PeterYurkovich
Copy link
Member

Manual cherry pick of #1028

@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Mar 12, 2026

@PeterYurkovich: This pull request references COO-1687 which is a valid jira issue.

Details

In response to this:

Manual cherry pick of #1028

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@PeterYurkovich
Copy link
Member Author

PeterYurkovich commented Mar 12, 2026

/retitle [release-1.4] COO-1687: feat: migrate to EndpointSlice service discovery

@openshift-ci openshift-ci bot changed the title COO-1687: feat: migrate to EndpointSlice service discovery [release-1.4] COO-1687: feat: migrate to EndpointSlice service discovery Mar 12, 2026
* 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>
@jgbernalp
Copy link
Member

/lgtm

@jgbernalp
Copy link
Member

/approve

@openshift-ci
Copy link

openshift-ci bot commented Mar 12, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jgbernalp, PeterYurkovich

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 4fb1e92 into rhobs:release-1.4 Mar 12, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants