Skip to content

OCPBUGS-81500: fix: udpate healthcheck previous state only after successful operator status update - #1614

Open
fracappa wants to merge 1 commit into
openshift:mainfrom
fracappa:fca/fix-healthcheck-degraded-condition-not-cleared
Open

OCPBUGS-81500: fix: udpate healthcheck previous state only after successful operator status update#1614
fracappa wants to merge 1 commit into
openshift:mainfrom
fracappa:fca/fix-healthcheck-degraded-condition-not-cleared

Conversation

@fracappa

@fracappa fracappa commented May 8, 2026

Copy link
Copy Markdown
Contributor

Previously, getPacemakerStatus updated c.previous before updateOperatorStatus was called. If the status update failed, subsequent syncs would skip processing because c.previous already reflected the new CR timestamp, leaving PacemakerHealthCheckDegraded stuck a True indefinitely.

Summary by CodeRabbit

Bug Fixes

  • Improved Pacemaker health check status tracking for more accurate grace-period timing and state transitions.
  • Prevented unknown status values from replacing meaningful health information.
  • Improved consistency between reported health status and recorded health events.
  • Preserved status timestamps when health conditions remain unchanged.
  • Improved persistence of health information between consecutive checks.

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 8, 2026
@openshift-ci

openshift-ci Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

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

Copy link
Copy Markdown

@fracappa: This pull request references Jira Issue OCPBUGS-81500, 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:

Previously, getPacemakerStatus updated c.previous before updateOperatorStatus was called. If the status update failed, subsequent syncs would skip processing because c.previous already reflected the new CR timestamp, leaving PacemakerHealthCheckDegraded stuck a True indefinitely.

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 May 8, 2026
@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Pacemaker health checks now update the stored non-Unknown status after processing and event recording. Status construction preserves CRLastUpdated. The unchanged-timestamp test initializes the stored previous status.

Changes

Pacemaker health status tracking

Layer / File(s) Summary
Status synchronization and validation
pkg/tnf/pkg/pacemaker/healthcheck.go, pkg/tnf/pkg/pacemaker/healthcheck_test.go
sync stores non-Unknown status after processing and event recording. Status construction uses the lowercase health-status builder and preserves CRLastUpdated. The test stores the first returned status before the second call.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: jaypoulz

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 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 fix: update health-check previous state only after a successful operator status update.
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 changed tests use Go testing, not Ginkgo. The added test has a static name, and all existing subtest names are fixed literals with no dynamic values.
Test Structure And Quality ✅ Passed The changed test is a standard testify unit test, not Ginkgo; it uses in-memory fakes, has no cluster waits or resources, and all assertions include diagnostic messages.
Microshift Test Compatibility ✅ Passed The only changed test is a Go testing unit test; it adds no Ginkgo e2e test, so MicroShift API compatibility checks do not apply.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR adds only standard Go unit-test changes in pkg/tnf/pkg/pacemaker; it adds no Ginkgo e2e tests or multi-node assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed The commit changes only pacemaker healthcheck state handling and a unit test; it adds no manifests, replica settings, affinity, topology spread, selectors, tolerations, or PDBs.
Ote Binary Stdout Contract ✅ Passed The PR changes only Pacemaker healthcheck code and a unit test. No process-level stdout write was added; OTE routes Ginkgo output and klog to stderr.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The commit adds no Ginkgo e2e tests. It changes pacemaker logic and a standard Go unit test, so IPv6 or disconnected e2e compatibility checks do not apply.
No-Weak-Crypto ✅ Passed The PR adds only health-status state handling and a test assignment; the patch has no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret comparisons.
Container-Privileges ✅ Passed The PR changes only two Go files. No container/Kubernetes manifests or privileged settings were added, including hostPID, hostNetwork, hostIPC, SYS_ADMIN, or allowPrivilegeEscalation.
No-Sensitive-Data-In-Logs ✅ Passed The patch adds no logging calls or log messages; it only moves previous-state assignment and preserves CRLastUpdated.
✨ 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-robot

Copy link
Copy Markdown

@fracappa: This pull request references Jira Issue OCPBUGS-81500, 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:

Previously, getPacemakerStatus updated c.previous before updateOperatorStatus was called. If the status update failed, subsequent syncs would skip processing because c.previous already reflected the new CR timestamp, leaving PacemakerHealthCheckDegraded stuck a True indefinitely.

Summary by CodeRabbit

Bug Fixes

  • Corrected Pacemaker health check status tracking to ensure accurate grace-period timing and state transitions
  • Fixed handling of unknown status values during operator condition updates
  • Improved reliability of health check status persistence logic

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.

@fracappa
fracappa marked this pull request as ready for review May 20, 2026 13:39
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 20, 2026
@openshift-ci
openshift-ci Bot requested review from fonta-rh and jaypoulz May 20, 2026 13:40

@fonta-rh fonta-rh 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 — the fix correctly moves c.previous assignment from getPacemakerStatus() to after updateOperatorStatus() succeeds in sync(), so a failed status write no longer poisons the skip-optimization cache.

One minor nit: the doc comment on getPacemakerStatus() (line 254) still says "For Unknown status, previous is not updated" — this referred to c.previous being written inside the function, which no longer happens for any status. Consider removing that line or replacing with something like:

// Note: c.previous is updated by sync() after successful status write, not here.

Non-blocking, cosmetic only.

@openshift-ci

openshift-ci Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fonta-rh

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 Jul 20, 2026
@fonta-rh

Copy link
Copy Markdown
Contributor

/lgtm

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

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-agnostic-ovn
/test e2e-agnostic-ovn-upgrade
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-aws-ovn-single-node
/test e2e-gcp-operator
/test e2e-gcp-operator-disruptive
/test e2e-metal-ipi-ovn-ipv6
/test e2e-operator

@fracappa

Copy link
Copy Markdown
Contributor Author

/retest-required

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 30, 2026
@fracappa

fracappa commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

/retest-required

@fracappa
fracappa force-pushed the fca/fix-healthcheck-degraded-condition-not-cleared branch from e897f46 to d12813a Compare August 7, 2026 13:41
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 7, 2026
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 7, 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 `@pkg/tnf/pkg/pacemaker/healthcheck.go`:
- Around line 268-274: Remove the pre-update assignment to c.previous in
getPacemakerStatus, leaving only the post-success assignment guarded by
currentStatus.OverallStatus != statusUnknown. Ensure failed updateOperatorStatus
calls leave the prior state intact so the next sync does not skip the status
change, and add a regression test covering that failure path.
🪄 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: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b78b6f2-89dc-48cc-9862-837997f3c2d0

📥 Commits

Reviewing files that changed from the base of the PR and between fb904c8 and d12813a.

📒 Files selected for processing (2)
  • pkg/tnf/pkg/pacemaker/healthcheck.go
  • pkg/tnf/pkg/pacemaker/healthcheck_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/tnf/pkg/pacemaker/healthcheck_test.go

Comment thread pkg/tnf/pkg/pacemaker/healthcheck.go Outdated
@fracappa
fracappa force-pushed the fca/fix-healthcheck-degraded-condition-not-cleared branch from d12813a to e897f46 Compare August 7, 2026 13:53
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 7, 2026
@fracappa
fracappa force-pushed the fca/fix-healthcheck-degraded-condition-not-cleared branch from e897f46 to 31ad611 Compare August 7, 2026 14:04
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 7, 2026
Comment thread pkg/tnf/pkg/pacemaker/healthcheck.go Outdated

@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: 2

🤖 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 `@pkg/tnf/pkg/pacemaker/healthcheck.go`:
- Around line 268-274: Update the guard in the pacemaker health-check processing
flow to compare currentStatus.OverallStatus against the declared StatusUnknown
constant, replacing the undefined statusUnknown reference while preserving the
existing previous-status update behavior.
- Around line 314-316: Update the health-status construction around
buildHealthStatusFromCR so currentStatus.CRLastUpdated receives the
PacemakerCluster status.lastUpdated value from pacemakerCR, replacing the
undeclared crLastUpdated reference. Preserve the existing
buildHealthStatusFromCR flow.
🪄 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: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3ef598e5-96e9-4b50-a4eb-35163df83e7c

📥 Commits

Reviewing files that changed from the base of the PR and between d12813a and 31ad611.

📒 Files selected for processing (1)
  • pkg/tnf/pkg/pacemaker/healthcheck.go

Comment thread pkg/tnf/pkg/pacemaker/healthcheck.go Outdated
Comment thread pkg/tnf/pkg/pacemaker/healthcheck.go Outdated
@fonta-rh

fonta-rh commented Aug 7, 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 Aug 7, 2026
@fonta-rh

fonta-rh commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

/retest

2 similar comments
@fracappa

fracappa commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@fracappa

fracappa commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 7, 2026
@fracappa
fracappa force-pushed the fca/fix-healthcheck-degraded-condition-not-cleared branch from 2c03ca0 to fd9198a Compare August 7, 2026 15:15
@fracappa

fracappa commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

/retest-required

2 similar comments
@fracappa

fracappa commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

/retest-required

@fracappa

Copy link
Copy Markdown
Contributor Author

/retest-required

… status update

Previously, getPacemakerStatus updated c.previous before updateOperatorStatus
was called. If the status update failed, subsequent syncs would skip processing
because c.previous already reflected the new CR timestamp, leaving
PacemakerHealthCheckDegraded stuck a True indefinitely.
@fracappa
fracappa force-pushed the fca/fix-healthcheck-degraded-condition-not-cleared branch from ada2cc5 to ba09c16 Compare August 10, 2026 08:12
@fonta-rh

Copy link
Copy Markdown
Contributor

/lgtm

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

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-agnostic-ovn
/test e2e-agnostic-ovn-upgrade
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-aws-ovn-single-node
/test e2e-gcp-operator
/test e2e-gcp-operator-disruptive
/test e2e-metal-ipi-ovn-ipv6
/test e2e-operator

@openshift-ci

openshift-ci Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

@fracappa: The following tests 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-gcp-operator-disruptive ba09c16 link true /test e2e-gcp-operator-disruptive
ci/prow/e2e-metal-ipi-ovn-ipv6 ba09c16 link true /test e2e-metal-ipi-ovn-ipv6

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.

@fracappa

Copy link
Copy Markdown
Contributor Author

/retest-required

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants