[release-4.22] OCPBUGS-83576: fix(metrics-proxy): resolve ports from pods instead of deployments#8260
Conversation
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>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@openshift-cherrypick-robot: Jira Issue OCPBUGS-83538 has been cloned as Jira Issue OCPBUGS-83576. Will retitle bug to link to clone. DetailsIn response to this:
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-cherrypick-robot: This pull request references Jira Issue OCPBUGS-83576, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
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 Report❌ Patch coverage is
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
🚀 New features to boost your workflow:
|
|
/jira refresh |
|
@muraee: This pull request references Jira Issue OCPBUGS-83576, which is invalid:
Comment DetailsIn response to this:
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. |
|
/jira refresh |
|
@muraee: This pull request references Jira Issue OCPBUGS-83576, which is invalid:
Comment DetailsIn response to this:
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. |
|
/jira refresh |
|
@celebdor: This pull request references Jira Issue OCPBUGS-83576, which is invalid:
Comment DetailsIn response to this:
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. |
|
/jira refresh |
|
@celebdor: This pull request references Jira Issue OCPBUGS-83576, which is invalid:
Comment DetailsIn response to this:
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. |
|
/verified by @jiezhao16 |
|
/approve |
|
@muraee: This PR has been marked as verified by DetailsIn response to this:
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. |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/label backport-risk-assessed |
|
/lgtm |
|
@openshift-cherrypick-robot: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
293c70e
into
openshift:release-4.22
|
@openshift-cherrypick-robot: Jira Issue Verification Checks: Jira Issue OCPBUGS-83576 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. 🕓 DetailsIn response to this:
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. |
|
Fix included in release 4.22.0-0.nightly-2026-04-20-143244 |
This is an automated cherry-pick of #8221
/assign muraee