Skip to content

fix(hibernation): report WaitingForHealthy condition for non-healthy clusters #10193

Merged
mnencia merged 2 commits intomainfrom
dev/10024
Mar 11, 2026
Merged

fix(hibernation): report WaitingForHealthy condition for non-healthy clusters #10193
mnencia merged 2 commits intomainfrom
dev/10024

Conversation

@armru
Copy link
Member

@armru armru commented Mar 6, 2026

When the hibernation annotation is set on a non-healthy cluster (e.g. CrashLoopBackOff), the operator correctly defers hibernation until the cluster recovers. However, this decision was previously silent — no condition was set, leaving cnpg status unable to report why hibernation had not started.

This PR addresses the missing reporting aspect of the issue. Non-healthy clusters with the hibernation annotation now receive a WaitingForHealthy condition (Status=False), providing clear feedback through cnpg status where previously there was none. The underlying behavior — deferring hibernation until the cluster is healthy — remains unchanged.

No pre-existing behavior is altered:

  • Healthy clusters requesting hibernation still proceed immediately
  • Already-ongoing hibernation (DeletingPods, WaitingPodsDeletion, Hibernated) still bypasses the healthy-phase guard
  • Clusters without the annotation remain unaffected

Note: this does not solve the broader problem of hibernating a cluster that will never become healthy on its own (e.g. persistent CrashLoopBackOff). That would require a separate discussion about allowing forced hibernation when PVCs are already fully provisioned.

Ref #10024

@armru armru requested a review from a team as a code owner March 6, 2026 11:32
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Mar 6, 2026
@cnpg-bot cnpg-bot added backport-requested ◀️ This pull request should be backported to all supported releases release-1.25 release-1.27 release-1.28 labels Mar 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

❗ 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

@armru
Copy link
Member Author

armru commented Mar 6, 2026

/test

@dosubot dosubot bot added the bug 🐛 Something isn't working label Mar 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

@armru, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/22761653231

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 10, 2026
…clusters (#10024)

When the hibernation annotation is set on a non-healthy cluster
(e.g. CrashLoopBackOff), the operator correctly defers hibernation
until the cluster recovers. However, this decision was previously
silent — no condition was set, leaving `cnpg status` unable to
report why hibernation had not started.

This is a purely additive fix. No pre-existing behavior is altered:
- Healthy clusters requesting hibernation still proceed immediately
- Already-ongoing hibernation (DeletingPods, WaitingPodsDeletion,
  Hibernated) still bypasses the healthy-phase guard
- Clusters without the annotation remain unaffected

The only new behavior is that non-healthy clusters with the
hibernation annotation now receive a WaitingForHealthy condition
(Status=False), providing clear feedback through `cnpg status`
where previously there was none.

Closes #10024

Signed-off-by: Armando Ruocco <[email protected]>
Signed-off-by: Marco Nenciarini <[email protected]>
@mnencia mnencia merged commit ff48dfa into main Mar 11, 2026
44 checks passed
@mnencia mnencia deleted the dev/10024 branch March 11, 2026 17:04
cnpg-bot pushed a commit that referenced this pull request Mar 11, 2026
…clusters (#10193)

When the hibernation annotation is set on a non-healthy cluster (e.g.
CrashLoopBackOff), the operator correctly defers hibernation until the
cluster recovers. However, this decision was previously silent — no
condition was set, leaving `cnpg status` unable to report why
hibernation had not started.

This PR addresses the missing reporting aspect of the issue. Non-healthy
clusters with the hibernation annotation now receive a
`WaitingForHealthy` condition (`Status=False`), providing clear feedback
through `cnpg status` where previously there was none. The underlying
behavior — deferring hibernation until the cluster is healthy — remains
unchanged.

No pre-existing behavior is altered:
- Healthy clusters requesting hibernation still proceed immediately
- Already-ongoing hibernation (DeletingPods, WaitingPodsDeletion,
Hibernated) still bypasses the healthy-phase guard
- Clusters without the annotation remain unaffected

Note: this does not solve the broader problem of hibernating a cluster
that will never become healthy on its own (e.g. persistent
CrashLoopBackOff). That would require a separate discussion about
allowing forced hibernation when PVCs are already fully provisioned.

Ref #10024

Signed-off-by: Armando Ruocco <[email protected]>
Signed-off-by: Marco Nenciarini <[email protected]>
Co-authored-by: Marco Nenciarini <[email protected]>
(cherry picked from commit ff48dfa)
cnpg-bot pushed a commit that referenced this pull request Mar 11, 2026
…clusters (#10193)

When the hibernation annotation is set on a non-healthy cluster (e.g.
CrashLoopBackOff), the operator correctly defers hibernation until the
cluster recovers. However, this decision was previously silent — no
condition was set, leaving `cnpg status` unable to report why
hibernation had not started.

This PR addresses the missing reporting aspect of the issue. Non-healthy
clusters with the hibernation annotation now receive a
`WaitingForHealthy` condition (`Status=False`), providing clear feedback
through `cnpg status` where previously there was none. The underlying
behavior — deferring hibernation until the cluster is healthy — remains
unchanged.

No pre-existing behavior is altered:
- Healthy clusters requesting hibernation still proceed immediately
- Already-ongoing hibernation (DeletingPods, WaitingPodsDeletion,
Hibernated) still bypasses the healthy-phase guard
- Clusters without the annotation remain unaffected

Note: this does not solve the broader problem of hibernating a cluster
that will never become healthy on its own (e.g. persistent
CrashLoopBackOff). That would require a separate discussion about
allowing forced hibernation when PVCs are already fully provisioned.

Ref #10024

Signed-off-by: Armando Ruocco <[email protected]>
Signed-off-by: Marco Nenciarini <[email protected]>
Co-authored-by: Marco Nenciarini <[email protected]>
(cherry picked from commit ff48dfa)
cnpg-bot pushed a commit that referenced this pull request Mar 11, 2026
…clusters (#10193)

When the hibernation annotation is set on a non-healthy cluster (e.g.
CrashLoopBackOff), the operator correctly defers hibernation until the
cluster recovers. However, this decision was previously silent — no
condition was set, leaving `cnpg status` unable to report why
hibernation had not started.

This PR addresses the missing reporting aspect of the issue. Non-healthy
clusters with the hibernation annotation now receive a
`WaitingForHealthy` condition (`Status=False`), providing clear feedback
through `cnpg status` where previously there was none. The underlying
behavior — deferring hibernation until the cluster is healthy — remains
unchanged.

No pre-existing behavior is altered:
- Healthy clusters requesting hibernation still proceed immediately
- Already-ongoing hibernation (DeletingPods, WaitingPodsDeletion,
Hibernated) still bypasses the healthy-phase guard
- Clusters without the annotation remain unaffected

Note: this does not solve the broader problem of hibernating a cluster
that will never become healthy on its own (e.g. persistent
CrashLoopBackOff). That would require a separate discussion about
allowing forced hibernation when PVCs are already fully provisioned.

Ref #10024

Signed-off-by: Armando Ruocco <[email protected]>
Signed-off-by: Marco Nenciarini <[email protected]>
Co-authored-by: Marco Nenciarini <[email protected]>
(cherry picked from commit ff48dfa)
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 lgtm This PR has been approved by a maintainer ok to merge 👌 This PR can be merged release-1.25 release-1.27 release-1.28 size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants