Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: Console controller error handling improvements #1817

Merged
merged 21 commits into from
Feb 10, 2025

Conversation

maciaszczykm
Copy link
Member

@maciaszczykm maciaszczykm commented Jan 29, 2025

It's not everything yet, but waiting longer can cause conflicts. It will also be easier to use similar method in other changes once this gets merged.

Tested on dev cluster with sample custom resources.

Copy link

linear bot commented Jan 29, 2025

@maciaszczykm maciaszczykm added the enhancement New feature or request label Jan 29, 2025
Comment on lines +37 to +48
// handleRequeue allows avoiding rate limiting when some errors occur,
// i.e., when a resource is not created yet, or when it is waiting for an ID.
//
// If the result is set, then any potential error will be saved in a condition
// and ignored in the return to avoid rate limiting.
//
// It is important that at least one from a result or an error have to be non-nil.
func handleRequeue(result *ctrl.Result, err error, setCondition func(condition metav1.Condition)) (ctrl.Result, error) {
utils.MarkCondition(setCondition, v1alpha1.SynchronizedConditionType, metav1.ConditionFalse,
v1alpha1.SynchronizedConditionReasonError, defaultErrMessage(err, ""))
return lo.FromPtr(result), lo.Ternary(result != nil, nil, err)
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Highlighting the function that handles requeue logic.

@maciaszczykm maciaszczykm marked this pull request as ready for review February 10, 2025 12:02
@maciaszczykm maciaszczykm requested a review from a team February 10, 2025 13:13
@michaeljguarino
Copy link
Member

how much testing have we done here?

@maciaszczykm maciaszczykm merged commit f941814 into master Feb 10, 2025
13 checks passed
@maciaszczykm maciaszczykm deleted the marcin/prod-3146-console-controller-improvements branch February 10, 2025 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants