fix: assert-polling-error - #2761
Open
FirePheonix wants to merge 1 commit into
Open
Conversation
Signed-off-by: Shubham Singh <shubhsoch@gmail.com>
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.
Explanation
This PR is a bug fix that addresses two related issues with how
assertanderroroperations handle Kubernetes API errors during their polling cycle. Previously, any error other than aNotFoundwould immediately terminate the operation. Additionally, when the poll terminated due to a hard error (or timeout), that terminal error was completely dropped from the logs in favor of printing a stale object snapshot. This change introduces anIsRetriablehelper so that transient server errors safely continue polling, and properly reports the terminal error if the operation times out.Related issue
Fixes #2758
Proposed Changes
IsRetriableHelper: Createdpkg/engine/operations/internal/errors.goto categorizeIsInternalError,IsServiceUnavailable,IsTimeout,IsServerTimeout,IsTooManyRequests, andIsUnexpectedServerErroras retriable.assertanderroroperations to checkinternal.IsRetriable(err)and continue polling.multierraccumulation logic to appendfmt.Errorf("operation terminated with error: %w", err)at the end of the mismatch output so users can accurately debug terminal errors like timeouts or 403s.assertanderrortest suites.Checklist
Further Comments
This change makes Chainsaw significantly more resilient in flaky or overloaded clusters (e.g., during etcd leader elections) by properly honoring the configured
timeoutrather than failing immediately upon the first API blip.