-
Notifications
You must be signed in to change notification settings - Fork 235
feat: provide de-duplicated secondary resources stream on Context #3141
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
base: next
Are you sure you want to change the base?
Conversation
Signed-off-by: Attila Mészáros <[email protected]>
Signed-off-by: Attila Mészáros <[email protected]>
Signed-off-by: Attila Mészáros <[email protected]>
…tor/api/reconciler/ReconcileUtils.java Co-authored-by: Martin Stefanko <[email protected]>
Signed-off-by: Attila Mészáros <[email protected]>
Signed-off-by: Attila Mészáros <[email protected]>
Signed-off-by: Attila Mészáros <[email protected]>
Signed-off-by: Chris Laprun <[email protected]>
Alternative without requiring collecting to a Map Signed-off-by: Chris Laprun <[email protected]>
...-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/DefaultContext.java
Show resolved
Hide resolved
...-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/DefaultContext.java
Show resolved
Hide resolved
| * @param <T> the type of HasMetadata objects | ||
| * @return a collector that produces a collection of deduplicated Kubernetes objects | ||
| */ | ||
| public static <T extends HasMetadata> Collector<T, ?, Collection<T>> latestDistinct() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wasn't this moved to ReconcileUtilsInternal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we were to keep this implementation, this actually would be removed
csviri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some minor comments, pls add unit tests! Otherwise looks great, thank you!!
|
|
||
| default <R> Stream<R> getSecondaryResourcesAsStream(Class<R> expectedType) { | ||
| return getSecondaryResources(expectedType).stream(); | ||
| return getSecondaryResourcesAsStream(expectedType, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we could use the former implementation and call this in case in the new method the deduplication is false.
...-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/DefaultContext.java
Show resolved
Hide resolved
| return controller.getEventSourceManager().getEventSourcesFor(expectedType).stream() | ||
| .map(es -> es.getSecondaryResources(primaryResource)) | ||
| .flatMap(Set::stream); | ||
| public <R> Stream<R> getSecondaryResourcesAsStream(Class<R> expectedType, boolean deduplicate) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add comprehensive javadoc
Alternative to #3130, to discuss