Skip to content

Operator initiates failover without waiting for kubelet to confirm pod is not ready - #10428

Open
bramhanandlingala wants to merge 2 commits into
cloudnative-pg:mainfrom
bramhanandlingala:issue_10412
Open

bramhanandlingala wants to merge 2 commits into
cloudnative-pg:mainfrom
bramhanandlingala:issue_10412

Conversation

@bramhanandlingala

@bramhanandlingala bramhanandlingala commented Apr 10, 2026 •

Copy link
Copy Markdown

Closes #10423

Currently, the operator:

Uses HTTP health check (/pg/status)
Ignores Kubernetes Pod readiness (IsPodReady)
This causes premature failovers and split-brain risk.

The failover logic relies on AllReadyInstancesStatusUnreachable(), which treats HTTP failures as full unavailability without considering Kubernetes Pod readiness (IsPodReady).

AllReadyInstancesStatusUnreachable() to:
Consider only pods that are marked Ready by the kubelet
Ignore transient HTTP failures if the pod is still Ready
Trigger failover only when pods are both NotReady and unreachable via HTTP

@bramhanandlingala
bramhanandlingala requested a review from a team April 10, 2026 03:44
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Apr 10, 2026
@cnpg-bot cnpg-bot added backport-requested ◀️ This pull request should be backported to all supported releases release-1.25 release-1.28 labels Apr 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

❗ By default, the pull request is configured to backport to all release branches.

  • To stop backporting this pr, remove the label: backport-requested ◀️ or add the label 'do not backport'
  • To stop backporting this pr to a certain release branch, remove the specific branch label: release-x.y

@dosubot dosubot Bot added the bug 🐛 Something isn't working label Apr 10, 2026
@bramhanandlingala

bramhanandlingala commented Apr 10, 2026 •

Copy link
Copy Markdown
Author

Currently, the operator:
Uses HTTP health check (/pg/status)
Ignores Kubernetes Pod readiness (IsPodReady)

This causes Premature failovers and Split-brain risk

The failover logic relies on AllReadyInstancesStatusUnreachable(), which treats HTTP failures
as full unavailability without considering Kubernetes Pod readiness (IsPodReady).

fix could be below changes
Update AllReadyInstancesStatusUnreachable() to:

  • Consider only pods that are marked Ready by the kubelet
  • Ignore transient HTTP failures if the pod is still Ready
  • Trigger failover only when pods are both NotReady and unreachable via HTTP

issue #10423
closes #10423

@bramhanandlingala

Copy link
Copy Markdown
Author

Please review this PR, Any blockers please let me know

@bramhanandlingala bramhanandlingala changed the title Operator initiates failover without waiting for kubelet to confirm pod is not ready #10423 Operator initiates failover without waiting for kubelet to confirm pod is not ready May 25, 2026
@bramhanandlingala

Copy link
Copy Markdown
Author

Hi @cloudnative-pg/maintainers, @jsilvela @NiccoloFei @litaocdl
Could you please review this pull request? Let me know if there are any blockers or feedback. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-requested ◀️ This pull request should be backported to all supported releases bug 🐛 Something isn't working release-1.28 release-1.30 size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Operator initiates failover without waiting for kubelet to confirm pod is not ready

4 participants