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

feat: Make @Configured, @GradualRetry and @RateLimited Inherited (#2091) #2092

Merged

Conversation

BramMeerten
Copy link
Contributor

@BramMeerten BramMeerten commented Oct 13, 2023

Noticed that for @Configured there already was a test with an annotation on a superclass (BaseConfigurationServiceTest::configuringFromCustomAnnotationsShouldWork). Custom code was written in DependentResourceConfigurationResolver.java to make this work. But seems unneeded when @Configured is inherited.

@openshift-ci openshift-ci bot requested review from adam-sandor and csviri October 13, 2023 17:27
@BramMeerten BramMeerten force-pushed the feat/annotations-inherited branch 3 times, most recently from 50b715e to 1545e47 Compare October 15, 2023 09:38
@BramMeerten
Copy link
Contributor Author

BramMeerten commented Oct 15, 2023

Not sure why the check_format_and_unit_tests step is failing, I imported the google code style into Intellij as the contributing guidelines requested and formatted using Intellij.
I also tried to run mvn -f operator-framework net.revelc.code.formatter:formatter-maven-plugin:2.23.0:format as the output of the failed build step suggests, but that reformats the code to 4 spaces indentation (among other things)..

edit: the links in contributing doc to code style do not work

@csviri
Copy link
Collaborator

csviri commented Oct 17, 2023

@BramMeerten running just mvn clean install should fix the formatting. Would it be possible to target next branch, instead of main?

@BramMeerten BramMeerten force-pushed the feat/annotations-inherited branch from 1545e47 to 917752d Compare October 17, 2023 12:57
@BramMeerten BramMeerten changed the base branch from main to next October 17, 2023 12:57
@BramMeerten
Copy link
Contributor Author

@csviri Updated it, noticed one test is failing registerConverterShouldWork. Don't have time for it today. Will try to look tomorrow.

@csviri csviri force-pushed the feat/annotations-inherited branch from 917752d to 746f34c Compare October 17, 2023 13:38
@csviri csviri deleted the branch operator-framework:next October 18, 2023 10:46
@csviri csviri closed this Oct 18, 2023
@metacosm
Copy link
Collaborator

I don't think this should have been closed, @csviri.

@csviri
Copy link
Collaborator

csviri commented Oct 18, 2023

Sorry this was a mistake.

@csviri
Copy link
Collaborator

csviri commented Oct 18, 2023

Ahh, I know what happened, merged the next into main, therefor the next branch branch was deleted

@csviri csviri reopened this Oct 18, 2023
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 18, 2023
@metacosm
Copy link
Collaborator

Ahh, I know what happened, merged the next into main, therefor the next branch branch was deleted

Yeah, that's what I thought as well, just wanted to make sure you were aware of it :)

@csviri
Copy link
Collaborator

csviri commented Oct 24, 2023

@BramMeerten do you plan to proceed with this issue?

@BramMeerten
Copy link
Contributor Author

@csviri Yes, sorry had a very busy week. I probably won't have time until the weekend

@csviri
Copy link
Collaborator

csviri commented Oct 25, 2023

@csviri Yes, sorry had a very busy week. I probably won't have time until the weekend

@BramMeerten sure, no hury, thank you!

@BramMeerten BramMeerten force-pushed the feat/annotations-inherited branch from 746f34c to 2512336 Compare October 29, 2023 20:33
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 29, 2023
@BramMeerten
Copy link
Contributor Author

@csviri this is ready now to be reviewed.

In my first version I made @Configured inherited as well, but I had to revert that because it was a breaking change. It's hard to explain why it's breaking, it's easiest to explain if you run this test: DependentResourceConfigurationResolverTest::registerConverterShouldWork

Step 1

First a converter is registered for KubernetesDependentResource

DependentResourceConfigurationResolver.registerConverter(KubernetesDependentResource.class, overriddenConverter);

Step 2

Configuration is extracted from @Configured for ServiceDep (extends from KubernetesDependentResource)

DependentResourceConfigurationResolver.extractConfigurationFromConfigured(ServiceDep.class, cfg);

Step 2.a
Find Configured annotation for ServiceDep (DependentResourceConfigurationResolver::getConfigured).

  • In the @inherited version it will find the annotation immediately in the first iteration.
  • In the non-@Inherited version it will find the same annotation, but it takes two iterations. The annotation is fetched from the superclass (KubernetesDependentResource).

Step 2.b
Return Configured in a ConfiguredClassPair.

  • In the @Inherited version the annotatedClass param is ServiceDep because it's found in the first iteration.
  • In the non-@Inherited version the param is KubernetesDependentResource because the annotation was found on the superclass.

Step 2.c
Use the ConfiguredClassPair::annotatedClass to look for existing converters.

  • In the @Inherited version none will be found because there is no converter for ServiceDep. The overriddenConverter from step 1 was configured for KubernetesDependentResource.
  • In the non-@Inherited version the overriddenConverter from step 1 is found.

@BramMeerten
Copy link
Contributor Author

One check (integration_tests (11, v1.25.14) failed because "The operation was canceled." but tests were successful

The other check (sample_operators_tests) works locally on my laptop and I don't think my changes impact these tests. So not sure what is happening.

@csviri
Copy link
Collaborator

csviri commented Oct 30, 2023

Hi Bram, the failing tests are currently under investigation, not relevant for your PR.
Will try to review it asap just currently AFK mostly for next 2 weeks, but probably will be able find some time. Thank you!

@csviri csviri requested a review from metacosm November 13, 2023 15:53
@csviri csviri merged commit b9e0b82 into operator-framework:next Nov 13, 2023
csviri added a commit that referenced this pull request Nov 14, 2023
…) (#2092)

Signed-off-by: Bram Meerten <bram.mee@gmail.com>

Co-authored-by: Attila Mészáros <csviri@gmail.com>
Signed-off-by: Attila Mészáros <csviri@gmail.com>
csviri added a commit that referenced this pull request Nov 14, 2023
…) (#2092)

Signed-off-by: Bram Meerten <bram.mee@gmail.com>

Co-authored-by: Attila Mészáros <csviri@gmail.com>
csviri added a commit that referenced this pull request Nov 20, 2023
…) (#2092)

Signed-off-by: Bram Meerten <bram.mee@gmail.com>

Co-authored-by: Attila Mészáros <csviri@gmail.com>
csviri added a commit that referenced this pull request Nov 20, 2023
…) (#2092)

Signed-off-by: Bram Meerten <bram.mee@gmail.com>

Co-authored-by: Attila Mészáros <csviri@gmail.com>
Signed-off-by: Attila Mészáros <csviri@gmail.com>
@csviri csviri linked an issue Dec 12, 2023 that may be closed by this pull request
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.

Make @GradualRetry inherited
4 participants