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

fixes and api improvements #775

Merged
merged 1 commit into from
Jan 3, 2022
Merged

fixes and api improvements #775

merged 1 commit into from
Jan 3, 2022

Conversation

csviri
Copy link
Collaborator

@csviri csviri commented Dec 23, 2021

No description provided.

@csviri csviri self-assigned this Dec 23, 2021
@csviri csviri marked this pull request as ready for review December 23, 2021 13:15
@@ -6,5 +6,9 @@

Optional<RetryInfo> getRetryInfo();

<T> T getSecondaryResource(Class<T> expectedType, String... qualifier);
default <T> T getSecondaryResource(Class<T> expectedType) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@metacosm is this ok with you, kind would like it to limit it in this scope. Since more qualifiers does not make sense, and if dependent resources will use the previous way it will be backwards compatible anyway. So it can be changed back without breaking the api.

EventSourceManager manager = initManager();

CachingEventSource eventSource = mock(CachingEventSource.class);
when(eventSource.getResourceClass()).thenReturn(String.class);
when(eventSource.getResourceClass()).thenReturn(InformerEventSource.class);
Copy link
Collaborator

Choose a reason for hiding this comment

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

That's not correct. getResourceClass is supposed to return the class handled by the event source. So if you specify that the resource class is InformerEventSource, this means that your event source deals with InformerEventSources which doesn't really make sense. Granted, String doesn't make a lot more sense either but it's a little bit more realistic and doesn't risk clashing with the EventSource class itself (which should be reserved for cases where there is no associated type with an EventSource).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ohh, yes, sorry my fault, will change it!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

import io.fabric8.kubernetes.model.annotation.Version;

@Group("sample.javaoperatorsdk.io")
@Version("v1")
@Kind("TestCustomResource")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is needed to compare resources when we register a new reonciler. There was a tests for the registration of the same resource with multiple versions - what should fail. It did not fail without this, could not determine the kind. It was not failing until now because there were junit4 annotations used on test class

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see ControllerManagerTest.java changes

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If that functionality should work without this annotation, that should be a separate issues IMHO.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It shouldn't be needed here. Just for the v2.

import io.fabric8.kubernetes.model.annotation.Version;

@Group("sample.javaoperatorsdk.io")
@Version("v2")
@Kind("TestCustomResource")
Copy link
Collaborator

Choose a reason for hiding this comment

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

OK, I guess you added it to the V1 version for symmetry?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

same as above

@metacosm metacosm merged commit 2bbace6 into main Jan 3, 2022
@metacosm metacosm deleted the api-review branch January 3, 2022 15:38
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.

None yet

2 participants