Skip to content

OCPBUGS-95614: fix(cpo): include unavailable components in KASLoadBalancerNotReachable message - #9232

Open
hypershift-jira-solve-ci[bot] wants to merge 1 commit into
openshift:mainfrom
hypershift-community:fix-OCPBUGS-95614
Open

OCPBUGS-95614: fix(cpo): include unavailable components in KASLoadBalancerNotReachable message#9232
hypershift-jira-solve-ci[bot] wants to merge 1 commit into
openshift:mainfrom
hypershift-community:fix-OCPBUGS-95614

Conversation

@hypershift-jira-solve-ci

@hypershift-jira-solve-ci hypershift-jira-solve-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

When a KAS health check error occurs simultaneously with unavailable components, the component unavailability information was silently dropped due to switch-case priority in the control plane operator's status handling. This fix appends the component unavailability message to the health check error so operators see the full picture when diagnosing KASLoadBalancerNotReachable conditions.

Which issue(s) this PR fixes:

Fixes https://redhat.atlassian.net/browse/OCPBUGS-95614

Special notes for your reviewer:

The change ensures that when both a health check error and unavailable components exist, the unavailability details are included in the condition message rather than being silently dropped by the switch-case fallthrough.

Checklist:

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

Always review AI generated responses prior to use.
Generated with Claude Code via openshift-developer plugin


Note: This PR was auto-generated by the jira-agent periodic CI job in response to OCPBUGS-95614. See the full report for token usage, cost breakdown, and detailed phase output.

Summary by CodeRabbit

  • Bug Fixes
    • Improved availability status messages when the KAS load balancer health check fails.
    • Combined health-check failures with control-plane component availability details for clearer diagnostics.
    • Preserved the primary health-check error when multiple availability issues occur.

…le message

When a KAS health check error occurs simultaneously with unavailable
components, the component information was silently dropped due to
switch-case priority. Append the component unavailability message to
the health check error so operators see the full picture.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@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 Aug 5, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@hypershift-jira-solve-ci[bot]: This pull request references Jira Issue OCPBUGS-95614, 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)

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:

When a KAS health check error occurs simultaneously with unavailable components, the component unavailability information was silently dropped due to switch-case priority in the control plane operator's status handling. This fix appends the component unavailability message to the health check error so operators see the full picture when diagnosing KASLoadBalancerNotReachable conditions.

Which issue(s) this PR fixes:

Fixes https://redhat.atlassian.net/browse/OCPBUGS-95614

Special notes for your reviewer:

The change ensures that when both a health check error and unavailable components exist, the unavailability details are included in the condition message rather than being silently dropped by the switch-case fallthrough.

Checklist:

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

Always review AI generated responses prior to use.
Generated with Claude Code via openshift-developer plugin

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-robot openshift-ci-robot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The controller now appends the control-plane component unavailability message to KAS load-balancer health-check failures. Tests cover message concatenation and precedence when both health-check and component-list errors occur.

Suggested reviewers: csrwng, bryan-cox, muraee

🚥 Pre-merge checks | ✅ 10 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning The new pure table-driven cases use shared Gomega assertions without meaningful failure messages; setup, cleanup, and timeout requirements do not apply. Add diagnostic messages to the availability assertions, such as identifying ready, reason, message, status, or generation mismatches.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the bug and the main change: adding unavailable component details to the KASLoadBalancerNotReachable message.
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 The added subtests use static name strings via t.Run(tc.name); titles contain no generated values, timestamps, node/namespace names, IPs, or random identifiers.
Topology-Aware Scheduling Compatibility ✅ Passed The commit only appends a component message to an availability status error and adds status tests; it introduces no topology, affinity, replica, node, taint, or PDB scheduling constraint.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR adds only standard Go unit-test cases in TestReconcileAvailabilityStatus; no Ginkgo e2e tests, IPv4 literals, URLs, or external connectivity were added.
No-Weak-Crypto ✅ Passed The PR changes only status-message concatenation and table-driven tests; the complete two-file patch adds no weak crypto, custom crypto, or secret comparisons.
Container-Privileges ✅ Passed The PR changes only two Go files; the diff contains no Kubernetes manifests or privilege settings such as privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, or allowPrivilegeEscalation.
No-Sensitive-Data-In-Logs ✅ Passed The patch adds no logging. It only appends component availability text to a Kubernetes status condition, and adds no password, token, key, PII, or session data.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci-robot

Copy link
Copy Markdown

@hypershift-jira-solve-ci[bot]: This pull request references Jira Issue OCPBUGS-95614, 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:

When a KAS health check error occurs simultaneously with unavailable components, the component unavailability information was silently dropped due to switch-case priority in the control plane operator's status handling. This fix appends the component unavailability message to the health check error so operators see the full picture when diagnosing KASLoadBalancerNotReachable conditions.

Which issue(s) this PR fixes:

Fixes https://redhat.atlassian.net/browse/OCPBUGS-95614

Special notes for your reviewer:

The change ensures that when both a health check error and unavailable components exist, the unavailability details are included in the condition message rather than being silently dropped by the switch-case fallthrough.

Checklist:

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

Always review AI generated responses prior to use.
Generated with Claude Code via openshift-developer plugin


Note: This PR was auto-generated by the jira-agent periodic CI job in response to OCPBUGS-95614. See the full report for token usage, cost breakdown, and detailed phase output.

Summary by CodeRabbit

  • Bug Fixes
  • Improved availability status messages when the KAS load balancer health check fails.
  • Combined health-check failures with control-plane component availability details for clearer diagnostics.
  • Preserved the primary health-check error when multiple availability issues occur.

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 requested review from devguyio and muraee August 5, 2026 18:15
@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 Aug 5, 2026

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

Actionable comments posted: 1

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

Inline comments:
In
`@control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go`:
- Around line 932-934: Update reconcileAvailabilityAndReadyStatus so
controlPlaneComponentsAvailable is queried when healthCheckErr is non-nil as
well as when the prior Available condition is false, ensuring
componentsNotAvailableMsg is populated and appended for KAS health-check
failures. Add a regression test covering a previously Available
HostedControlPlane transitioning to unavailable with both a KAS health-check
error and unavailable components.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: db9aa6e0-d15c-4963-aaed-2c4371d4fdf5

📥 Commits

Reviewing files that changed from the base of the PR and between 8317d4c and 684d754.

📒 Files selected for processing (2)
  • control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go
  • control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller_test.go

Comment on lines +932 to +934
if componentsNotAvailableMsg != "" {
message += "; " + componentsNotAvailableMsg
}

@coderabbitai coderabbitai Bot Aug 5, 2026

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Check component availability when the KAS health check fails.

reconcileAvailabilityAndReadyStatus only populates componentsNotAvailableMsg when the prior Available condition is false. If a previously available HostedControlPlane has a KAS health-check failure and unavailable components in the same reconcile, this branch receives an empty message and omits the component details.

Query controlPlaneComponentsAvailable when healthCheckErr != nil too. Add a regression test for the prior-Available transition.

Proposed fix
-	if !alreadyAvailable {
+	if !alreadyAvailable || healthCheckErr != nil {
 		componentsNotAvailableMsg, componentsErr = r.controlPlaneComponentsAvailable(ctx, hostedControlPlane)
 	}
🤖 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
`@control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go`
around lines 932 - 934, Update reconcileAvailabilityAndReadyStatus so
controlPlaneComponentsAvailable is queried when healthCheckErr is non-nil as
well as when the prior Available condition is false, ensuring
componentsNotAvailableMsg is populated and appended for KAS health-check
failures. Add a regression test covering a previously Available
HostedControlPlane transitioning to unavailable with both a KAS health-check
error and unavailable components.

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.

+1

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.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

test_file=$(fd -a '^hostedcontrolplane_controller_test\.go$' control-plane-operator/controllers/hostedcontrolplane | head -n 1)
ast-grep outline "$test_file" --match 'TestReconcileAvailabilityStatus' --view expanded
rg -n -A100 -B10 'func TestReconcileAvailabilityStatus\b|func \(r \*HostedControlPlaneReconciler\) reconcileAvailabilityAndReadyStatus\b' \
  control-plane-operator/controllers/hostedcontrolplane

Length of output: 30554


@muraee, the inspection confirms the finding.

reconcileAvailabilityAndReadyStatus still skips controlPlaneComponentsAvailable when the previous HostedControlPlaneAvailable condition is True.

TestReconcileAvailabilityStatus only tests message selection. It cannot verify the skipped component query. The regression test should call reconcileAvailabilityAndReadyStatus with a prior available condition, a KAS health-check error, and an unavailable ControlPlaneComponent.

You are interacting with an AI system.

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.96%. Comparing base (8317d4c) to head (684d754).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9232   +/-   ##
=======================================
  Coverage   44.96%   44.96%           
=======================================
  Files         778      778           
  Lines       97452    97455    +3     
=======================================
+ Hits        43820    43823    +3     
  Misses      50607    50607           
  Partials     3025     3025           
Files with missing lines Coverage Δ
...ostedcontrolplane/hostedcontrolplane_controller.go 46.33% <100.00%> (+0.06%) ⬆️
Flag Coverage Δ
cmd-support 38.62% <ø> (ø)
cpo-hostedcontrolplane 47.29% <100.00%> (+<0.01%) ⬆️
cpo-other 45.67% <ø> (ø)
hypershift-operator 55.00% <ø> (ø)
other 34.30% <ø> (ø)

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.

@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@hypershift-jira-solve-ci[bot]: 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.

@muraee

muraee commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

/approve

@openshift-ci

openshift-ci Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hypershift-jira-solve-ci[bot], 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 Aug 6, 2026
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 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants