Skip to content

Conversation

@csviri
Copy link
Collaborator

@csviri csviri commented Jan 21, 2026

No description provided.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 21, 2026
@csviri csviri changed the title feat: distict latest resource collector feat: distinct latest resource collector Jan 21, 2026
@csviri csviri marked this pull request as ready for review January 26, 2026 14:23
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 26, 2026
@openshift-ci openshift-ci bot requested review from metacosm and xstefank January 26, 2026 14:23
csviri and others added 5 commits January 27, 2026 12:09
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
…tor/api/reconciler/ReconcileUtils.java

Co-authored-by: Martin Stefanko <xstefank122@gmail.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
* @param <T> the type of HasMetadata objects
* @return a collector that produces a List of deduplicated Kubernetes objects
*/
public static <T extends HasMetadata> Collector<T, ?, List<T>> latestDistinctList() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't get why this method or the set variant are needed or even useful. The semantic should be a Set since instances should be unique, no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The Set variant is needed since we are covering the use case whern there are multiple event sources for same type without distinct set of resource watched, so we returning the latest of those.

I added List just for convinience. If somebody would prefer working above Lists, that is quite common I beleive, but you are right that the semantically Set is the correct one.

new ResourceID(resource.getMetadata().getName(), resource.getMetadata().getNamespace()),
resource -> resource,
(existing, replacement) ->
compareResourceVersions(existing, replacement) >= 0 ? existing : replacement);
Copy link
Collaborator Author

@csviri csviri Jan 27, 2026

Choose a reason for hiding this comment

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

cc @metacosm this is the point to keep of this PR, just to keep the latest

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.

Support distinct if multiple ES for same type for getSecondaryResources()

3 participants