feat(plugins): handle requeue behavior from lifecycle hooks#10283
Open
gabriele-wolfox wants to merge 6 commits intocloudnative-pg:mainfrom
Open
feat(plugins): handle requeue behavior from lifecycle hooks#10283gabriele-wolfox wants to merge 6 commits intocloudnative-pg:mainfrom
gabriele-wolfox wants to merge 6 commits intocloudnative-pg:mainfrom
Conversation
Contributor
|
❗ By default, the pull request is configured to backport to all release branches.
|
f61153b to
401d225
Compare
Handle the BEHAVIOR_REQUEUE response from plugins in lifecycle hooks, allowing plugins to signal that a dependency is not yet available without treating it as an error condition. Changes: - Add RequeueError type and helper functions in plugin client - Handle BEHAVIOR_REQUEUE in lifecycle hook response processing - Handle RequeueError gracefully in cluster controller without setting failure phase Signed-off-by: Gabriele Quaresima <gabriele.quaresima@enterprisedb.com>
Use the forked cnpg-i that includes BEHAVIOR_REQUEUE support in OperatorLifecycleResponse. Signed-off-by: Gabriele Quaresima <gabriele.quaresima@enterprisedb.com>
Call the lifecycle hook before PVC creation/readiness checks to prevent deadlocks when using WaitForFirstConsumer storage class with plugins that return REQUEUE (e.g., waiting for a custom resource to be created). Two code paths are covered: 1. createPrimaryInstance: Call lifecycle hook before generateNodeSerial to prevent status update before plugin is ready. Without this, the cluster would become unrecoverable (LatestGeneratedNode != 0 with no PVCs). 2. ensureInstancesAreCreated: Call lifecycle hook before PVC readiness checks to prevent waiting forever on unbound WaitForFirstConsumer PVCs. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Gabriele Quaresima <gabriele.quaresima@enterprisedb.com>
Ensure wrapAsPluginErrorIfNeeded passes through RequeueError without wrapping it inside a pluginError. Without this fix, the requeue signal would also be classified as a plugin failure if check ordering changed. Also improves RequeueError.Error() to include the duration, extracts the default requeue interval into a named constant, documents the double lifecycle hook in createPrimaryInstance, and adds integration and unit tests for the full BEHAVIOR_REQUEUE path. Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
401d225 to
149600f
Compare
Add tests for untested paths: zero and negative RequeueAfter values, non-requeue error propagation from early lifecycle hooks, and BEHAVIOR_CONTINUE regression test. Guard against negative requeue durations in the controller with <= 0 check instead of == 0. Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
armru
approved these changes
Mar 18, 2026
Member
|
/test |
Contributor
|
@armru, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/23242231742 |
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
armru
approved these changes
Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10290 .
Needs cloudnative-pg/cnpg-i#293, then a commit to update go.mod reference to CNPGI module, removing the replace directives.
Handle the
BEHAVIOR_REQUEUEresponse from plugins in lifecycle hooks, allowing plugins to signal that a dependency is not yet available without treating it as an error condition.Changes:
RequeueErrortype and helper functions in plugin clientBEHAVIOR_REQUEUEin lifecycle hook response processingRequeueErrorgracefully in cluster controller without setting failure phase