Skip to content

fix: return error immediately on failed reconciliation status#5692

Open
Aman-Cool wants to merge 1 commit into
fluxcd:mainfrom
Aman-Cool:fix/reconcile-fail-fast-v2
Open

fix: return error immediately on failed reconciliation status#5692
Aman-Cool wants to merge 1 commit into
fluxcd:mainfrom
Aman-Cool:fix/reconcile-fail-fast-v2

Conversation

@Aman-Cool

Copy link
Copy Markdown
Contributor

Flux reconcile does not fail fast on Failed status

flux reconcile does not fail fast when a resource is already in Failed status.

The polling condition treats FailedStatus the same as InProgressStatus, so the command waits until the full timeout (default 5 minutes) before reporting an error.

This causes unnecessary delays and poor UX. The fix is to return an error for terminal failure states, matching the behavior of isObjectReady().

@Aman-Cool

Copy link
Copy Markdown
Contributor Author

@matheuscscp @stefanprodan ,This makes flux reconcile fail fast when a resource is already in Failed status, instead of waiting for the full timeout. It aligns the behavior with isObjectReady() and improves CLI UX without affecting successful reconciliations.

Comment thread cmd/flux/reconcile.go Outdated

@matheuscscp matheuscscp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matheuscscp

Copy link
Copy Markdown
Member

Please squash

Co-authored-by: Matheus Pimenta <matheuscscp@gmail.com>
Signed-off-by: Aman-Cool <aman017102007@gmail.com>
@Aman-Cool
Aman-Cool force-pushed the fix/reconcile-fail-fast-v2 branch from bd3f10b to 0a29617 Compare January 26, 2026 17:08
@Aman-Cool

Copy link
Copy Markdown
Contributor Author

@matheuscscp , Squashed into a single commit. All checks are green.

@Aman-Cool

Copy link
Copy Markdown
Contributor Author

@stefanprodan ,Please see it when you have time, happy to help if it needs any updates. Thanks!

@themavik themavik left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reconciliationHandled now returns fmt.Errorf(result.Message) for non-Current kstatus instead of (false, nil), so failed reconciles bubble up. nit: InProgress still returns false, nil—still the right shape for the wait loop?

@stefanprodan

Copy link
Copy Markdown
Member

With the health check cancellation we've shipped in 2.8 this change would make things worse. We should be waiting and not bailout if Ready=False but the reason is https://github.com/fluxcd/pkg/blob/357bbcc3462ccf78cc17fd0b9b7d498b1848bf14/apis/meta/conditions.go#L162

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants