Skip to content

OCPBUGS-100302: fix(metrics): only report limited support when label … - #9185

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
holysoles:OCPBUGS-100302
Aug 3, 2026
Merged

OCPBUGS-100302: fix(metrics): only report limited support when label …#9185
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
holysoles:OCPBUGS-100302

Conversation

@holysoles

@holysoles holysoles commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

The hypershift_cluster_limited_support_enabled metric currently reports 1 if the api.openshift.com/limited-support label is present, no matter the value.

clusters-service intentionally sets the label as false rather than deleting it when a cluster exists limited support, because the HC-to-HCP label sync is additive-only (OCPBUGS-85584).

This means clusters that enter limited support continue reporting hypershift_cluster_limited_support_enabled = 1 even when they exit limited support. This affects our ability to correctly silence alerts.

Which issue(s) this PR fixes:

Fixes OCPBUGS-100302

Special notes for your reviewer:

Checklist:

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

Summary by CodeRabbit

  • Bug Fixes
    • Corrected limited-support metrics to activate only when the corresponding label is explicitly set to true.
    • Prevented incorrectly reporting limited support when the label is present with another value.

@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 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 Jul 30, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@holysoles: This pull request references Jira Issue OCPBUGS-100302, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

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:

What this PR does / why we need it:

The hypershift_cluster_limited_support_enabled metric currently reports 1 if the api.openshift.com/limited-support label is present, no matter the value.

clusters-service intentionally sets the label as false rather than deleting it when a cluster exists limited support, because the HC-to-HCP label sync is additive-only (OCPBUGS-85584).

This means clusters that enter limited support continue reporting hypershift_cluster_limited_support_enabled = 1 even when they exit limited support. This affects our ability to correctly silence alerts.

Which issue(s) this PR fixes:

Fixes OCPBUGS-100302

Special notes for your reviewer:

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 Jul 30, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The limited-support metric now reports enabled only when hyperv1.LimitedSupportLabel is present with the exact value "true". Labels with other values no longer set the gauge to 1.0.

Suggested reviewers: bryan-cox

🚥 Pre-merge checks | ✅ 11
✅ Passed checks (11 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PR changes only metrics.go; no Ginkgo test titles were added or modified, so the stable-name check is not implicated.
Test Structure And Quality ✅ Passed No Ginkgo test code changed in this PR; only metrics.go was modified, so the test-structure check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed Only a metric label-value check changed in metrics.go; no deployments, affinities, selectors, replicas, or topology logic were introduced.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Only metrics.go changed; no new Ginkgo/e2e tests or network-dependent code were added.
No-Weak-Crypto ✅ Passed Only change is a label value check in metrics.go; no crypto APIs, weak ciphers, or secret comparisons were added.
Container-Privileges ✅ Passed The PR only changes a metrics label check in metrics.go; no container/K8s manifests or privilege-related fields were added or modified.
No-Sensitive-Data-In-Logs ✅ Passed Only a metric predicate changed; no new or modified logging, and no sensitive values are emitted in the touched code.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: limiting the metric to report enabled only when the label value is true.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@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 Jul 30, 2026
@openshift-ci
openshift-ci Bot requested review from clebs and enxebre July 30, 2026 18:18

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
hypershift-operator/controllers/hostedcluster/metrics/metrics.go (1)

418-420: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a regression case for an explicit "false" label.

The implementation correctly distinguishes "true" from other values, but metrics_test.go currently covers only "true" and an absent label. Add "false" with an expected metric value of 0 to protect the OCPBUGS-100302 fix from regressing to key-presence-only logic.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@hypershift-operator/controllers/hostedcluster/metrics/metrics.go` around
lines 418 - 420, Add a regression case in metrics_test.go for a present
hyperv1.LimitedSupportLabel set explicitly to "false", and assert the resulting
metric value is 0. Keep the existing "true" and absent-label cases unchanged so
the test verifies value-based handling rather than key presence.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@hypershift-operator/controllers/hostedcluster/metrics/metrics.go`:
- Around line 418-420: Add a regression case in metrics_test.go for a present
hyperv1.LimitedSupportLabel set explicitly to "false", and assert the resulting
metric value is 0. Keep the existing "true" and absent-label cases unchanged so
the test verifies value-based handling rather than key presence.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: 3899e0ec-c3aa-434e-921c-e83a0f77c836

📥 Commits

Reviewing files that changed from the base of the PR and between 1c9f189 and c5f8b48.

📒 Files selected for processing (1)
  • hypershift-operator/controllers/hostedcluster/metrics/metrics.go

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.77%. Comparing base (1c9f189) to head (d28b683).
⚠️ Report is 32 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9185   +/-   ##
=======================================
  Coverage   44.77%   44.77%           
=======================================
  Files         775      775           
  Lines       97210    97210           
=======================================
  Hits        43528    43528           
  Misses      50681    50681           
  Partials     3001     3001           
Files with missing lines Coverage Δ
...rator/controllers/hostedcluster/metrics/metrics.go 93.03% <100.00%> (ø)
Flag Coverage Δ
cmd-support 38.42% <ø> (ø)
cpo-hostedcontrolplane 47.25% <ø> (ø)
cpo-other 45.45% <ø> (ø)
hypershift-operator 54.63% <100.00%> (ø)
other 34.32% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@holysoles

Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot

Copy link
Copy Markdown

@holysoles: This pull request references Jira Issue OCPBUGS-100302, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

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.

@holysoles

Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot openshift-ci-robot 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 Jul 30, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@holysoles: This pull request references Jira Issue OCPBUGS-100302, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)
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.

@holysoles
holysoles force-pushed the OCPBUGS-100302 branch 2 times, most recently from d3fa737 to 982db0f Compare July 30, 2026 19:28
@openshift-ci-robot

Copy link
Copy Markdown

@holysoles: This pull request references Jira Issue OCPBUGS-100302, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

What this PR does / why we need it:

The hypershift_cluster_limited_support_enabled metric currently reports 1 if the api.openshift.com/limited-support label is present, no matter the value.

clusters-service intentionally sets the label as false rather than deleting it when a cluster exists limited support, because the HC-to-HCP label sync is additive-only (OCPBUGS-85584).

This means clusters that enter limited support continue reporting hypershift_cluster_limited_support_enabled = 1 even when they exit limited support. This affects our ability to correctly silence alerts.

Which issue(s) this PR fixes:

Fixes OCPBUGS-100302

Special notes for your reviewer:

Checklist:

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

Summary by CodeRabbit

  • Bug Fixes
  • Corrected limited-support metrics to activate only when the corresponding label is explicitly set to true.
  • Prevented incorrectly reporting limited support when the label is present with another value.

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.

Comment thread hypershift-operator/controllers/hostedcluster/metrics/metrics_test.go Outdated
CS sets api.openshift.com/limited-support to false rather
than deleting it when exiting limited support, because HC-to-HCP
label sync is additive-only (OCPBUGS-85584). The metric collector only
checked key presence, so clusters that entered limited support
permanently reported 1.0 even after support was restored.

Check the value is true before reporting the metric as enabled.

@joshbranham joshbranham left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 30, 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-4-22
/test e2e-aws-4-22
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws
/test e2e-v2-azure-self-managed
/test e2e-v2-gke
/test unit
/test verify

@holysoles

Copy link
Copy Markdown
Contributor Author

/retest

@holysoles

Copy link
Copy Markdown
Contributor Author

/retest-required

@cwbotbot

cwbotbot commented Jul 31, 2026

Copy link
Copy Markdown

Test Results

e2e-aws

e2e-aks

@holysoles

Copy link
Copy Markdown
Contributor Author

/retest-required

1 similar comment
@holysoles

Copy link
Copy Markdown
Contributor Author

/retest-required

@ironcladlou

Copy link
Copy Markdown
Contributor

/approve

@holysoles

Copy link
Copy Markdown
Contributor Author

/retest-required

@joshbranham

Copy link
Copy Markdown
Contributor

/verified by @holysoles via unit tests

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

Copy link
Copy Markdown

@joshbranham: This PR has been marked as verified by @holysoles via unit tests.

Details

In response to this:

/verified by @holysoles via 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.

@csrwng csrwng added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 3, 2026
@openshift-ci

openshift-ci Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: holysoles, ironcladlou

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 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@holysoles: 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 923aba2 into openshift:main Aug 3, 2026
43 checks passed
@openshift-ci-robot

Copy link
Copy Markdown

@holysoles: Jira Issue Verification Checks: Jira Issue OCPBUGS-100302
✔️ 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-100302 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:

What this PR does / why we need it:

The hypershift_cluster_limited_support_enabled metric currently reports 1 if the api.openshift.com/limited-support label is present, no matter the value.

clusters-service intentionally sets the label as false rather than deleting it when a cluster exists limited support, because the HC-to-HCP label sync is additive-only (OCPBUGS-85584).

This means clusters that enter limited support continue reporting hypershift_cluster_limited_support_enabled = 1 even when they exit limited support. This affects our ability to correctly silence alerts.

Which issue(s) this PR fixes:

Fixes OCPBUGS-100302

Special notes for your reviewer:

Checklist:

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

Summary by CodeRabbit

  • Bug Fixes
  • Corrected limited-support metrics to activate only when the corresponding label is explicitly set to true.
  • Prevented incorrectly reporting limited support when the label is present with another value.

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 5.0.0-0.nightly-2026-08-04-023110

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/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release 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