Skip to content

improve: getSecondaryResourcesAsStream(expectedType,eventSourceName) does not have to be Kubernetes resources#3377

Merged
csviri merged 1 commit into
operator-framework:nextfrom
csviri:seconday-stream
May 26, 2026
Merged

improve: getSecondaryResourcesAsStream(expectedType,eventSourceName) does not have to be Kubernetes resources#3377
csviri merged 1 commit into
operator-framework:nextfrom
csviri:seconday-stream

Conversation

@csviri
Copy link
Copy Markdown
Collaborator

@csviri csviri commented May 26, 2026

In a previous PR we added overloaded functions for accessing resources from event sources. Some of those were limited to Kubernetes resources. I've just realized that this one should not be one of them.

…does not have to be Kubernetes resources

Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Copilot AI review requested due to automatic review settings May 26, 2026 07:33
@openshift-ci openshift-ci Bot requested review from metacosm and xstefank May 26, 2026 07:33
@csviri csviri changed the base branch from main to next May 26, 2026 07:34
@csviri
Copy link
Copy Markdown
Collaborator Author

csviri commented May 26, 2026

@afalhambra-hivemq FYI just a small adjustment for this one method. Pls let us know if it makes sense also for you.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR broadens the Context#getSecondaryResourcesAsStream(Class, String) API so it can be used with non-Kubernetes (non-HasMetadata) secondary resources, aligning it with the framework’s support for external event sources.

Changes:

  • Relaxed the generic bound on getSecondaryResourcesAsStream(Class<R>, String eventSourceName) from R extends HasMetadata to unconstrained R.
  • Updated DefaultContext to match the interface signature change.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/Context.java Updates the public Context API signature to allow streaming non-HasMetadata secondary resources from a named event source.
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/DefaultContext.java Aligns the concrete implementation method signature with the updated Context contract.

*/
<R extends HasMetadata> Stream<R> getSecondaryResourcesAsStream(
Class<R> expectedType, String eventSourceName);
<R> Stream<R> getSecondaryResourcesAsStream(Class<R> expectedType, String eventSourceName);

@Override
public <R extends HasMetadata> Stream<R> getSecondaryResourcesAsStream(
public <R> Stream<R> getSecondaryResourcesAsStream(
@afalhambra-hivemq
Copy link
Copy Markdown
Contributor

@afalhambra-hivemq FYI just a small adjustment for this one method. Pls let us know if it makes sense also for you.

@csviri, yes, makes sense to me. The stream method's fallback doesn't do anything HasMetadata-specific, and the fast path's constraint comes from ResourceCache itself anyway. No impact on us.

Copy link
Copy Markdown
Contributor

@afalhambra-hivemq afalhambra-hivemq left a comment

Choose a reason for hiding this comment

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

LGTM! thanks!

@csviri csviri merged commit f214108 into operator-framework:next May 26, 2026
45 of 47 checks passed
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.

4 participants