Skip to content

Controller: Per-key increasing backoff #1916

@alvaroaleman

Description

@alvaroaleman

Would you like to work on this feature?

None

What problem are you trying to solve?

Hello,

Trying to leverage kube-rs to builder a Kubernetes controller, I noticed that there doesn't really seem to be a way to use per-key increasing backoff for reconciliation failures. Using such a backoff strategy (usually exponentially) is done in all go Kubernetes controllers that I've seen, both in-tree and out of tree. It ensures both that transient errors are retried quickly as well as avoids overloading external components by reducing the retry frequency if errors do not go away on retry.

The way this is handled in kube-rs is through the error_policy which gets called on errors but not on successes. Any sort of per-key increasing backoff is stateful in the sense that it needs to know how many failures for the given key occured previously and clear that if a key was reconciled successfully. Due to the error policy not being notified on successes, there is no straight forward way to achieve this from what I can tell. In theory it would probably be possible to implement this through an error_policy that wraps the reconciler to get this information but that seems overly complex to me.

Do you have ideas/thoughts/opinions on how to best achieve this and what is the compatibility policy of kube-rs? In the go ecosystem, all of this is done through a configurable ratelimiter that is part of a configurable workqueue.

Describe the solution you'd like

Something that just works out of the box :)

Describe alternatives you've considered

/

Documentation, Adoption, Migration Strategy

No response

Target crate for feature

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions