Skip to content

[release-4.22] CNTRLPLANE-4321: Cherry-pick kube-scheduler metrics support - #9490

Merged
openshift-merge-bot[bot] merged 4 commits into
openshift:release-4.22from
michaelryanmcneill:CNTRLPLANE-4314
Sep 4, 2026
Merged

[release-4.22] CNTRLPLANE-4321: Cherry-pick kube-scheduler metrics support#9490
openshift-merge-bot[bot] merged 4 commits into
openshift:release-4.22from
michaelryanmcneill:CNTRLPLANE-4314

Conversation

@michaelryanmcneill

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Cherry-picks PRs #8489 and #8680 to release-4.22 to enable Prometheus metrics scraping for the kube-scheduler control plane component.

PR #8489 adds a CA-signed serving certificate, Service, and ServiceMonitor for the kube-scheduler, replacing the previously auto-generated self-signed certificates. This enables proper mTLS authentication for Prometheus metrics scraping of /metrics and /metrics/resources endpoints.

PR #8680 adds the necessary RBAC (ClusterRole and ClusterRoleBinding) in the hosted cluster for the system:kube-scheduler service account to access the /metrics/resources endpoint.

Conflict resolution notes:

  • hostedcontrolplane_controller.go: The v1 reconcileOLMAndMiscCerts function was refactored out in release-4.22. The scheduler cert reconciliation was added directly to the existing reconcilePKI function instead.
  • kube_scheduler/component.go: Kept util.AvailabilityProberOpts{} (release-4.22) instead of podspec.AvailabilityProberOpts{} (main), while adding the ServiceMonitor manifest adapter.

Which issue(s) this PR fixes:

Fixes CNTRLPLANE-4314

Special notes for your reviewer:

  • The conflict resolution in hostedcontrolplane_controller.go is the key area to review — the scheduler cert was placed between KCM and CVO certs in reconcilePKI, matching the logical placement from the original PR.
  • PR CNTRLPLANE-3954: add kube-scheduler metrics endpoint e2e coverage #9159 (e2e tests) was intentionally not backported because it gates on Version423 (would be skipped on 4.22) and depends on test/e2e/v2/util which doesn't exist on this branch.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

…erts

The kube-scheduler previously auto-generated self-signed serving
certificates via --cert-dir. This change adds a CA-signed serving
certificate, a Service, and a ServiceMonitor to enable Prometheus
metrics scraping with proper mTLS authentication.
Add unit tests for scheduler component options, ServiceMonitor adapter,
and server certificate reconciliation. Regenerate test fixtures after
adding Service, ServiceMonitor, and CA-signed serving certificate support.
The built-in system:monitoring ClusterRole only grants access to /metrics.
This adds a ClusterRole and ClusterRoleBinding in the guest cluster to
allow the metrics client to scrape /metrics/resources on kube-scheduler,
which exposes kube_pod_resource_request and kube_pod_resource_limit metrics.
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Sep 2, 2026
@openshift-ci-robot

openshift-ci-robot commented Sep 2, 2026

Copy link
Copy Markdown

@michaelryanmcneill: This pull request references CNTRLPLANE-4314 which is a valid jira issue.

Details

In response to this:

What this PR does / why we need it:

Cherry-picks PRs #8489 and #8680 to release-4.22 to enable Prometheus metrics scraping for the kube-scheduler control plane component.

PR #8489 adds a CA-signed serving certificate, Service, and ServiceMonitor for the kube-scheduler, replacing the previously auto-generated self-signed certificates. This enables proper mTLS authentication for Prometheus metrics scraping of /metrics and /metrics/resources endpoints.

PR #8680 adds the necessary RBAC (ClusterRole and ClusterRoleBinding) in the hosted cluster for the system:kube-scheduler service account to access the /metrics/resources endpoint.

Conflict resolution notes:

  • hostedcontrolplane_controller.go: The v1 reconcileOLMAndMiscCerts function was refactored out in release-4.22. The scheduler cert reconciliation was added directly to the existing reconcilePKI function instead.
  • kube_scheduler/component.go: Kept util.AvailabilityProberOpts{} (release-4.22) instead of podspec.AvailabilityProberOpts{} (main), while adding the ServiceMonitor manifest adapter.

Which issue(s) this PR fixes:

Fixes CNTRLPLANE-4314

Special notes for your reviewer:

  • The conflict resolution in hostedcontrolplane_controller.go is the key area to review — the scheduler cert was placed between KCM and CVO certs in reconcilePKI, matching the logical placement from the original PR.
  • PR CNTRLPLANE-3954: add kube-scheduler metrics endpoint e2e coverage #9159 (e2e tests) was intentionally not backported because it gates on Version423 (would be skipped on 4.22) and depends on test/e2e/v2/util which doesn't exist on this branch.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

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.

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 0ad0fd06-a589-4eb2-bfee-7740f05c6280

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@openshift-ci
openshift-ci Bot requested review from jparrill and muraee September 2, 2026 17:20
@openshift-ci openshift-ci Bot added the area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release label Sep 2, 2026
@michaelryanmcneill

Copy link
Copy Markdown
Contributor Author

/label area/control-plane-operator
/label area/hypershift-operator

@openshift-ci openshift-ci Bot added area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release and removed do-not-merge/needs-area labels Sep 2, 2026
@openshift-ci

openshift-ci Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

@michaelryanmcneill: The label(s) /label area/control-plane-operator , /label area/hypershift-operator cannot be applied. These labels are supported: acknowledge-critical-fixes-only, platform/aws, platform/azure, platform/baremetal, platform/google, platform/libvirt, platform/openstack, ga, tide/merge-method-merge, tide/merge-method-rebase, tide/merge-method-squash, px-approved, docs-approved, qe-approved, ux-approved, no-qe, rebase/manual, cluster-config-api-changed, run-integration-tests, verified, ready-for-human-review, reliability, approved, backport-risk-assessed, bugzilla/valid-bug, cherry-pick-approved, ci/severity-critical, jira/skip-dependent-bug-check, jira/valid-bug, ok-to-test, stability-fix-approved, staff-eng-approved. Is this label configured under labels -> additional_labels or labels -> restricted_labels in plugin.yaml?

Details

In response to this:

/label area/control-plane-operator
/label area/hypershift-operator

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 kubernetes-sigs/prow repository.

The cherry-picked fixtures from main had stale desired-state-hash
values that don't match the release-4.22 CPOv2 framework output.
Regenerated with UPDATE=true go test.

Signed-off-by: michaelryanmcneill <michael@michaelryanmcneill.com>
@michaelryanmcneill

Copy link
Copy Markdown
Contributor Author

/test "Verify / Verify"

@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.21053% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 36.57%. Comparing base (2f5225b) to head (57bcd6d).
⚠️ Report is 9 commits behind head on release-4.22.

Files with missing lines Patch % Lines
support/metrics/sets.go 50.00% 14 Missing ⚠️
...igoperator/controllers/resources/manifests/rbac.go 0.00% 12 Missing ⚠️
.../hostedcontrolplane/v2/kube_scheduler/component.go 0.00% 4 Missing ⚠️
...ostedcontrolplane/hostedcontrolplane_controller.go 50.00% 2 Missing and 1 partial ⚠️
...or/controllers/hostedcontrolplane/manifests/pki.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           release-4.22    #9490      +/-   ##
================================================
+ Coverage         36.53%   36.57%   +0.03%     
================================================
  Files               777      779       +2     
  Lines             95363    95458      +95     
================================================
+ Hits              34840    34909      +69     
- Misses            57682    57707      +25     
- Partials           2841     2842       +1     
Files with missing lines Coverage Δ
...or/controllers/hostedcontrolplane/pki/scheduler.go 100.00% <100.00%> (ø)
...edcontrolplane/v2/kube_scheduler/servicemonitor.go 100.00% <100.00%> (ø)
...igoperator/controllers/resources/rbac/reconcile.go 2.98% <100.00%> (+2.98%) ⬆️
...rconfigoperator/controllers/resources/resources.go 51.19% <100.00%> (+0.03%) ⬆️
...or/controllers/hostedcontrolplane/manifests/pki.go 0.00% <0.00%> (ø)
...ostedcontrolplane/hostedcontrolplane_controller.go 36.37% <50.00%> (+0.03%) ⬆️
.../hostedcontrolplane/v2/kube_scheduler/component.go 26.08% <0.00%> (+26.08%) ⬆️
...igoperator/controllers/resources/manifests/rbac.go 0.00% <0.00%> (ø)
support/metrics/sets.go 5.97% <50.00%> (+3.62%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@michaelryanmcneill

Copy link
Copy Markdown
Contributor Author

/test verify-deps

@michaelryanmcneill

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-upgrade-hypershift-operator
/test e2e-aws
/test e2e-v2-aws

@michaelryanmcneill

Copy link
Copy Markdown
Contributor Author

/verified by e2e-aws (TestCreateCluster) — kube-scheduler ServiceMonitor with /metrics and /metrics/resources mTLS endpoints, Service on port 10259, and hypershift-metrics-resources-reader ClusterRole/ClusterRoleBinding all confirmed in must-gather artifacts

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Sep 2, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@michaelryanmcneill: This PR has been marked as verified by e2e-aws (TestCreateCluster) — kube-scheduler ServiceMonitor with /metrics and /metrics/resources mTLS endpoints,Service on port 10259,and hypershift-metrics-resources-reader ClusterRole/ClusterRoleBinding all confirmed in must-gather artifacts.

Details

In response to this:

/verified by e2e-aws (TestCreateCluster) — kube-scheduler ServiceMonitor with /metrics and /metrics/resources mTLS endpoints, Service on port 10259, and hypershift-metrics-resources-reader ClusterRole/ClusterRoleBinding all confirmed in must-gather artifacts

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.

@celebdor celebdor changed the title CNTRLPLANE-4314: Cherry-pick kube-scheduler metrics support to release-4.22 CNTRLPLANE-4321: Cherry-pick kube-scheduler metrics support to release-4.22 Sep 3, 2026
@openshift-ci-robot

openshift-ci-robot commented Sep 3, 2026

Copy link
Copy Markdown

@michaelryanmcneill: This pull request references CNTRLPLANE-4321 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.22.0" version, but no target version was set.

Details

In response to this:

What this PR does / why we need it:

Cherry-picks PRs #8489 and #8680 to release-4.22 to enable Prometheus metrics scraping for the kube-scheduler control plane component.

PR #8489 adds a CA-signed serving certificate, Service, and ServiceMonitor for the kube-scheduler, replacing the previously auto-generated self-signed certificates. This enables proper mTLS authentication for Prometheus metrics scraping of /metrics and /metrics/resources endpoints.

PR #8680 adds the necessary RBAC (ClusterRole and ClusterRoleBinding) in the hosted cluster for the system:kube-scheduler service account to access the /metrics/resources endpoint.

Conflict resolution notes:

  • hostedcontrolplane_controller.go: The v1 reconcileOLMAndMiscCerts function was refactored out in release-4.22. The scheduler cert reconciliation was added directly to the existing reconcilePKI function instead.
  • kube_scheduler/component.go: Kept util.AvailabilityProberOpts{} (release-4.22) instead of podspec.AvailabilityProberOpts{} (main), while adding the ServiceMonitor manifest adapter.

Which issue(s) this PR fixes:

Fixes CNTRLPLANE-4314

Special notes for your reviewer:

  • The conflict resolution in hostedcontrolplane_controller.go is the key area to review — the scheduler cert was placed between KCM and CVO certs in reconcilePKI, matching the logical placement from the original PR.
  • PR CNTRLPLANE-3954: add kube-scheduler metrics endpoint e2e coverage #9159 (e2e tests) was intentionally not backported because it gates on Version423 (would be skipped on 4.22) and depends on test/e2e/v2/util which doesn't exist on this branch.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

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.

@celebdor

celebdor commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

/jira refresh

@openshift-ci-robot

openshift-ci-robot commented Sep 3, 2026

Copy link
Copy Markdown

@celebdor: This pull request references CNTRLPLANE-4321 which is a valid jira issue.

Details

In response to this:

/jira refresh

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.

@muraee

muraee commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

/approve

@openshift-ci

openshift-ci Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: michaelryanmcneill, muraee

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-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 3, 2026
@jparrill

jparrill commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

/retest-required

@jparrill

jparrill commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Sep 3, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks
/test e2e-azure-aks-external-oidc
/test e2e-azure-self-managed
/test e2e-kubevirt-aws-ovn-reduced

@michaelryanmcneill

Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot

openshift-ci-robot commented Sep 3, 2026

Copy link
Copy Markdown

@michaelryanmcneill: This pull request references CNTRLPLANE-4321 which is a valid jira issue.

Details

In response to this:

/jira refresh

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.

@michaelryanmcneill

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-upgrade-hypershift-operator

1 similar comment
@michaelryanmcneill

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-upgrade-hypershift-operator

@michaelryanmcneill

Copy link
Copy Markdown
Contributor Author

/retest-required

@csrwng csrwng added the backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. label Sep 4, 2026
@csrwng

csrwng commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

/override ci/prow/e2e-aws-upgrade-hypershift-operator

@openshift-ci

openshift-ci Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

@csrwng: Overrode contexts on behalf of csrwng: ci/prow/e2e-aws-upgrade-hypershift-operator

Details

In response to this:

/override ci/prow/e2e-aws-upgrade-hypershift-operator

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 kubernetes-sigs/prow repository.

@michaelryanmcneill

Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot

openshift-ci-robot commented Sep 4, 2026

Copy link
Copy Markdown

@michaelryanmcneill: This pull request references CNTRLPLANE-4321 which is a valid jira issue.

Details

In response to this:

/jira refresh

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.

@openshift-ci

openshift-ci Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

@michaelryanmcneill: The label(s) jira/valid-bug cannot be applied or removed, because you are not in one of the allowed teams and are not an allowed user. Must be a member of one of these teams: openshift-patch-managers, openshift-staff-engineers, openshift-release-oversight, openshift-sustaining-engineers

Details

In response to this:

/label jira/valid-bug

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 kubernetes-sigs/prow repository.

@michaelryanmcneill

michaelryanmcneill commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

/retitle [release-4.22] CNTRLPLANE-4321: Cherry-pick kube-scheduler metrics support

@openshift-ci openshift-ci Bot changed the title CNTRLPLANE-4321: Cherry-pick kube-scheduler metrics support to release-4.22 [release-4.22] CNTRLPLANE-4321: Cherry-pick kube-scheduler metrics support Sep 4, 2026
@michaelryanmcneill

Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot

openshift-ci-robot commented Sep 4, 2026

Copy link
Copy Markdown

@michaelryanmcneill: This pull request references CNTRLPLANE-4321 which is a valid jira issue.

Details

In response to this:

/jira refresh

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.

@csrwng csrwng added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Sep 4, 2026
@michaelryanmcneill

Copy link
Copy Markdown
Contributor Author

/refresh

@openshift-ci

openshift-ci Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

@michaelryanmcneill: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-upgrade-hypershift-operator 57bcd6d link true /test e2e-aws-upgrade-hypershift-operator

Full PR test history. Your PR dashboard.

Details

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 kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot
openshift-merge-bot Bot merged commit 7273000 into openshift:release-4.22 Sep 4, 2026
31 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants