Skip to content

[release-4.22] OCPBUGS-83576: fix(metrics-proxy): resolve ports from pods instead of deployments#8260

Merged
openshift-merge-bot[bot] merged 2 commits intoopenshift:release-4.22from
openshift-cherrypick-robot:cherry-pick-8221-to-release-4.22
Apr 20, 2026
Merged

[release-4.22] OCPBUGS-83576: fix(metrics-proxy): resolve ports from pods instead of deployments#8260
openshift-merge-bot[bot] merged 2 commits intoopenshift:release-4.22from
openshift-cherrypick-robot:cherry-pick-8221-to-release-4.22

Conversation

@openshift-cherrypick-robot
Copy link
Copy Markdown

This is an automated cherry-pick of #8221

/assign muraee

muraee and others added 2 commits April 16, 2026 12:45
Fix two bugs in the metrics-proxy scrape config generation:

1. PodMonitor port resolution used the PodMonitor name to look up a
Deployment by convention. This broke for the control-plane-operator
because its PodMonitor YAML has name: controlplane-operator while the
Deployment is named control-plane-operator. Replace with resolvePodPort
which uses the PodMonitor's full label selector to find matching Pods.

2. ServiceMonitor named targetPort resolution fell back to the Service's
port field when targetPort was a string. Now resolves named targetPorts
from matching Pods via the Service's selector.

Additionally:
- Use metav1.LabelSelectorAsSelector for full selector support including
  matchExpressions.
- Scan all matching pods (not just the first) to handle rollouts where
  different pod revisions coexist.
- Add regression test for PodMonitor name mismatch scenario.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When the EnableMetricsForwarding annotation is removed, the CPO deletes
the metrics-proxy Route from the management cluster. The HCCO then gets
NotFound on the route lookup and silently returns nil without cleaning
up the guest cluster resources (deployment, configmap, serving CA, pod
monitor).

Add an explicit check for the EnableMetricsForwarding annotation so that
guest resources are deleted when forwarding is not enabled, matching the
existing DisableMonitoringServices cleanup path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 16, 2026

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: Pro Plus

Run ID: b1c46b57-602a-4702-b7b6-52e3c8297731

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci bot requested review from enxebre and muraee April 16, 2026 12:45
@openshift-ci openshift-ci bot added area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release and removed do-not-merge/needs-area labels Apr 16, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@openshift-cherrypick-robot: Jira Issue OCPBUGS-83538 has been cloned as Jira Issue OCPBUGS-83576. Will retitle bug to link to clone.
/retitle [release-4.22] OCPBUGS-83576: fix(metrics-proxy): resolve ports from pods instead of deployments

Details

In response to this:

This is an automated cherry-pick of #8221

/assign muraee

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 changed the title [release-4.22] OCPBUGS-83538: fix(metrics-proxy): resolve ports from pods instead of deployments [release-4.22] OCPBUGS-83576: fix(metrics-proxy): resolve ports from pods instead of deployments Apr 16, 2026
@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Apr 16, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@openshift-cherrypick-robot: This pull request references Jira Issue OCPBUGS-83576, which is invalid:

  • release note text must be set and not match the template OR release note type must be set to "Release Note Not Required". For more information you can reference the OpenShift Bug Process.
  • expected dependent Jira Issue OCPBUGS-83538 to target a version in 4.23.0, but it targets "5.0.0" instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

This is an automated cherry-pick of #8221

/assign muraee

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.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 70.00000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.64%. Comparing base (db4a009) to head (0564c4c).
⚠️ Report is 5 commits behind head on release-4.22.

Files with missing lines Patch % Lines
...stedcontrolplane/v2/metrics_proxy/scrape_config.go 66.66% 6 Missing and 3 partials ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           release-4.22    #8260      +/-   ##
================================================
- Coverage         34.64%   34.64%   -0.01%     
================================================
  Files               767      767              
  Lines             93175    93192      +17     
================================================
+ Hits              32280    32284       +4     
- Misses            58222    58233      +11     
- Partials           2673     2675       +2     
Files with missing lines Coverage Δ
...rconfigoperator/controllers/resources/resources.go 50.52% <100.00%> (-0.13%) ⬇️
...stedcontrolplane/v2/metrics_proxy/scrape_config.go 70.14% <66.66%> (-1.94%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@muraee
Copy link
Copy Markdown
Contributor

muraee commented Apr 17, 2026

/jira refresh

@openshift-ci-robot
Copy link
Copy Markdown

@muraee: This pull request references Jira Issue OCPBUGS-83576, which is invalid:

  • release note text must be set and not match the template OR release note type must be set to "Release Note Not Required". For more information you can reference the OpenShift Bug Process.
  • expected dependent Jira Issue OCPBUGS-83538 to target a version in 5.0.0, but it targets "4.23.0" instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

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
Copy link
Copy Markdown
Contributor

muraee commented Apr 17, 2026

/jira refresh

@openshift-ci-robot
Copy link
Copy Markdown

@muraee: This pull request references Jira Issue OCPBUGS-83576, which is invalid:

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

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.

@celebdor
Copy link
Copy Markdown
Collaborator

/jira refresh

@openshift-ci-robot
Copy link
Copy Markdown

@celebdor: This pull request references Jira Issue OCPBUGS-83576, which is invalid:

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

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.

@celebdor
Copy link
Copy Markdown
Collaborator

/jira refresh

@openshift-ci-robot
Copy link
Copy Markdown

@celebdor: This pull request references Jira Issue OCPBUGS-83576, which is invalid:

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

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.

@celebdor celebdor added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Apr 17, 2026
@muraee
Copy link
Copy Markdown
Contributor

muraee commented Apr 17, 2026

/verified by @jiezhao16

@muraee
Copy link
Copy Markdown
Contributor

muraee commented Apr 17, 2026

/approve

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Apr 17, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@muraee: This PR has been marked as verified by @jiezhao16.

Details

In response to this:

/verified by @jiezhao16

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
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 17, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: muraee, openshift-cherrypick-robot

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 Apr 17, 2026
@csrwng
Copy link
Copy Markdown
Contributor

csrwng commented Apr 17, 2026

/label backport-risk-assessed

@openshift-ci openshift-ci bot added the backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. label Apr 17, 2026
@muraee
Copy link
Copy Markdown
Contributor

muraee commented Apr 20, 2026

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 20, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 20, 2026

@openshift-cherrypick-robot: all tests passed!

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 293c70e into openshift:release-4.22 Apr 20, 2026
17 checks passed
@openshift-ci-robot
Copy link
Copy Markdown

@openshift-cherrypick-robot: Jira Issue Verification Checks: Jira Issue OCPBUGS-83576
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-83576 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

This is an automated cherry-pick of #8221

/assign muraee

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-merge-robot
Copy link
Copy Markdown
Contributor

Fix included in release 4.22.0-0.nightly-2026-04-20-143244

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 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.

6 participants