Skip to content

feat: decouple configuration of rate limiting and retry from controller #1317

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

Merged
merged 17 commits into from
Jul 11, 2022

Conversation

metacosm
Copy link
Collaborator

@metacosm metacosm commented Jul 5, 2022

No description provided.

@metacosm metacosm self-assigned this Jul 5, 2022
@metacosm metacosm requested a review from csviri July 5, 2022 13:32
Copy link
Collaborator

@csviri csviri left a comment

Choose a reason for hiding this comment

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

Not sure this is needed, since the getRetry is called only once as far I remember.
Maybe if there are more controllers it spares some memory. But does not hurt.

LGTM

@metacosm metacosm changed the title refactor: do not create a new retry instance if not needed feat: decouple configuration of rate limiting and retry from controller Jul 5, 2022
Copy link
Collaborator

@csviri csviri left a comment

Choose a reason for hiding this comment

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

I have mixed feelings about this concept (well that includes positive ones :) ) , for now we had every configuration in @ControllerConfiguration configutation, here some of the configuration would be not part of it but a separate annotation. It makes sense if users want to configure own implementation of these concepts (retry, rate limit). However the default implementations should cover most of the cases. The extensibility is mostly there for sake of generality.

I'm not opposing, I see what problem this solves, just pointing out that separate annotations, are subject of developers annoyance, since you have to learn this feature from the docs, not directly visible from the code.
Therefore we have to document this very carefully both in docs and javadoc

@metacosm metacosm marked this pull request as ready for review July 7, 2022 07:37
@metacosm metacosm requested a review from csviri July 7, 2022 07:37
Copy link
Collaborator

@csviri csviri left a comment

Choose a reason for hiding this comment

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

Made comments, mostly about naming.

/**
* Optional list of {@link Dependent} configurations which associate a resource type to a
* {@link io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource} implementation
*
* @return the list of {@link Dependent} configurations
*/
Dependent[] dependents() default {};

Class<? extends Retry> retry() default GenericRetry.class;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe have some javadoc here? link how to configur it.

this.limitForPeriod = configuration.maxReconciliations();
}

public boolean isActivated() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don;t think this needs to be exposed, thus should not be public.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's used in a test in a different package so no choice… :(

@metacosm
Copy link
Collaborator Author

Addressed comments.

@metacosm metacosm requested a review from csviri July 11, 2022 10:42
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 61 Code Smells

67.2% 67.2% Coverage
0.3% 0.3% Duplication

@metacosm metacosm merged commit f54bdd0 into next Jul 11, 2022
@metacosm metacosm deleted the clean-configuration branch July 11, 2022 15:21
csviri added a commit that referenced this pull request Jul 13, 2022
csviri added a commit that referenced this pull request Jul 13, 2022
csviri added a commit that referenced this pull request Jul 13, 2022
csviri added a commit that referenced this pull request Jul 14, 2022
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.

2 participants